Daily Resource Group Cleanup Pipeline #154
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: "Daily Resource Group Cleanup Pipeline" | |
| on: | |
| schedule: | |
| - cron: '0 23 * * *' # Every day at 23:00 UTC | |
| workflow_dispatch: | |
| permissions: | |
| id-token: write # ОБОВ'ЯЗКОВО для OIDC логіну | |
| contents: read | |
| jobs: | |
| create_pgdb: | |
| name: Cleanup Resource Group | |
| runs-on: ubuntu-latest | |
| environment: dev | |
| env: | |
| RESOURCE_GROUP: ${{ secrets.AZURE_RESOURCE_GROUP }} | |
| steps: | |
| - name: Log in to Azure with OIDC | |
| uses: azure/login@v1 | |
| with: | |
| client-id: ${{ vars.AZURE_CLIENT_ID }} | |
| tenant-id: ${{ vars.AZURE_TENANT_ID }} | |
| subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }} | |
| - name: Delete all resources in the resource group | |
| run: | | |
| echo "Generate Random PostgreSQL Server Name" | |
| az resource list --resource-group $RESOURCE_GROUP --query "[].id" -o tsv | xargs -I {} az resource delete --ids {} |