33
33
type : boolean
34
34
required : false
35
35
default : true
36
- push-dirty :
36
+ sbom :
37
+ description : Generate SBOM?
38
+ type : boolean
39
+ required : false
40
+ default : true
41
+ push-critical :
37
42
description : Push scanned images that have critical vulnerabilities?
38
43
type : boolean
39
44
required : false
@@ -254,14 +259,14 @@ jobs:
254
259
run : if [ $(wc -l < ${{ matrix.distro.name }}-${{ matrix.distro.release }}-container-images) -le 1 ]; then exit 1; fi
255
260
256
261
- name : Scan built container images
257
- run : src/kayobe-config/tools/scan-images.sh ${{ matrix.distro.name }}-${{ matrix.distro.release }} ${{ steps.write-kolla-tag.outputs.kolla-tag }}
262
+ run : src/kayobe-config/tools/scan-images.sh ${{ matrix.distro.name }}-${{ matrix.distro.release }} ${{ steps.write-kolla-tag.outputs.kolla-tag }} ${{ inputs.sbom && '--sbom' }}
258
263
259
264
- name : Move image scan logs to output artifact
260
265
run : mv image-scan-output image-build-logs/image-scan-output
261
266
262
- - name : Fail if no images have passed scanning
267
+ - name : Fail if any images have critical vulnerabilities
263
268
run : if [ $(wc -l < image-build-logs/image-scan-output/critical-images.txt) -gt 0 ]; then exit 1; fi
264
- if : ${{ !inputs.push-dirty }}
269
+ if : ${{ !inputs.push-critical }}
265
270
266
271
- name : Copy clean images to push-attempt-images list
267
272
run : cp image-build-logs/image-scan-output/clean-images.txt image-build-logs/push-attempt-images.txt
@@ -271,13 +276,13 @@ jobs:
271
276
# This should be reverted when it's decided to filter high level CVEs as well.
272
277
- name : Append dirty images to push list
273
278
run : |
274
- cat image-build-logs/image-scan-output/dirty -images.txt >> image-build-logs/push-attempt-images.txt
279
+ cat image-build-logs/image-scan-output/high -images.txt >> image-build-logs/push-attempt-images.txt
275
280
if : ${{ inputs.push }}
276
281
277
282
- name : Append images with critical vulnerabilities to push list
278
283
run : |
279
284
cat image-build-logs/image-scan-output/critical-images.txt >> image-build-logs/push-attempt-images.txt
280
- if : ${{ inputs.push && inputs.push-dirty }}
285
+ if : ${{ inputs.push && inputs.push-critical }}
281
286
282
287
- name : Push images
283
288
run : |
@@ -326,12 +331,12 @@ jobs:
326
331
# This can be used again instead of "Fail when critical vulnerabilities are found" when it's
327
332
# decided to fail the job on detecting high CVEs as well.
328
333
# - name: Fail when images failed scanning
329
- # run: if [ $(wc -l < image-build-logs/image-scan-output/dirty -images.txt) -gt 0 ]; then cat image-build-logs/image-scan-output/dirty -images.txt && exit 1; fi
330
- # if: ${{ !inputs.push-dirty && !cancelled() }}
334
+ # run: if [ $(wc -l < image-build-logs/image-scan-output/high -images.txt) -gt 0 ]; then cat image-build-logs/image-scan-output/high -images.txt && exit 1; fi
335
+ # if: ${{ !inputs.push-critical && !cancelled() }}
331
336
332
337
- name : Fail when critical vulnerabilities are found
333
338
run : if [ $(wc -l < image-build-logs/image-scan-output/critical-images.txt) -gt 0 ]; then cat image-build-logs/image-scan-output/critical-images.txt && exit 1; fi
334
- if : ${{ !inputs.push-dirty && !cancelled() }}
339
+ if : ${{ !inputs.push-critical && !cancelled() }}
335
340
336
341
- name : Remove locally built images for this run
337
342
if : always() && runner.arch == 'ARM64'
0 commit comments