start-canary #231
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: start-canary | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '15 5 * * 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} | |
start-canary: | |
name: Start 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 1' | |
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 "1" "${slack_webhook_url}" "GitHub Action: Starting radix-cicd-canary in cluster " |