gitlab-ci: Introduce cleanup stage that removes container 'symlinks'
Our gitlab-ci pipeline builds the containers and tags them using SHA1 sum of the Dockerfile used, e.g dockerfile-af6f496009775b3b7260d7954cb51b8b44338a7f
. This way we need to rebuild only if the Dockerfile has changed.
We then skopeo copy
that image to link it to the commit we triggered the pipeline for, e.g.: commit-ffa98bc80f2f76b212d10b72ef7b93f842dbcb5a
. This way we can address the containers directly in the .gitlab-ci.yml
using predefined variables:
image: $CI_REGISTRY/$CI_PROJECT_PATH/build-fedora:commit-$CI_COMMIT_SHA
This leads to us having a lot of images tagged commit-....
polluting the registry.
We should introduce .post
stage that runs when: always
and uses skopeo to remove the "commit" copies.
We should also clean the historical tags.
TODO:
-
Update to newest buildah ci-templates image -
make build-debian depend on build-debian-minimal refered by dockerfile SHA instead of commit SHA, otherwise it rebuild after reference is deleted -
evaluate skopeo delete
feasibility and use either skopeo or reg -
if reg then get it integrated into ci-templates