Introduce a report-built-images job to gather the list of all built images

This commit is contained in:
Rémy Coutable 2024-06-01 06:46:35 +00:00 committed by Balasankar 'Balu' C
parent 439201893a
commit 2ddf1ada73
4 changed files with 33 additions and 17 deletions

View file

@ -18,8 +18,6 @@ default:
image: ${BASE_BUILD_REGISTRY_IMAGE}/debian-bullseye-slim:docker-${DOCKER_VERSION} image: ${BASE_BUILD_REGISTRY_IMAGE}/debian-bullseye-slim:docker-${DOCKER_VERSION}
services: services:
- docker:${DOCKER_VERSION}-dind - docker:${DOCKER_VERSION}-dind
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
tags: tags:
- gitlab-org-docker - gitlab-org-docker
@ -37,6 +35,7 @@ stages:
- gitlab-cng - gitlab-cng
- gitlab-kas - gitlab-kas
- gitlab-workhorse - gitlab-workhorse
- report
variables: variables:
DOCKER_HOST: tcp://docker:2375 DOCKER_HOST: tcp://docker:2375
@ -44,7 +43,16 @@ variables:
DOCKER_VERSION: "24.0.5" DOCKER_VERSION: "24.0.5"
dont-interrupt-me: dont-interrupt-me:
extends: .dont-interrupt-me stage: .pre
interruptible: false
script:
- echo "This jobs makes sure this pipeline won't be interrupted! See https://docs.gitlab.com/ee/ci/yaml/#interruptible."
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
allow_failure: true
- if: $CI_MERGE_REQUEST_IID
when: manual
allow_failure: true
cache-chrome-chromium: cache-chrome-chromium:
extends: .cache-google-chrome extends: .cache-google-chrome

View file

@ -18,9 +18,16 @@
fi fi
- docker buildx create --use # creates and set's to active buildkit builder - docker buildx create --use # creates and set's to active buildkit builder
.with-built-image-artifact:
artifacts:
paths: ["*-built-image.txt"]
expire_in: 7d
.build_dynamic_image: .build_dynamic_image:
stage: custom stage: custom
extends: .install-qemu extends:
- .install-qemu
- .with-built-image-artifact
needs: [] needs: []
script: script:
- ./scripts/lib/custom-docker-build - ./scripts/lib/custom-docker-build
@ -30,7 +37,9 @@
.build_static_image: .build_static_image:
stage: custom stage: custom
extends: .install-qemu extends:
- .install-qemu
- .with-built-image-artifact
needs: [] needs: []
script: script:
# Hack to set an array in /bin/sh # Hack to set an array in /bin/sh
@ -94,15 +103,3 @@
- if: '$CI_MERGE_REQUEST_IID' - if: '$CI_MERGE_REQUEST_IID'
when: manual when: manual
allow_failure: true allow_failure: true
.dont-interrupt-me:
stage: .pre
interruptible: false
script:
- echo "This jobs makes sure this pipeline won't be interrupted! See https://docs.gitlab.com/ee/ci/yaml/#interruptible."
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
allow_failure: true
- if: $CI_MERGE_REQUEST_IID
when: manual
allow_failure: true

10
.gitlab/ci/report.yml Normal file
View file

@ -0,0 +1,10 @@
report-built-images:
image: alpine
stage: report
script:
- cat *-built-image.txt > all-built-images.txt
- cat all-built-images.txt
artifacts:
paths: ["all-built-images.txt"]
expire_in: 90d

View file

@ -494,6 +494,7 @@ function build_custom_if_needed() {
run_command docker push "$full_image_name" run_command docker push "$full_image_name"
fi fi
fi fi
echo "${CI_JOB_URL}: $full_image_name" > "${CI_JOB_ID}-${CI_JOB_NAME_SLUG}-built-image.txt"
printf "\n\nSUCCESS - Successfully built:\n\t%s\n" "$full_image_name" printf "\n\nSUCCESS - Successfully built:\n\t%s\n" "$full_image_name"
} }