engine: exec: support mount concurrency
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
parent
12be9a7dd8
commit
e5de27f098
@ -191,15 +191,29 @@ func (t *execTask) mountCache(_ *plancontext.Context, dest string, mnt *compiler
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: handle concurrency
|
concurrency, err := mnt.Lookup("concurrency").String()
|
||||||
concurrency := llb.CacheMountShared
|
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(
|
return llb.AddMount(
|
||||||
dest,
|
dest,
|
||||||
llb.Scratch(),
|
llb.Scratch(),
|
||||||
llb.AsPersistentCacheDir(
|
llb.AsPersistentCacheDir(
|
||||||
id,
|
id,
|
||||||
concurrency,
|
mode,
|
||||||
),
|
),
|
||||||
), nil
|
), nil
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user