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,66 @@ 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
- run : if [ $(wc -l < image-scan-output/clean-images.txt) -le 0 ]; then exit 1; fi
222
- if : github.event. inputs.scan- push == 'false '
216
+ run : if [ $(wc -l < image-scan-output/clean-images.txt) -le 0 ]; then exit 1; else cp image-scan-output/clean-images.txt image-scan-output/pushed-images.txt; fi
217
+ if : inputs.push-dirty == 'False '
223
218
224
- - name : Append dirty images to clean list
219
+ - name : Append dirty images to push list
225
220
run : |
226
- cat image-scan-output/dirty-images.txt >> image-scan-output/clean-images.txt
227
- if : github.event.inputs.scan-push == 'true'
221
+ cp image-scan-output/clean-images.txt image-scan-output/pushed-images.txt
222
+ cat image-scan-output/dirty-images.txt >> image-scan-output/pushed-images.txt
223
+ if : inputs.push-dirty
228
224
229
225
- name : Push images
230
226
run : |
227
+ touch image-scan-output/push-failed-images.txt
231
228
source venvs/kayobe/bin/activate &&
232
229
source src/kayobe-config/kayobe-env --environment ci-builder &&
233
230
kayobe playbook run ${KAYOBE_CONFIG_PATH}/ansible/docker-registry-login.yml &&
234
231
235
232
while read -r image; do
236
233
# Retries!
237
- for i in {1..10}; do
238
- docker push ${image} && break || sleep 5
234
+ for i in {1..5}; do
235
+ if docker push $image; then
236
+ echo "Pushed $image"
237
+ break
238
+ elif $i == 5; then
239
+ echo "Failed to push $image"
240
+ echo $image >> image-scan-output/push-failed-images.txt
241
+ else
242
+ echo "Failed on retry $i"
243
+ sleep 5
244
+ fi;
239
245
done
240
- done < image-scan-output/clean-images.txt
246
+ done < image-scan-output/pushed-images.txt &&
247
+ mv image-scan-output image-build-logs
241
248
shell : bash
242
249
env :
243
250
KAYOBE_VAULT_PASSWORD : ${{ secrets.KAYOBE_VAULT_PASSWORD }}
244
- if : github.event. inputs.push == 'true'
251
+ if : inputs.push
245
252
246
- - name : Upload pushed container images artifact
253
+ - name : Upload output artifact
247
254
uses : actions/upload-artifact@v4
248
255
with :
249
- name : ${{ matrix.distro }}-pushed-container-images
250
- path : image-scan-output/clean-images.txt
256
+ name : ${{ matrix.distro }}-logs
257
+ path : image-build-logs
251
258
retention-days : 7
252
259
253
260
- name : Fail when images failed to build
254
261
run : exit 1
255
262
if : steps.build_overcloud_images.outcome == 'failure' || steps.build_seed_images.outcome == 'failure'
256
263
264
+ - name : Fail when images failed to push
265
+ run : if [ $(wc -l < image-build-logs/push-failed-images.txt) -gt 0 ]; then exit 1; fi
266
+
257
267
sync-container-repositories :
258
268
name : Trigger container image repository sync
259
269
needs :
260
270
- container-image-build
261
- if : github.repository == 'stackhpc/stackhpc-kayobe-config' && inputs.push == 'true'
271
+ if : github.repository == 'stackhpc/stackhpc-kayobe-config' && inputs.push
262
272
runs-on : ubuntu-latest
263
273
permissions : {}
264
274
steps :
@@ -267,7 +277,7 @@ jobs:
267
277
- name : Trigger container image repository sync
268
278
run : |
269
279
filter='${{ inputs.regexes }}'
270
- if [[ -n $filter ]] && [[ ${{ github.event. inputs.seed }} == 'true' ]]; then
280
+ if [[ -n $filter ]] && [[ ${{ inputs.seed }} == 'true' ]]; then
271
281
filter="$filter bifrost"
272
282
fi
273
283
gh workflow run \
0 commit comments