Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Conversation

@mzihlmann
Copy link

Labelling intermediate images can cause unecessary cache misses.

Description

Let's assume a label like so:

--label commit=${CI_COMMIT_SHA}

This will cause the intermediate image to be labelled with the sha. The digest of the intermediate image is used in computing the cache key for other images in the same multi-stage build. If now we run the same builds on another commit, the intermediate image emitted with new labels, which is not a problem per-se, but cache is now entirely invalid and can't be reused. As we don't intend on storing intermediate images anyways, there is no point in attaching labels to them.

With this change we skip labelling intermediate images, avoiding unecessary cache misses in certain multi-stage scenarios.

As a workaround we can also avoid labelling the image.

Reviewer Notes

  • The code flow looks good.
  • Unit tests and or integration tests added.

Release Notes

  • avoid multi-stage cache misses caused by labels on intermediate images

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant