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
@@ -82,14 +87,14 @@ jobs:
8287 id : openstack_release
8388 run : |
8489 BRANCH=$(awk -F'=' '/defaultbranch/ {print $2}' .gitreview)
85- echo "openstack_release=${BRANCH}" | sed -E "s,(stable|unmaintained)/,," >> $GITHUB_OUTPUT
90+ echo "openstack_release=${BRANCH}" | sed -E "s,(stable|unmaintained)/,," | tee -a " $GITHUB_OUTPUT"
8691
8792 # Generate a tag to apply to all built container images.
8893 # Without this, each kayobe * container image build command would use a different tag.
8994 - name : Generate container datetime tag
9095 id : datetime_tag
9196 run : |
92- echo "datetime_tag=$(date +%Y%m%dT%H%M%S)" >> $GITHUB_OUTPUT
97+ echo "datetime_tag=$(date +%Y%m%dT%H%M%S)" | tee -a " $GITHUB_OUTPUT"
9398
9499 # Dynamically define job matrix.
95100 # We need a separate matrix entry for each distribution, when the relevant input is true.
@@ -113,7 +118,7 @@ jobs:
113118 # remove trailing comma
114119 output="${output%,}"
115120 output+="]}"
116- echo "matrix=$output" >> $GITHUB_OUTPUT
121+ echo "matrix=$output" | tee -a " $GITHUB_OUTPUT"
117122
118123 - name : Display container datetime tag
119124 run : |
@@ -187,7 +192,7 @@ jobs:
187192
188193 - name : Get Kolla tag
189194 id : write-kolla-tag
190- run : echo "kolla-tag=${{ needs.generate-tag.outputs.openstack_release }}-${{ matrix.distro.name }}-${{ matrix.distro.release }}-${{ needs.generate-tag.outputs.datetime_tag }}" >> $GITHUB_OUTPUT
195+ run : echo "kolla-tag=${{ needs.generate-tag.outputs.openstack_release }}-${{ matrix.distro.name }}-${{ matrix.distro.release }}-${{ needs.generate-tag.outputs.datetime_tag }}" | tee -a " $GITHUB_OUTPUT"
191196
192197 - name : Configure localhost as a seed
193198 run : |
@@ -198,17 +203,6 @@ jobs:
198203 localhost ansible_connection=local ansible_python_interpreter=/usr/bin/python3
199204 EOF
200205
201- # See etc/kayobe/ansible/roles/pulp_auth_proxy/README.md for details.
202- # NOTE: We override pulp_auth_proxy_conf_path to a path shared by the
203- # runner and dind containers.
204- - name : Deploy an authenticating package repository mirror proxy
205- run : |
206- source venvs/kayobe/bin/activate &&
207- source src/kayobe-config/kayobe-env --environment ci-builder &&
208- kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/pulp-auth-proxy.yml -e pulp_auth_proxy_conf_path=/home/runner/_work/pulp_proxy
209- env :
210- KAYOBE_VAULT_PASSWORD : ${{ secrets.KAYOBE_VAULT_PASSWORD_CI_BUILDER }}
211-
212206 - name : Create build logs output directory
213207 run : mkdir image-build-logs
214208
@@ -230,6 +224,9 @@ jobs:
230224 args="$args -e stackhpc_repo_mirror_auth_proxy_enabled=true"
231225 args="$args -e kolla_build_log_path=$GITHUB_WORKSPACE/image-build-logs/kolla-build-overcloud.log"
232226 args="$args -e base_path=$GITHUB_WORKSPACE/opt/kayobe"
227+ # NOTE: We override pulp_auth_proxy_conf_path to a path shared by the
228+ # runner and dind containers.
229+ args="$args -e pulp_auth_proxy_conf_path=/home/runner/_work/pulp_proxy"
233230 source venvs/kayobe/bin/activate &&
234231 source src/kayobe-config/kayobe-env --environment ci-builder &&
235232 kayobe overcloud container image build $args
@@ -261,20 +258,21 @@ jobs:
261258 if : inputs.seed && matrix.distro.arch == 'amd64'
262259
263260 - name : Get built container images
264- run : docker image ls --filter "reference=ark.stackhpc.com/stackhpc-dev/*:${{ steps.write-kolla-tag.outputs.kolla-tag }}*" > ${{ matrix.distro.name }}-${{ matrix.distro.release }}-container-images
261+ run : docker image ls --filter "reference=ark.stackhpc.com/stackhpc-dev/*:${{ steps.write-kolla-tag.outputs.kolla-tag }}*" | tee " ${{ matrix.distro.name }}-${{ matrix.distro.release }}-container-images"
265262
266263 - name : Fail if no images have been built
267264 run : if [ $(wc -l < ${{ matrix.distro.name }}-${{ matrix.distro.release }}-container-images) -le 1 ]; then exit 1; fi
268265
269266 - name : Scan built container images
270- run : src/kayobe-config/tools/scan-images.sh ${{ matrix.distro.name }}-${{ matrix.distro.release }} ${{ steps.write-kolla-tag.outputs.kolla-tag }}
267+ run : src/kayobe-config/tools/scan-images.sh ${{ matrix.distro.name }}-${{ matrix.distro.release }} ${{ steps.write-kolla-tag.outputs.kolla-tag }} ${{ inputs.sbom && '--sbom' }}
271268
272269 - name : Move image scan logs to output artifact
273270 run : mv image-scan-output image-build-logs/image-scan-output
271+ if : ${{ !cancelled() }}
274272
275- - name : Fail if no images have passed scanning
276- run : if [ $(wc -l < image-build-logs/image-scan-output/critical-images.txt) -gt 0 ]; then exit 1; fi
277- if : ${{ !inputs.push-dirty }}
273+ - name : Fail if any images have critical vulnerabilities
274+ run : if [ -e image-build-logs/image-scan-output/critical-images.txt ] && [ $(wc -l < image-build-logs/image-scan-output/critical-images.txt) -gt 0 ]; then exit 1; fi
275+ if : ${{ !inputs.push-critical }}
278276
279277 - name : Copy clean images to push-attempt-images list
280278 run : cp image-build-logs/image-scan-output/clean-images.txt image-build-logs/push-attempt-images.txt
@@ -284,13 +282,13 @@ jobs:
284282 # This should be reverted when it's decided to filter high level CVEs as well.
285283 - name : Append dirty images to push list
286284 run : |
287- cat image-build-logs/image-scan-output/dirty -images.txt >> image-build-logs/push-attempt-images.txt
285+ cat image-build-logs/image-scan-output/high -images.txt >> image-build-logs/push-attempt-images.txt
288286 if : ${{ inputs.push }}
289287
290288 - name : Append images with critical vulnerabilities to push list
291289 run : |
292290 cat image-build-logs/image-scan-output/critical-images.txt >> image-build-logs/push-attempt-images.txt
293- if : ${{ inputs.push && inputs.push-dirty }}
291+ if : ${{ inputs.push && inputs.push-critical }}
294292
295293 - name : Push images
296294 run : |
@@ -332,19 +330,19 @@ jobs:
332330 if : ${{ steps.build_overcloud_images.outcome == 'failure' || steps.build_seed_images.outcome == 'failure' }}
333331
334332 - name : Fail when images failed to push
335- 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
336- if : ${{ !cancelled() }}
333+ run : if [ -e image-build-logs/push-failed-images.txt ] && [ $(wc -l < image-build-logs/push-failed-images.txt) -gt 0 ]; then cat image-build-logs/push-failed-images.txt && exit 1; fi
334+ if : ${{ inputs.push && !cancelled() }}
337335
338336 # NOTE(seunghun1ee): Currently we want to mark the job fail only when critical CVEs are detected.
339337 # This can be used again instead of "Fail when critical vulnerabilities are found" when it's
340338 # decided to fail the job on detecting high CVEs as well.
341339 # - name: Fail when images failed scanning
342- # 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
343- # if: ${{ !inputs.push-dirty && !cancelled() }}
340+ # 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
341+ # if: ${{ !inputs.push-critical && !cancelled() }}
344342
345343 - name : Fail when critical vulnerabilities are found
346- 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
347- if : ${{ !inputs.push-dirty && !cancelled() }}
344+ run : if [ -e image-build-logs/image-scan-output/critical-images.txt ] && [ $(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
345+ if : ${{ !inputs.push-critical && !cancelled() }}
348346
349347 - name : Remove locally built images for this run
350348 if : always() && runner.arch == 'ARM64'
0 commit comments