Fix missing mounts in execOp cache map

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>
v0.9
Aaron Lehmann 2021-04-13 22:04:28 -07:00
parent d3e0a6f2d8
commit 0e106e6967
1 changed files with 2 additions and 2 deletions

View File

@ -69,8 +69,8 @@ func cloneExecOp(old *pb.ExecOp) pb.ExecOp {
}
n.Meta = &meta
n.Mounts = nil
for i := range n.Mounts {
m := *n.Mounts[i]
for i := range old.Mounts {
m := *old.Mounts[i]
n.Mounts = append(n.Mounts, &m)
}
return n