From e5de27f0985482c11f1bf8ed70c88b38706de871 Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Fri, 17 Dec 2021 15:17:24 +0100 Subject: [PATCH] engine: exec: support mount concurrency Signed-off-by: Andrea Luzzardi --- plan/task/exec.go | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/plan/task/exec.go b/plan/task/exec.go index a510fab6..ab573f4d 100644 --- a/plan/task/exec.go +++ b/plan/task/exec.go @@ -191,15 +191,29 @@ func (t *execTask) mountCache(_ *plancontext.Context, dest string, mnt *compiler return nil, err } - // FIXME: handle concurrency - concurrency := llb.CacheMountShared + concurrency, err := mnt.Lookup("concurrency").String() + if err != nil { + return nil, err + } + + var mode llb.CacheMountSharingMode + switch concurrency { + case "shared": + mode = llb.CacheMountShared + case "private": + mode = llb.CacheMountPrivate + case "locked": + mode = llb.CacheMountLocked + default: + return nil, fmt.Errorf("unknown concurrency mode %q", concurrency) + } return llb.AddMount( dest, llb.Scratch(), llb.AsPersistentCacheDir( id, - concurrency, + mode, ), ), nil }