mirror of
https://github.com/moby/buildkit.git
synced 2026-08-05 23:30:22 +00:00
exec: allow content-cache for root selected mounts
These mounts are actually safe, as suggested by Erik on slack: > Is it correct that this wouldn’t be a problem in the case where the > selector of the mount is just “/“? Because then there’s no “hidden” > files. > > If so, maybe there’s a path to enabling content cache for rw mounts > that are from “/“. Then you could also get the same end behavior by > not using selectors and instead always copying the subdir you want to > mount to scratch. This patch adds a check for this case, and explicitly enables content-based cache for these cases. Co-authored-by: Erik Sipsma <erik@sipsma.dev> Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
@@ -318,6 +318,10 @@ func (e *ExecOp) getMountDeps() ([]dep, error) {
|
||||
// if the mount is read-only, then it's also safe, since it can't
|
||||
// be modified by the operation
|
||||
contentBasedCache = true
|
||||
} else if sel == pb.RootMount {
|
||||
// if the mount mounts the entire source, then it's also safe,
|
||||
// since there are no unselected "sneaky" files
|
||||
contentBasedCache = true
|
||||
}
|
||||
|
||||
if m.Dest == pb.RootMount {
|
||||
|
||||
Reference in New Issue
Block a user