Skip to content

Commit e697c93

Browse files
tonistiigithaJeztah
authored andcommitted
builder: define GetRemotes for the worker
The function signature has changed since v0.10. Signed-off-by: Tonis Tiigi <[email protected]> (cherry picked from commit 335907d) Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 1141704 commit e697c93

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

builder/builder-next/worker/worker.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"github.com/docker/docker/layer"
1919
pkgprogress "github.com/docker/docker/pkg/progress"
2020
"github.com/moby/buildkit/cache"
21+
cacheconfig "github.com/moby/buildkit/cache/config"
2122
"github.com/moby/buildkit/client"
2223
"github.com/moby/buildkit/client/llb"
2324
"github.com/moby/buildkit/executor"
@@ -36,7 +37,6 @@ import (
3637
"github.com/moby/buildkit/source/http"
3738
"github.com/moby/buildkit/source/local"
3839
"github.com/moby/buildkit/util/archutil"
39-
"github.com/moby/buildkit/util/compression"
4040
"github.com/moby/buildkit/util/contentutil"
4141
"github.com/moby/buildkit/util/progress"
4242
"github.com/opencontainers/go-digest"
@@ -79,6 +79,10 @@ type Worker struct {
7979
SourceManager *source.Manager
8080
}
8181

82+
var _ interface {
83+
GetRemotes(context.Context, cache.ImmutableRef, bool, cacheconfig.RefConfig, bool, session.Group) ([]*solver.Remote, error)
84+
} = &Worker{}
85+
8286
// NewWorker instantiates a local worker
8387
func NewWorker(opt Opt) (*Worker, error) {
8488
sm, err := source.NewManager()
@@ -227,8 +231,11 @@ func (w *Worker) Exporter(name string, sm *session.Manager) (exporter.Exporter,
227231
}
228232
}
229233

230-
// GetRemote returns a remote snapshot reference for a local one
231-
func (w *Worker) GetRemote(ctx context.Context, ref cache.ImmutableRef, createIfNeeded bool, _ compression.Type, s session.Group) (*solver.Remote, error) {
234+
// GetRemotes returns the remote snapshot references given a local reference
235+
func (w *Worker) GetRemotes(ctx context.Context, ref cache.ImmutableRef, createIfNeeded bool, _ cacheconfig.RefConfig, all bool, s session.Group) ([]*solver.Remote, error) {
236+
if ref == nil {
237+
return nil, nil
238+
}
232239
var diffIDs []layer.DiffID
233240
var err error
234241
if !createIfNeeded {
@@ -258,10 +265,10 @@ func (w *Worker) GetRemote(ctx context.Context, ref cache.ImmutableRef, createIf
258265
}
259266
}
260267

261-
return &solver.Remote{
268+
return []*solver.Remote{{
262269
Descriptors: descriptors,
263270
Provider: &emptyProvider{},
264-
}, nil
271+
}}, nil
265272
}
266273

267274
// PruneCacheMounts removes the current cache snapshots for specified IDs

0 commit comments

Comments
 (0)