stop-cluster #1622
This file contains hidden or 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: stop-cluster | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| # - cron: '0 16 * * 1-5' #utc Summer time - Initial | |
| # - cron: '0 18 * * 1-5' #utc Summer time - Runs second time if initial run did not succeed | |
| - cron: '0 17 * * 1-5' #utc Winter time - Initial | |
| - cron: '0 19 * * 1-5' #utc Winter time - Runs second time if initial run did not succeed | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| stop-dev-clusters: | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/master' | |
| steps: | |
| - name: 'Clone repo' | |
| uses: actions/checkout@v4 #Clone Repo | |
| - name: 'Terraform CLI' | |
| uses: hashicorp/setup-terraform@v3 | |
| with: | |
| terraform_version: 'latest' | |
| - name: 'Az CLI login' | |
| uses: azure/login@v2 | |
| with: | |
| client-id: "94ad7918-e504-4132-9916-0293689cd140" | |
| tenant-id: "3aa4a235-b6e2-48d5-9195-7fcf05b459b0" | |
| subscription-id: "16ede44b-1f74-40a5-b428-46cca9a5741b" | |
| - name: Get GitHub Public IP | |
| id: github_public_ip | |
| run: echo "ipv4=$(curl 'https:///ifconfig.me/ip')" >> $GITHUB_OUTPUT | |
| - name: Add GitHub IP to StorageAccount | |
| run: | | |
| az storage account network-rule add \ | |
| --resource-group "s941-tfstate" \ | |
| --account-name "s941radixinfra" \ | |
| --ip-address ${{ steps.github_public_ip.outputs.ipv4 }} >/dev/null | |
| - name: Lets sleep for 30 seconds for FW rule to complete | |
| run: sleep 30s | |
| - name: Stop clusters | |
| run: RADIX_ZONE=dev SLACK_WEBHOOK_URL=${{ secrets.SLACK_WEBHOOK }} TASK=stop .github/workflows/scripts/dailytasks.sh | |
| - name: Revoke GitHub IP on StorageAccount | |
| run: | | |
| az storage account network-rule remove \ | |
| --resource-group "s941-tfstate" \ | |
| --account-name "s941radixinfra" \ | |
| --ip-address ${{ steps.github_public_ip.outputs.ipv4 }} >/dev/null |