Skip to content

Commit

Permalink
converted delete branch resources to azcli task
Browse files Browse the repository at this point in the history
Jira ticket: CAMS-
  • Loading branch information
amorrow-flexion committed Jan 27, 2025
1 parent 3f9c817 commit 7554f56
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions .github/workflows/azure-remove-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ on:
workflow_dispatch:
inputs:
hashId:
description: "Hash id of target branch deployment"
default: ""
description: 'Hash id of target branch deployment'
default: ''
type: string

jobs:
Expand All @@ -25,7 +25,7 @@ jobs:
check:
runs-on: ubuntu-latest
if: ${{ inputs.hashId != '' || github.event.ref_type == 'branch' }}
environment: "Develop"
environment: 'Develop'
outputs:
executeCleanup: ${{ steps.check.outputs.executeCleanup }}
targetBranchHashId: ${{ steps.check.outputs.targetBranchHashId }}
Expand Down Expand Up @@ -64,20 +64,25 @@ jobs:
runs-on: ubuntu-latest
needs: [check]
if: needs.check.outputs.executeCleanup == 'true'
environment: "Develop"
environment: 'Develop'
env:
environment: "Develop"
environment: 'Develop'

steps:
- uses: azure/login@v1
- uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
environment: ${{ vars.AZURE_ENVIRONMENT }}
- uses: actions/checkout@v3
- run: |
./ops/scripts/utility/az-delete-branch-resources.sh \
--app-resource-group=${{ secrets.AZ_APP_RG }} \
--db-account=${{ secrets.AZ_COSMOS_MONGO_ACCOUNT_NAME }} \
--db-resource-group=${{ secrets.AZURE_RG }} \
--network-resource-group=${{ secrets.AZ_NETWORK_RG }} \
--short-hash=${{ needs.check.outputs.targetBranchHashId }}
- name: Delete Branch Resources
uses: azure/cli@v2
id: deleteBranchREsourcues
with:
azcliversion: 2.62.0
inlineScript: |
./ops/scripts/utility/az-delete-branch-resources.sh \
--app-resource-group=${{ secrets.AZ_APP_RG }} \
--db-account=${{ secrets.AZ_COSMOS_MONGO_ACCOUNT_NAME }} \
--db-resource-group=${{ secrets.AZURE_RG }} \
--network-resource-group=${{ secrets.AZ_NETWORK_RG }} \
--short-hash=${{ needs.check.outputs.targetBranchHashId }}

0 comments on commit 7554f56

Please sign in to comment.