exec: correctly lookup mounts. Fixes #6

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2021-01-11 18:05:33 -08:00
parent 8cda7e9b13
commit fedd85f09d

View File

@ -164,7 +164,8 @@ func (op *Op) Exec(ctx context.Context, fs FS, out Fillable) (FS, error) {
opts = append(opts, llb.AddEnv("DAGGER_CACHEBUSTER", cacheBuster))
}
// mounts
if err := op.v.RangeStruct(func(k string, v *Value) error {
if mounts := op.v.Lookup("mount"); mounts.Exists() {
if err := mounts.RangeStruct(func(k string, v *Value) error {
mnt, err := v.Mount(k)
if err != nil {
return err
@ -178,6 +179,7 @@ func (op *Op) Exec(ctx context.Context, fs FS, out Fillable) (FS, error) {
}); err != nil {
return fs, err
}
}
// --> Execute
return fs.Change(func(st llb.State) llb.State {
return st.Run(opts...).Root()