Skip to content

Clarifications about the cache management #6308

@Arcelone

Description

@Arcelone

Description

I have a GitLab pipeline that runs a build instruction every week and pushes the new image (if there is one) and the associated cache to the repo.

I'm using this setting:

--export-cache type=registry,ref=mysoft:cache
--import-cache type=registry,ref=mysoft:cache

The problem is that the cache changes even when there is no change to the image. This results in caches that are not from the same time as the image. For example, on Sunday 1, there was one new image and one new cache. Then, on Sunday 8, there was no new image because nothing changed, but there was a new cache.

Is this an expected behavior? I read that it's normal because loading the Dockerfile is concidered as an instruction in buildkit, and so is cached.
Should this be a concern? Is there a way to disable cache pushing if no new images are generated?

If anyone has any guidance or recommendations for handling this, I'm open to them.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions