From 283eb3a933cda3c17e8dc82d1b5300c7de6efd31 Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Thu, 13 Jan 2022 15:47:09 -0800 Subject: [PATCH] exec: mount: improve error reporting on non-concrete mounts Because of the mount disjunction, passing a non-concrete #FS results in CUE being confused as to what type of mount it is (Cache, FS, Secret, ...). This adds an explicit error check. Signed-off-by: Andrea Luzzardi --- plan/task/exec.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plan/task/exec.go b/plan/task/exec.go index dd55ed93..e6fe7d3a 100644 --- a/plan/task/exec.go +++ b/plan/task/exec.go @@ -139,6 +139,10 @@ func (t execTask) mountAll(pctx *plancontext.Context, mounts *compiler.Value) ([ return nil, err } for _, mnt := range fields { + if mnt.Value.Lookup("dest").IsConcreteR() != nil { + return nil, fmt.Errorf("mount %q is not concrete", mnt.Selector.String()) + } + dest, err := mnt.Value.Lookup("dest").String() if err != nil { return nil, err