-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fix missing mounts in execOp cache map #2076
Fix missing mounts in execOp cache map #2076
Conversation
A bug in cloneExecOp prevented mounts from being included in the digest computed for the execOp cache map. This could lead to an exec being wrongly cached when a different mount was used for a subsequent execution. Repro case: https://gist.github.com/aaronlehmann/cfeaefc028df8127fb85b9b5f9125f2d In this example, pass2 should generate an empty diff because the /from and /to mounts are the same busybox image. But before the fix, it uses the cached result from pass1 (with different mounts) instead. Signed-off-by: Aaron Lehmann <alehmann@netflix.com>
As discussed in slack, lets try to add compatibility check like https://github.com/moby/buildkit/pull/1965/files#diff-aaa2e0f79475db4b6234888b8ab5c1b440a68b397bc43003b832a33b1ad6cb85R111 for the default case like |
Signed-off-by: Aaron Lehmann <alehmann@netflix.com>
…ache bugfix Signed-off-by: Aaron Lehmann <alehmann@netflix.com>
f676dff
to
61bb15a
Compare
op.Mounts[0].CacheOpt == nil && | ||
op.Mounts[0].SSHOpt == nil && | ||
op.Mounts[0].SecretOpt == nil && | ||
op.Mounts[0].ResultID == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I run a simple Dockerfile through buildkit, I see the following in op.Mounts
: [{"input":0,"dest":"/","output":0}]
. I confirmed that this conditional works for my test case, but please make sure the exact checks make sense.
@tonistiigi: Is this ready to merge? |
A bug in
cloneExecOp
prevented mounts from being included in the digestcomputed for the
execOp
cache map. This could lead to an exec beingwrongly cached when a different mount was used for a subsequent
execution.
Repro case:
https://gist.github.com/aaronlehmann/cfeaefc028df8127fb85b9b5f9125f2d
In this example, pass2 should generate an empty diff because the /from
and /to mounts are the same busybox image. But before the fix, it uses
the cached result from pass1 (with different mounts) instead.
Signed-off-by: Aaron Lehmann alehmann@netflix.com