@@ -264,60 +264,59 @@ jobs:
264264 - name : Fail if no images have been built
265265 run : if [ $(wc -l < ${{ matrix.distro.name }}-${{ matrix.distro.release }}-container-images) -le 1 ]; then exit 1; fi
266266
267- # NOTE(owenjones): temp. disabled scanning while playing with RL10 container builds
268- # - name: Scan built container images
269- # run: src/kayobe-config/tools/scan-images.sh ${{ matrix.distro.name }}-${{ matrix.distro.release }} ${{ steps.write-kolla-tag.outputs.kolla-tag }} ${{ inputs.sbom && '--sbom' }}
270-
271- # - name: Move image scan logs to output artifact
272- # run: mv image-scan-output image-build-logs/image-scan-output
273- # if: ${{ !cancelled() }}
274-
275- # - name: Fail if any images have critical vulnerabilities
276- # run: if [ $(wc -l < image-build-logs/image-scan-output/critical-images.txt) -gt 0 ]; then exit 1; fi
277- # if: ${{ !inputs.push-critical }}
278-
279- # - name: Copy clean images to push-attempt-images list
280- # run: cp image-build-logs/image-scan-output/clean-images.txt image-build-logs/push-attempt-images.txt
281- # if: inputs.push
282-
283- # # NOTE(seunghun1ee): This always appends dirty images with CVEs severity lower than critical.
284- # # This should be reverted when it's decided to filter high level CVEs as well.
285- # - name: Append dirty images to push list
286- # run: |
287- # cat image-build-logs/image-scan-output/high-images.txt >> image-build-logs/push-attempt-images.txt
288- # if: ${{ inputs.push }}
289-
290- # - name: Append images with critical vulnerabilities to push list
291- # run: |
292- # cat image-build-logs/image-scan-output/critical-images.txt >> image-build-logs/push-attempt-images.txt
293- # if: ${{ inputs.push && inputs.push-critical }}
294-
295- # - name: Push images
296- # run: |
297- # touch image-build-logs/push-failed-images.txt
298- # source venvs/kayobe/bin/activate &&
299- # source src/kayobe-config/kayobe-env --environment ci-builder &&
300- # kayobe playbook run ${KAYOBE_CONFIG_PATH}/ansible/tools/docker-registry-login.yml &&
301-
302- # while read -r image; do
303- # # Retries!
304- # for i in {1..5}; do
305- # if docker push $image; then
306- # echo "Pushed $image"
307- # break
308- # elif [ $i -eq 5 ] ; then
309- # echo "Failed to push $image"
310- # echo $image >> image-build-logs/push-failed-images.txt
311- # else
312- # echo "Failed on retry $i"
313- # sleep 5
314- # fi;
315- # done
316- # done < image-build-logs/push-attempt-images.txt
317- # shell: bash
318- # env:
319- # KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD_CI_BUILDER }}
320- # if: inputs.push
267+ - name : Scan built container images
268+ run : src/kayobe-config/tools/scan-images.sh ${{ matrix.distro.name }}-${{ matrix.distro.release }} ${{ steps.write-kolla-tag.outputs.kolla-tag }} ${{ inputs.sbom && '--sbom' }}
269+
270+ - name : Move image scan logs to output artifact
271+ run : mv image-scan-output image-build-logs/image-scan-output
272+ if : ${{ !cancelled() }}
273+
274+ - name : Fail if any images have critical vulnerabilities
275+ run : if [ $(wc -l < image-build-logs/image-scan-output/critical-images.txt) -gt 0 ]; then exit 1; fi
276+ if : ${{ !inputs.push-critical }}
277+
278+ - name : Copy clean images to push-attempt-images list
279+ run : cp image-build-logs/image-scan-output/clean-images.txt image-build-logs/push-attempt-images.txt
280+ if : inputs.push
281+
282+ # NOTE(seunghun1ee): This always appends dirty images with CVEs severity lower than critical.
283+ # This should be reverted when it's decided to filter high level CVEs as well.
284+ - name : Append dirty images to push list
285+ run : |
286+ cat image-build-logs/image-scan-output/high-images.txt >> image-build-logs/push-attempt-images.txt
287+ if : ${{ inputs.push }}
288+
289+ - name : Append images with critical vulnerabilities to push list
290+ run : |
291+ cat image-build-logs/image-scan-output/critical-images.txt >> image-build-logs/push-attempt-images.txt
292+ if : ${{ inputs.push && inputs.push-critical }}
293+
294+ - name : Push images
295+ run : |
296+ touch image-build-logs/push-failed-images.txt
297+ source venvs/kayobe/bin/activate &&
298+ source src/kayobe-config/kayobe-env --environment ci-builder &&
299+ kayobe playbook run ${KAYOBE_CONFIG_PATH}/ansible/tools/docker-registry-login.yml &&
300+
301+ while read -r image; do
302+ # Retries!
303+ for i in {1..5}; do
304+ if docker push $image; then
305+ echo "Pushed $image"
306+ break
307+ elif [ $i -eq 5 ] ; then
308+ echo "Failed to push $image"
309+ echo $image >> image-build-logs/push-failed-images.txt
310+ else
311+ echo "Failed on retry $i"
312+ sleep 5
313+ fi;
314+ done
315+ done < image-build-logs/push-attempt-images.txt
316+ shell : bash
317+ env :
318+ KAYOBE_VAULT_PASSWORD : ${{ secrets.KAYOBE_VAULT_PASSWORD_CI_BUILDER }}
319+ if : inputs.push
321320
322321 - name : Upload output artifact
323322 uses : actions/upload-artifact@v6
0 commit comments