Skip to content

gitlab-ci: Preserve images built from the same commit

Untagged images are cleaned immediately from the GitLab container registry, so to preserve them for reproducibility purposes we tag every build with an unique name and have set a cleanup policy to drop these tags (currently once a week).

Unfortunately the unique ID I choose is not much unique: I reused code from another project that only builds images when new commits are pushed, so I used the $CI_COMMIT_SHA value which is far from unique when multiple images are built for the same commit due to the regularly scheduled daily builds.

Using the $CI_PIPELINE_ID should provide an actual unique ID and let people retrieve the originating pipeline more easily.

Edited by Emanuele Aina

Merge request reports

Loading