-
Notifications
You must be signed in to change notification settings - Fork 62
131 lines (123 loc) · 8.22 KB
/
pr-merge-image-delete.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
---
name: Delete quay image of PR once merged
on: # yamllint disable-line rule:truthy
push:
branches:
- 'main'
permissions:
pull-requests: read
env:
QUAY_IMAGE_REPO: ${{ secrets.QUAY_IMAGE_REPO }}
jobs:
delete-pr-quay-image:
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Install skopeo
shell: bash
run: |
sudo apt-get -y update
sudo apt-get -y install skopeo
- name: Get Pull Request Number
uses: actions/github-script@v7
id: get_pr_number
with:
script: |
if (context.issue.number) {
// Return issue number if present
return context.issue.number;
} else {
// Otherwise return issue number from commit
return (
await github.rest.repos.listPullRequestsAssociatedWithCommit({
commit_sha: context.sha,
owner: context.repo.owner,
repo: context.repo.repo,
})
).data[0].number;
}
result-encoding: string
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Login to quay.io
shell: bash
env:
QUAY_ROBOT_USERNAME: ${{ secrets.QUAY_ROBOT_USERNAME }}
QUAY_ROBOT_TOKEN: ${{ secrets.QUAY_ROBOT_TOKEN }}
run: |
skopeo login quay.io -u ${QUAY_ROBOT_USERNAME} -p ${QUAY_ROBOT_TOKEN}
- name: Delete PR image
shell: bash
continue-on-error: true
env:
PR: ${{steps.get_pr_number.outputs.result}}
run: |
set +e # Don't abort if a delete operation fails as all images might not be available for the PR
skopeo delete docker://${QUAY_IMAGE_REPO}:base-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:base-c9s-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:cuda-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:cuda-c9s-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:jupyter-minimal-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:jupyter-datascience-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:jupyter-pytorch-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:jupyter-trustyai-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:cuda-jupyter-minimal-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:cuda-jupyter-datascience-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:cuda-jupyter-tensorflow-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:runtime-minimal-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:runtime-datascience-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:runtime-pytorch-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:runtime-cuda-tensorflow-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:codeserver-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:rstudio-c9s-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:cuda-rstudio-c9s-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:intel-base-gpu-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:intel-runtime-tensorflow-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:intel-runtime-pytorch-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:intel-runtime-ml-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:jupyter-intel-tensorflow-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:jupyter-intel-pytorch-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:jupyter-intel-ml-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:rocm-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:rocm-jupyter-minimal-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:rocm-jupyter-datascience-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:rocm-jupyter-tensorflow-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:rocm-jupyter-pytorch-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:runtime-rocm-pytorch-ubi9-python-3.9-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:runtime-rocm-tensorflow-ubi9-python-3.9-pr-${{ env.PR }}
# Python 3.11
skopeo delete docker://${QUAY_IMAGE_REPO}:base-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:base-c9s-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:cuda-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:cuda-c9s-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:jupyter-minimal-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:jupyter-datascience-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:jupyter-pytorch-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:jupyter-trustyai-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:cuda-jupyter-minimal-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:cuda-jupyter-datascience-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:cuda-jupyter-tensorflow-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:runtime-minimal-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:runtime-datascience-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:runtime-pytorch-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:runtime-cuda-tensorflow-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:codeserver-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:rstudio-c9s-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:cuda-rstudio-c9s-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:intel-base-gpu-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:intel-runtime-tensorflow-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:intel-runtime-pytorch-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:intel-runtime-ml-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:jupyter-intel-tensorflow-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:jupyter-intel-pytorch-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:jupyter-intel-ml-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:rocm-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:rocm-jupyter-minimal-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:rocm-jupyter-datascience-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:rocm-jupyter-tensorflow-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:rocm-jupyter-pytorch-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:runtime-rocm-pytorch-ubi9-python-3.11-pr-${{ env.PR }}
skopeo delete docker://${QUAY_IMAGE_REPO}:runtime-rocm-tensorflow-ubi9-python-3.11-pr-${{ env.PR }}