Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --no-cache-filter to disable cache per target and per cache mount #1213

Open
tiborvass opened this issue Oct 17, 2019 · 2 comments
Open

Comments

@tiborvass
Copy link
Collaborator

Today disabling cache can only be done with --no-cache. This is a proposal for adding --no-cache-filter to disable cache per target (aka Dockerfile stage) and per cache mount.

UX

Couple of examples to get a grasp:

  • --no-cache-filter target1,target2 invalidates cache for both targets target1 and target2 (most common usecase)
  • equivalent to --no-cache-filter target1 --no-cache-filter target2
  • --no-cache --no-cache-filter !target1,!target2 invalidates cache for all targets but target1 and target2 (less common usecase)
  • --no-cache-filter mount:id1 invalidates cache for the cache mount with id id1 (defined with RUN --mount=type=cache,id=id1,...)
  • --no-cache would keep current behavior of disabling cache for all targets and cache mounts

Implementation

We need a new ignoreCacheMounts LLB property in addition to ignoreCache. It would be an array of mount indices corresponding to cache mounts that would be ignored/reset. This would revert the behavior of ignoreCache to what it was prior to #1092 but changing the --no-cache implementation to use both ignoreCache and ignoreCacheMounts to keep the current behavior of --no-cache wrt cache mounts.

cc @tonistiigi @AkihiroSuda @FernandoMiguel

@FernandoMiguel
Copy link
Collaborator

Any support for wildcard for targets or cache id?

@NickAJScott
Copy link

In this case --no-cache-filter mount:id1 is mount:id1 the equivalent of target1 and so would you be able to specify --no-cache --no-cache-filter !mount:id1 (essentially the negation on the mount) which essentially would disable all caches except id1 (I think this would provide my original use case around pip package caches) and would be a really helpful improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants