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,19 +164,21 @@ func (op *Op) Exec(ctx context.Context, fs FS, out Fillable) (FS, error) {
opts = append(opts, llb.AddEnv("DAGGER_CACHEBUSTER", cacheBuster)) opts = append(opts, llb.AddEnv("DAGGER_CACHEBUSTER", cacheBuster))
} }
// mounts // mounts
if err := op.v.RangeStruct(func(k string, v *Value) error { if mounts := op.v.Lookup("mount"); mounts.Exists() {
mnt, err := v.Mount(k) if err := mounts.RangeStruct(func(k string, v *Value) error {
if err != nil { mnt, err := v.Mount(k)
return err if err != nil {
return err
}
opt, err := mnt.LLB(ctx, fs.Solver())
if err != nil {
return err
}
opts = append(opts, opt)
return nil
}); err != nil {
return fs, err
} }
opt, err := mnt.LLB(ctx, fs.Solver())
if err != nil {
return err
}
opts = append(opts, opt)
return nil
}); err != nil {
return fs, err
} }
// --> Execute // --> Execute
return fs.Change(func(st llb.State) llb.State { return fs.Change(func(st llb.State) llb.State {