Ensure report-built-images doesn't fail when no images were built

Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
Rémy Coutable 2024-06-03 07:17:10 +02:00
parent ade2c59d15
commit 7cb9668ef6
No known key found for this signature in database
2 changed files with 14 additions and 2 deletions

View file

@ -57,6 +57,7 @@
-t "$CI_REGISTRY_IMAGE:$IMAGE_NAME" \ -t "$CI_REGISTRY_IMAGE:$IMAGE_NAME" \
-f "Dockerfile.$IMAGE_NAME" \ -f "Dockerfile.$IMAGE_NAME" \
. .
- 'echo "${CI_JOB_URL}: ${IMAGE_NAME}" > "${CI_JOB_ID}-${CI_JOB_NAME_SLUG}-built-image.txt"'
rules: rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"' - if: '$CI_PIPELINE_SOURCE == "schedule"'
when: never when: never

View file

@ -2,8 +2,19 @@ report-built-images:
image: alpine image: alpine
stage: report stage: report
script: script:
- cat *-built-image.txt > all-built-images.txt - |
- cat all-built-images.txt set -- "${CI_PROJECT_DIR}"/*-built-image.txt
while [ "$#" -gt 0 ] && [ ! -f "$1" ]; do
shift
done
if [ -f "$1" ]; then
cat *-built-image.txt > all-built-images.txt
cat all-built-images.txt
else
echo "No images built";
fi
artifacts: artifacts:
paths: ["all-built-images.txt"] paths: ["all-built-images.txt"]
expire_in: 90d expire_in: 90d