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>
(cherry picked from commit 0e106e6967)
v0.8
Aaron Lehmann 2021-04-13 22:04:28 -07:00 committed by Tonis Tiigi
parent a1094c61f9
commit f1ae3a25b9
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.Meta = &meta
n.Mounts = nil n.Mounts = nil
for i := range n.Mounts { for i := range old.Mounts {
m := *n.Mounts[i] m := *old.Mounts[i]
n.Mounts = append(n.Mounts, &m) n.Mounts = append(n.Mounts, &m)
} }
return n return n