38
38
type : boolean
39
39
required : false
40
40
default : true
41
- scan- push :
41
+ push-dirty :
42
42
description : Push scanned images that have vulnerabilities?
43
43
type : boolean
44
44
required : false
45
+ # NOTE(Alex-Welsh): This default should be flipped once we resolve existing failures
45
46
default : true
46
47
47
48
env :
@@ -175,7 +176,7 @@ jobs:
175
176
id : build_overcloud_images
176
177
continue-on-error : true
177
178
run : |
178
- args="${{ github.event. inputs.regexes }}"
179
+ args="${{ inputs.regexes }}"
179
180
args="$args -e kolla_base_distro=${{ matrix.distro }}"
180
181
args="$args -e kolla_tag=${{ needs.generate-tag.outputs.kolla_tag }}"
181
182
args="$args -e stackhpc_repo_mirror_auth_proxy_enabled=true"
@@ -184,7 +185,7 @@ jobs:
184
185
kayobe overcloud container image build $args
185
186
env :
186
187
KAYOBE_VAULT_PASSWORD : ${{ secrets.KAYOBE_VAULT_PASSWORD }}
187
- if : github.event. inputs.overcloud == 'true'
188
+ if : inputs.overcloud
188
189
189
190
- name : Build kolla seed images
190
191
id : build_seed_images
@@ -198,7 +199,7 @@ jobs:
198
199
kayobe seed container image build $args
199
200
env :
200
201
KAYOBE_VAULT_PASSWORD : ${{ secrets.KAYOBE_VAULT_PASSWORD }}
201
- if : github.event. inputs.seed == 'true'
202
+ if : inputs.seed
202
203
203
204
- name : Get built container images
204
205
run : |
@@ -208,57 +209,74 @@ jobs:
208
209
run : if [ $(wc -l < ${{ matrix.distro }}-container-images) -le 1 ]; then exit 1; fi
209
210
210
211
- name : Scan built container images
211
- run : src/kayobe-config/tools/scan-images.sh ${{ matrix.distro }} ${{ needs.generate-tag.outputs.kolla_tag }}
212
-
213
- - name : Upload Trivy scan results artifact
214
- uses : actions/upload-artifact@v4
215
- with :
216
- name : ${{ matrix.distro }}-image-scan-output
217
- path : image-scan-output
218
- retention-days : 7
212
+ run : |
213
+ src/kayobe-config/tools/scan-images.sh ${{ matrix.distro }} ${{ needs.generate-tag.outputs.kolla_tag }}
219
214
220
215
- name : Fail if no images have passed scanning
221
216
run : if [ $(wc -l < image-scan-output/clean-images.txt) -le 0 ]; then exit 1; fi
222
- if : github.event.inputs.scan-push == 'false'
217
+ if : ${{ !inputs.push-dirty }}
218
+
219
+ - name : Copy clean images to push-attempt-images list
220
+ run : cp image-scan-output/clean-images.txt image-scan-output/push-attempt-images.txt
223
221
224
- - name : Append dirty images to clean list
222
+ - name : Append dirty images to push list
225
223
run : |
226
- cat image-scan-output/dirty-images.txt >> image-scan-output/clean -images.txt
227
- if : github.event. inputs.scan- push == 'true'
224
+ cat image-scan-output/dirty-images.txt >> image-scan-output/push-attempt -images.txt
225
+ if : inputs.push-dirty
228
226
229
227
- name : Push images
230
228
run : |
229
+ touch image-scan-output/push-failed-images.txt
231
230
source venvs/kayobe/bin/activate &&
232
231
source src/kayobe-config/kayobe-env --environment ci-builder &&
233
232
kayobe playbook run ${KAYOBE_CONFIG_PATH}/ansible/docker-registry-login.yml &&
234
233
235
234
while read -r image; do
236
235
# Retries!
237
- for i in {1..10}; do
238
- docker push ${image} && break || sleep 5
236
+ for i in {1..5}; do
237
+ if docker push $image; then
238
+ echo "Pushed $image"
239
+ break
240
+ elif $i == 5; then
241
+ echo "Failed to push $image"
242
+ echo $image >> image-scan-output/push-failed-images.txt
243
+ else
244
+ echo "Failed on retry $i"
245
+ sleep 5
246
+ fi;
239
247
done
240
- done < image-scan-output/clean-images.txt
248
+ done < image-scan-output/push-attempt-images.txt &&
249
+ mv image-scan-output image-build-logs
241
250
shell : bash
242
251
env :
243
252
KAYOBE_VAULT_PASSWORD : ${{ secrets.KAYOBE_VAULT_PASSWORD }}
244
- if : github.event. inputs.push == 'true'
253
+ if : inputs.push
245
254
246
- - name : Upload pushed container images artifact
255
+ - name : Upload output artifact
247
256
uses : actions/upload-artifact@v4
248
257
with :
249
- name : ${{ matrix.distro }}-pushed-container-images
250
- path : image-scan-output/clean-images.txt
258
+ name : ${{ matrix.distro }}-logs
259
+ path : image-build-logs
251
260
retention-days : 7
261
+ if : !cancelled()
252
262
253
263
- name : Fail when images failed to build
254
264
run : exit 1
255
265
if : steps.build_overcloud_images.outcome == 'failure' || steps.build_seed_images.outcome == 'failure'
256
266
267
+ - name : Fail when images failed to push
268
+ run : if [ $(wc -l < image-build-logs/push-failed-images.txt) -gt 0 ]; then cat image-build-logs/push-failed-images.txt && exit 1; fi
269
+ if : !cancelled()
270
+
271
+ - name : Fail when images failed scanning
272
+ run : if [ $(wc -l < image-build-logs/dirty-images.txt) -gt 0 ]; then cat image-build-logs/dirty-images.txt && exit 1; fi
273
+ if : ${{ !inputs.push-dirty && !cancelled() }}
274
+
257
275
sync-container-repositories :
258
276
name : Trigger container image repository sync
259
277
needs :
260
278
- container-image-build
261
- if : github.repository == 'stackhpc/stackhpc-kayobe-config' && inputs.push == 'true'
279
+ if : github.repository == 'stackhpc/stackhpc-kayobe-config' && inputs.push
262
280
runs-on : ubuntu-latest
263
281
permissions : {}
264
282
steps :
@@ -267,7 +285,7 @@ jobs:
267
285
- name : Trigger container image repository sync
268
286
run : |
269
287
filter='${{ inputs.regexes }}'
270
- if [[ -n $filter ]] && [[ ${{ github.event. inputs.seed }} == 'true' ]]; then
288
+ if [[ -n $filter ]] && [[ ${{ inputs.seed }} == 'true' ]]; then
271
289
filter="$filter bifrost"
272
290
fi
273
291
gh workflow run \
0 commit comments