llbsolver: don’t error on readonly scratch mount

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
docker-18.09
Tonis Tiigi 2018-06-07 13:54:04 -07:00
parent af03a526e7
commit 479419abf2
2 changed files with 10 additions and 2 deletions

View File

@ -893,8 +893,7 @@ func testMountWithNoSource(t *testing.T, sb integration.Sandbox) {
require.NoError(t, err)
_, err = c.Solve(context.TODO(), def, SolveOpt{}, nil)
require.Error(t, err)
require.Contains(t, err.Error(), "has no input")
require.NoError(t, err)
checkAllReleasable(t, c, sb, true)
}

View File

@ -262,7 +262,16 @@ func (e *execOp) Exec(ctx context.Context, inputs []solver.Result) ([]solver.Res
outputs = append(outputs, active)
mountable = active
}
} else if ref == nil {
// this case is empty readonly scratch without output that is not really useful for anything but don't error
active, err := makeMutable(ref)
if err != nil {
return nil, err
}
defer active.Release(context.TODO())
mountable = active
}
case pb.MountType_CACHE:
if m.CacheOpt == nil {
return nil, errors.Errorf("missing cache mount options")