-
Notifications
You must be signed in to change notification settings - Fork 3
95 lines (72 loc) · 3.04 KB
/
clean-cache-registry.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Daily
permissions:
id-token: write
contents: read
jobs:
purge-prod:
runs-on: ubuntu-latest
environment: s940
strategy:
matrix:
registry: [radixc2app, radixprodapp]
steps:
- uses: actions/checkout@v4
with:
repository: Azure/acr-cli
ref: v0.8
- uses: actions/setup-go@v5
- name: Compile ACR binary
run: make binaries
- name: Get GitHub Public IP
id: github_public_ip
run: echo "ipv4=$(curl 'https://ifconfig.me/ip')" >> $GITHUB_OUTPUT
- name: 'Az CLI login'
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Add GitHub IP to ACR
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=7d --untagged
- name: Revoke GitHub IP on ACR
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@v5
- name: Compile ACR binary
run: make binaries
- name: Get GitHub Public IP
id: github_public_ip
run: echo "ipv4=$(curl 'https://ifconfig.me/ip')" >> $GITHUB_OUTPUT
- name: 'Az CLI login'
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Add GitHub IP to ACR
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=7d --untagged
- name: Revoke GitHub IP on ACR
run: az acr network-rule remove --name ${{ matrix.registry }} --ip-address ${{ steps.github_public_ip.outputs.ipv4 }} --query provisioningState