worker: add leases to fromremote

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
docker-19.03
Tonis Tiigi 2019-05-21 11:42:48 -07:00
parent 8e25187cc7
commit 74190cfff8
1 changed files with 7 additions and 0 deletions

View File

@ -41,6 +41,7 @@ import (
"github.com/moby/buildkit/source/http"
"github.com/moby/buildkit/source/local"
"github.com/moby/buildkit/util/contentutil"
"github.com/moby/buildkit/util/leaseutil"
"github.com/moby/buildkit/util/progress"
"github.com/moby/buildkit/util/resolver"
"github.com/moby/buildkit/worker"
@ -334,6 +335,12 @@ func getCreatedTimes(ref cache.ImmutableRef) (out []time.Time) {
}
func (w *Worker) FromRemote(ctx context.Context, remote *solver.Remote) (cache.ImmutableRef, error) {
ctx, done, err := leaseutil.WithLease(ctx, w.LeaseManager)
if err != nil {
return nil, err
}
defer done(ctx)
eg, gctx := errgroup.WithContext(ctx)
for _, desc := range remote.Descriptors {
func(desc ocispec.Descriptor) {