Skip to content

Investigate why docker cache is not being used while building images

It looks like even though --cache-from is specified, the cache is not being used in CNG pipelines.

Consider the following sequence of events

  1. The version of exiftool was last updated on April 9th 2024
  2. So the image gitlab-exiftool should've been updated and cached in the next master pipeline run.
  3. Looking at the gitlab-exiftool job in that pipeline, that seems to be the case too - the image was successfully copied as registry.gitlab.com/gitlab-org/build/cng/gitlab-exiftool:master.

However, if you look at the next nightly pipeline and the gitlab-exiftool CI job in it, even though the build command has --cache-from registry.gitlab.com/gitlab-org/build/cng/gitlab-exiftool:master argument passed to it, exiftool gets built from source again.

Because this is a nightly pipeline, and because FORCE_IMAGE_BUILDS is set to true in the project CI/CD settings, the image gets attempted to build again - which makes sense. But, given cache exists for the same exact image, the builds should essentially just use all layers from the cache and not rebuild anything.