Skip to content

Add pipeline ID to docker image versions

Marcel Amirault requested to merge versioning-docker-images into main

Start better versioning of our docker images with the CI_PIPELINE_IID variable. (See https://docs.gitlab.com/ee/ci/variables/predefined_variables.html)

I tested CI_COMMIT_TIMESTAMP and CI_JOB_STARTED_AT, but I felt that made a long name just too long. The output is in ISO8601 format, so it looks like: 2021-06-18T06:11:14Z. That gives docker image names like:

  • registry.gitlab.com/gitlab-org/gitlab-docs/lint-markdown:alpine-3.13-vale-2.10.2-markdownlint-0.26.0-2021-06-18T06:11:14Z

Instead, we can use CI_PIPELINE_IID that simply increments by one each time we run a new pipeline. So if we run the job back to back, the number just increments:

  1. registry.gitlab.com/gitlab-org/gitlab-docs/lint-markdown:alpine-3.13-vale-2.10.2-markdownlint-ID-47411
  2. registry.gitlab.com/gitlab-org/gitlab-docs/lint-markdown:alpine-3.13-vale-2.10.2-markdownlint-ID-47412
  3. registry.gitlab.com/gitlab-org/gitlab-docs/lint-markdown:alpine-3.13-vale-2.10.2-markdownlint-ID-47413

(Yes, the latest pipeline IID is 47411)

Merge request reports