engine: exec: support mount concurrency

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2021-12-17 15:17:24 +01:00
parent 12be9a7dd8
commit e5de27f098

View File

@ -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
}