From 3c87ba1bd502986f627115c6756c257b4a0a66e9 Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Tue, 13 Aug 2024 13:04:43 +0300 Subject: [PATCH] exec: fix incorrect deps computation for special mounts Secret, SSH and Tmpfs mounts never have an input vertex and zero value for input should not be considered and input at index 0 . Currently, if for example secret mount had a input=0, it caused content based checksum from first input(rootfs), that could take quite a lot of time when image was big and had lots of files. The computation result was cached but if there was a cache invalidation in previous commands it caused checksum to recomputed again for the command with the secret mount. Signed-off-by: Tonis Tiigi --- solver/llbsolver/ops/exec.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/solver/llbsolver/ops/exec.go b/solver/llbsolver/ops/exec.go index 5f6777592e09..058d911353e2 100644 --- a/solver/llbsolver/ops/exec.go +++ b/solver/llbsolver/ops/exec.go @@ -285,6 +285,11 @@ type dep struct { func (e *ExecOp) getMountDeps() ([]dep, error) { deps := make([]dep, e.numInputs) for _, m := range e.op.Mounts { + switch m.MountType { + case pb.MountType_SECRET, pb.MountType_SSH, pb.MountType_TMPFS: + continue + } + if m.Input == pb.Empty { continue }