-
Notifications
You must be signed in to change notification settings - Fork 44
262 lines (254 loc) · 10.9 KB
/
build-push-images.yaml
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
---
name: Build and push images to quay
on:
push:
branches:
- main
workflow_dispatch:
permissions: read-all
jobs:
build-push:
runs-on: ubuntu-latest
outputs:
sha_short: ${{ steps.vars.outputs.sha_short }}
steps:
- uses: actions/checkout@v4
- name: Get the short sha
id: vars
run: echo "sha_short=$(echo ${{ github.sha }} | cut -b -7)" > $GITHUB_OUTPUT
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
ci-runner:
- '.github/workflows/build-push-images.yaml'
- 'ci/images/ci-runner/**'
- 'shared/**'
dependencies-update:
- '.github/workflows/build-push-images.yaml'
- 'developer/images/dependencies/**'
- 'shared/**'
e2e-test-runner:
- '.github/workflows/build-push-images.yaml'
- 'ci/images/e2e-test-runner/**'
- 'shared/**'
quay-upload:
- '.github/workflows/build-push-images.yaml'
- 'ci/images/quay-upload/**'
static-checks:
- '.github/workflows/build-push-images.yaml'
- 'ci/images/static-checks/**'
- 'shared/**'
vulnerability:
- '.github/workflows/build-push-images.yaml'
- 'ci/images/vulnerability-scan/**'
# Build and push ci-runner image, tagged with latest and the commit SHA.
- name: Build ci-runner Image
id: build-image-ci-runner
if: steps.filter.outputs.ci-runner == 'true'
uses: redhat-actions/buildah-build@v2
with:
image: ci-runner
context: .
tags: latest ${{ steps.vars.outputs.sha_short }} ${{ github.ref_name }}
containerfiles: |
./ci/images/ci-runner/Dockerfile
- name: Push to quay.io
id: push-to-quay-ci-runner
if: steps.filter.outputs.ci-runner == 'true'
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image-ci-runner.outputs.image }}
tags: ${{ steps.build-image-ci-runner.outputs.tags }} ${{ github.ref_name }}
registry: quay.io/redhat-pipeline-service
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Print image url
if: steps.filter.outputs.ci-runner == 'true'
run: |
echo "Image pushed to ${{ steps.push-to-quay-ci-runner.outputs.registry-paths }}"
- name: Tag latest commit ID to quay.io
id: tag-commit-quay-ci-runner
if: steps.filter.outputs.ci-runner != 'true'
env:
image: ci-runner
registry: quay.io/redhat-pipeline-service
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
run: |
./ci/images/quay-upload/image-upload.sh --debug
# Build and push quay-upload image, tagged with latest and the commit SHA.
- name: Build quay-upload Image
id: build-image-quay-upload
if: steps.filter.outputs.quay-upload == 'true'
uses: redhat-actions/buildah-build@v2
with:
image: quay-upload
context: ./ci/images/quay-upload
tags: latest ${{ steps.vars.outputs.sha_short }} ${{ github.ref_name }}
containerfiles: |
./ci/images/quay-upload/Dockerfile
- name: Push to quay.io
id: push-to-quay-quay-upload
if: steps.filter.outputs.quay-upload == 'true'
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image-quay-upload.outputs.image }}
tags: ${{ steps.build-image-quay-upload.outputs.tags }} ${{ github.ref_name }}
registry: quay.io/redhat-pipeline-service
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Print image url
if: steps.filter.outputs.quay-upload == 'true'
run: |
echo "Image pushed to ${{ steps.push-to-quay-quay-upload.outputs.registry-paths }}"
- name: Tag latest commit ID to quay.io
id: tag-commit-quay-quay-upload
if: steps.filter.outputs.quay-upload != 'true'
env:
image: quay-upload
registry: quay.io/redhat-pipeline-service
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
run: |
./ci/images/quay-upload/image-upload.sh --debug
# Build and push dependencies-update image, tagged with the branch name and the commit SHA.
- name: Build dependencies-update Image
id: build-image-dependencies-update
if: steps.filter.outputs.dependencies-update == 'true'
uses: redhat-actions/buildah-build@v2
with:
image: dependencies-update
context: .
tags: latest ${{ steps.vars.outputs.sha_short }} ${{ github.ref_name }}
containerfiles: |
./developer/images/dependencies-update/Dockerfile
- name: Push to quay.io
id: push-to-quay-dependencies-update
if: steps.filter.outputs.dependencies-update == 'true'
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image-dependencies-update.outputs.image }}
tags: ${{ steps.build-image-dependencies-update.outputs.tags }} ${{ github.ref_name }}
registry: quay.io/redhat-pipeline-service
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Print image url
if: steps.filter.outputs.dependencies-update == 'true'
run: |
echo "Image pushed to ${{ steps.push-to-quay-dependencies-update.outputs.registry-paths }}"
- name: Tag latest commit ID to quay.io
id: tag-commit-quay-dependencies-update
if: steps.filter.outputs.dependencies-update != 'true'
env:
image: dependencies-update
registry: quay.io/redhat-pipeline-service
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
run: |
./ci/images/quay-upload/image-upload.sh --debug
# Build and push e2e-test-runner image, tagged with latest and the commit SHA.
- name: Build e2e-test-runner Image
id: build-image-e2e-test-runner
if: steps.filter.outputs.e2e-test-runner == 'true'
uses: redhat-actions/buildah-build@v2
with:
image: e2e-test-runner
context: .
tags: latest ${{ steps.vars.outputs.sha_short }} ${{ github.ref_name }}
containerfiles: |
./ci/images/e2e-test-runner/Dockerfile
- name: Push to quay.io
id: push-to-quay-e2e-test-runner
if: steps.filter.outputs.e2e-test-runner == 'true'
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image-e2e-test-runner.outputs.image }}
tags: ${{ steps.build-image-e2e-test-runner.outputs.tags }} ${{ github.ref_name }}
registry: quay.io/redhat-pipeline-service
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Print image url
if: steps.filter.outputs.e2e-test-runner == 'true'
run: |
echo "Image pushed to ${{ steps.push-to-quay-e2e-test-runner.outputs.registry-paths }}"
- name: Tag latest commit ID to quay.io
id: tag-commit-quay-e2e-test-runner
if: steps.filter.outputs.e2e-test-runner != 'true'
env:
image: e2e-test-runner
registry: quay.io/redhat-pipeline-service
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
run: |
./ci/images/quay-upload/image-upload.sh --debug
# Build and push static-checks image, tagged with latest and the commit SHA.
- name: Build static-checks Image
id: build-image-static-checks
if: steps.filter.outputs.static-checks == 'true'
uses: redhat-actions/buildah-build@v2
with:
image: static-checks
context: .
tags: latest ${{ steps.vars.outputs.sha_short }} ${{ github.ref_name }}
containerfiles: |
./ci/images/static-checks/Dockerfile
- name: Push to quay.io
id: push-to-quay-static-checks
if: steps.filter.outputs.static-checks == 'true'
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image-static-checks.outputs.image }}
tags: ${{ steps.build-image-static-checks.outputs.tags }} ${{ github.ref_name }}
registry: quay.io/redhat-pipeline-service
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Print image url
if: steps.filter.outputs.static-checks == 'true'
run: |
echo "Image pushed to ${{ steps.push-to-quay-static-checks.outputs.registry-paths }}"
- name: Tag latest commit ID to quay.io
id: tag-commit-quay-static-checks
if: steps.filter.outputs.static-checks != 'true'
env:
image: static-checks
registry: quay.io/redhat-pipeline-service
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
run: |
./ci/images/quay-upload/image-upload.sh --debug
# Build and push vulnerability-scan image, tagged with latest and the commit SHA.
- name: Build vulnerability Image
id: build-image-vulnerability-scan
if: steps.filter.outputs.vulnerability == 'true'
uses: redhat-actions/buildah-build@v2
with:
image: vulnerability-scan
context: ./ci/images/vulnerability-scan
tags: latest ${{ steps.vars.outputs.sha_short }} ${{ github.ref_name }}
containerfiles: |
./ci/images/vulnerability-scan/Dockerfile
- name: Push to quay.io
id: push-to-quay-vulnerability-scan
if: steps.filter.outputs.vulnerability == 'true'
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image-vulnerability-scan.outputs.image }}
tags: ${{ steps.build-image-vulnerability-scan.outputs.tags }} ${{ github.ref_name }}
registry: quay.io/redhat-pipeline-service
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Print image url
if: steps.filter.outputs.vulnerability == 'true'
run: |
echo "Image pushed to ${{ steps.push-to-quay-vulnerability-scan.outputs.registry-paths }}"
- name: Tag latest commit ID to quay.io
id: tag-commit-quay-vulnerability-scan
if: steps.filter.outputs.vulnerability != 'true'
env:
image: vulnerability-scan
registry: quay.io/redhat-pipeline-service
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
run: |
./ci/images/quay-upload/image-upload.sh --debug