From 9c82deeaea20ac4bfb5ca13040b05543b58ff6fe Mon Sep 17 00:00:00 2001 From: Richard Hagen Date: Tue, 31 Oct 2023 16:13:39 +0100 Subject: [PATCH] run on dev and prod, check both playground,c2 and prod acr --- .github/workflows/clean-cache-registry.yml | 57 ++++++++++++++++++++-- 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/.github/workflows/clean-cache-registry.yml b/.github/workflows/clean-cache-registry.yml index f592add36..aaefa655d 100644 --- a/.github/workflows/clean-cache-registry.yml +++ b/.github/workflows/clean-cache-registry.yml @@ -8,9 +8,13 @@ permissions: contents: read jobs: - purge: + purge-prod: runs-on: ubuntu-latest environment: s941 + if: false + strategy: + matrix: + registry: [radixc2app, radixprodapp] steps: - uses: actions/checkout@v4 @@ -35,15 +39,58 @@ jobs: subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - name: Add GitHub IP to StorageAccount - run: az acr network-rule add --name radixdevapp --ip-address ${{ steps.github_public_ip.outputs.ipv4 }} --query provisioningState + run: az acr network-rule add --name ${{ matrix.registry }} --ip-address ${{ steps.github_public_ip.outputs.ipv4 }} --query provisioningState - name: Create ACR Token - run: echo "token=$(az acr login --name=radixdevapp --expose-token | jq -r '.accessToken')" >> $GITHUB_OUTPUT + run: echo "token=$(az acr login --name=${{ matrix.registry }} --expose-token | jq -r '.accessToken')" >> $GITHUB_OUTPUT id: token - name: Purge old cache - run: ./bin/acr purge --registry=radixdevapp.azurecr.io --password=${{steps.token.outputs.token}} --username= --filter='*/cache:.*' --ago=12h --untagged --dry-run + run: ./bin/acr purge --registry=${{ matrix.registry }}.azurecr.io --password=${{steps.token.outputs.token}} --username= --filter='*/cache:.*' --ago=12h --untagged --dry-run - name: Revoke GitHub IP on StorageAccount - run: az acr network-rule remove --name radixdevapp --ip-address ${{ steps.github_public_ip.outputs.ipv4 }} --query provisioningState + run: az acr network-rule remove --name ${{ matrix.registry }} --ip-address ${{ steps.github_public_ip.outputs.ipv4 }} --query provisioningState + + + purge-dev: + runs-on: ubuntu-latest + environment: s941 + strategy: + matrix: + registry: [radixdevapp, radixplaygroundapp] + + steps: + - uses: actions/checkout@v4 + with: + repository: Azure/acr-cli + ref: v0.8 + + - uses: actions/setup-go@v4 + + - name: Compile ACR binary + run: make binaries + + - name: Get GitHub Public IP + id: github_public_ip + uses: haythem/public-ip@v1.3 + + - name: 'Az CLI login' + uses: azure/login@v1 + with: + client-id: ${{ secrets.AZURE_CLIENT_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + + - name: Add GitHub IP to StorageAccount + run: az acr network-rule add --name ${{ matrix.registry }} --ip-address ${{ steps.github_public_ip.outputs.ipv4 }} --query provisioningState + + - name: Create ACR Token + run: echo "token=$(az acr login --name=${{ matrix.registry }} --expose-token | jq -r '.accessToken')" >> $GITHUB_OUTPUT + id: token + + - name: Purge old cache + run: ./bin/acr purge --registry=${{ matrix.registry }}.azurecr.io --password=${{steps.token.outputs.token}} --username= --filter='*/cache:.*' --ago=12h --untagged --dry-run + + - name: Revoke GitHub IP on StorageAccount + run: az acr network-rule remove --name ${{ matrix.registry }} --ip-address ${{ steps.github_public_ip.outputs.ipv4 }} --query provisioningState