Optimize build of tooling container
On the past stages of my works I had to re-run docker build jobs on each pipeline run but there were no changes in the image. Finally I had to disable container rebuild with some kind of temporary hacks -- hard-coding latest image hash in yaml file. It would be convenient to run container image re-build only in case of changed scripts/dockerfile (via rules) and organize latest container image version passing to other jobs even if was built in one of previous pipelines.
Options to do that:
- using kind of
latest
tags for images in an image repository- using GitLab cache to keep last image tag between pipeline runs
- access latest GitLab artifacts via GitLab api https://docs.gitlab.com/ee/ci/pipelines/job_artifacts.html#access-the-latest-job-artifacts-by-url
Last two options would require to introduce some kind of intermediate job to handle variables for subsequent jobs. So I wonder what are the reasoning currently
latest
tag is only updated at release part? I suppose you want to be surelatest
is always stable. Just in case it's possible to separate dev and release image repositories or use kind oflatest-built
tag.Also it's not obivous neither from gitlab yaml nor from readmes that container image build requires CI_REGISTRY/CI_REGISTRY_PASSWORD/CI_REGISTRY_USER variables to be set It's suggested to denote such requirements with i.e.
inherits:variables
construct for container jobs or in other ways.