-
Notifications
You must be signed in to change notification settings - Fork 4
51 lines (49 loc) · 1.75 KB
/
stopcanary.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: stop-canary
on:
workflow_dispatch:
schedule:
- cron: '50 18 * * 1-5' #utc time
permissions:
id-token: write
jobs:
get-target-configs:
name: Get target configs
outputs:
target_configs: ${{ steps.get-target-configs.outputs.target_configs }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Get target configs
id: get-target-configs
run: |
configs=$(ls $GITHUB_WORKSPACE/.github/workflows/cicd-canary-scaler-configs | jq -Rsc '. / "\n" - [""]')
echo ::set-output name=target_configs::${configs}
stop-canary:
name: Stop radix-cicd-canary
runs-on: ubuntu-20.04
needs:
- get-target-configs
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.get-target-configs.outputs.target_configs) }}
steps:
- uses: actions/checkout@v3
- name: Persist environment from ${{ matrix.config }} across steps
run: |
$GITHUB_WORKSPACE/.github/workflows/scripts/persist-env.sh ${{ matrix.config }}
- name: 'Az CLI login'
uses: azure/login@v1
with:
client-id: ${{ env.AZURE_CLIENT_ID }}
tenant-id: 3aa4a235-b6e2-48d5-9195-7fcf05b459b0
subscription-id: ${{ env.AZ_SUBSCRIPTION_ID }}
- uses: azure/use-kubelogin@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
kubelogin-version: 'latest'
- name: 'Scale to 0'
run: |
slack_webhook_url="$(az keyvault secret show --vault-name "$AZ_RESOURCE_KEYVAULT" --name "$KV_SECRET_SLACK_WEBHOOK" | jq -r .value)"
$GITHUB_WORKSPACE/.github/workflows/scripts/scale-cicd-canary.sh "0" "${slack_webhook_url}" "GitHub Action: Stopping radix-cicd-canary in cluster "