3838 type : boolean
3939 required : false
4040 default : true
41- push-dirty :
41+ sbom :
42+ description : Generate SBOM?
43+ type : boolean
44+ required : false
45+ default : true
46+ push-critical :
4247 description : Push scanned images that have critical vulnerabilities?
4348 type : boolean
4449 required : false
@@ -252,14 +257,14 @@ jobs:
252257 run : if [ $(wc -l < ${{ matrix.distro.name }}-${{ matrix.distro.release }}-container-images) -le 1 ]; then exit 1; fi
253258
254259 - name : Scan built container images
255- run : src/kayobe-config/tools/scan-images.sh ${{ matrix.distro.name }}-${{ matrix.distro.release }} ${{ steps.write-kolla-tag.outputs.kolla-tag }}
260+ run : src/kayobe-config/tools/scan-images.sh ${{ matrix.distro.name }}-${{ matrix.distro.release }} ${{ steps.write-kolla-tag.outputs.kolla-tag }} ${{ inputs.sbom && '--sbom'}}
256261
257262 - name : Move image scan logs to output artifact
258263 run : mv image-scan-output image-build-logs/image-scan-output
259264
260- - name : Fail if no images have passed scanning
265+ - name : Fail if any images have critical vulnerabilities
261266 run : if [ $(wc -l < image-build-logs/image-scan-output/critical-images.txt) -gt 0 ]; then exit 1; fi
262- if : ${{ !inputs.push-dirty }}
267+ if : ${{ !inputs.push-critical }}
263268
264269 - name : Copy clean images to push-attempt-images list
265270 run : cp image-build-logs/image-scan-output/clean-images.txt image-build-logs/push-attempt-images.txt
@@ -269,13 +274,13 @@ jobs:
269274 # This should be reverted when it's decided to filter high level CVEs as well.
270275 - name : Append dirty images to push list
271276 run : |
272- cat image-build-logs/image-scan-output/dirty -images.txt >> image-build-logs/push-attempt-images.txt
277+ cat image-build-logs/image-scan-output/high -images.txt >> image-build-logs/push-attempt-images.txt
273278 if : ${{ inputs.push }}
274279
275280 - name : Append images with critical vulnerabilities to push list
276281 run : |
277282 cat image-build-logs/image-scan-output/critical-images.txt >> image-build-logs/push-attempt-images.txt
278- if : ${{ inputs.push && inputs.push-dirty }}
283+ if : ${{ inputs.push && inputs.push-critical }}
279284
280285 - name : Push images
281286 run : |
@@ -324,12 +329,12 @@ jobs:
324329 # This can be used again instead of "Fail when critical vulnerabilities are found" when it's
325330 # decided to fail the job on detecting high CVEs as well.
326331 # - name: Fail when images failed scanning
327- # 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
328- # if: ${{ !inputs.push-dirty && !cancelled() }}
332+ # 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
333+ # if: ${{ !inputs.push-critical && !cancelled() }}
329334
330335 - name : Fail when critical vulnerabilities are found
331336 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
332- if : ${{ !inputs.push-dirty && !cancelled() }}
337+ if : ${{ !inputs.push-critical && !cancelled() }}
333338
334339 # NOTE(mgoddard): Trigger another CI workflow in the
335340 # stackhpc-release-train repository.
0 commit comments