From 11ada4c27b7d72c372089479960f54d277ad4027 Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Thu, 19 Apr 2018 23:41:59 -0700 Subject: [PATCH] frontend: enable importref for frontends Signed-off-by: Tonis Tiigi --- frontend/dockerfile/builder/build.go | 6 +++--- frontend/dockerfile/forward.go | 7 ++++--- frontend/gateway/client/client.go | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/frontend/dockerfile/builder/build.go b/frontend/dockerfile/builder/build.go index fd9adb47..64fa1a9b 100644 --- a/frontend/dockerfile/builder/build.go +++ b/frontend/dockerfile/builder/build.go @@ -57,7 +57,7 @@ func Build(ctx context.Context, c client.Client) error { eg, ctx2 := errgroup.WithContext(ctx) var dtDockerfile []byte eg.Go(func() error { - ref, err := c.Solve(ctx2, def.ToPB(), "", nil, false) + ref, err := c.Solve(ctx2, def.ToPB(), "", "", nil, false) if err != nil { return err } @@ -83,7 +83,7 @@ func Build(ctx context.Context, c client.Client) error { if err != nil { return err } - ref, err := c.Solve(ctx2, def.ToPB(), "", nil, false) + ref, err := c.Solve(ctx2, def.ToPB(), "", "", nil, false) if err != nil { return err } @@ -125,7 +125,7 @@ func Build(ctx context.Context, c client.Client) error { return err } - _, err = c.Solve(ctx, def.ToPB(), "", map[string][]byte{ + _, err = c.Solve(ctx, def.ToPB(), "", opts["cache-from"], map[string][]byte{ exporterImageConfig: config, }, true) if err != nil { diff --git a/frontend/dockerfile/forward.go b/frontend/dockerfile/forward.go index fc7d3330..017b5782 100644 --- a/frontend/dockerfile/forward.go +++ b/frontend/dockerfile/forward.go @@ -26,10 +26,11 @@ type bridgeClient struct { refs []*ref } -func (c *bridgeClient) Solve(ctx context.Context, def *pb.Definition, f string, exporterAttr map[string][]byte, final bool) (client.Reference, error) { +func (c *bridgeClient) Solve(ctx context.Context, def *pb.Definition, f string, importRef string, exporterAttr map[string][]byte, final bool) (client.Reference, error) { r, exporterAttrRes, err := c.FrontendLLBBridge.Solve(ctx, frontend.SolveRequest{ - Definition: def, - Frontend: f, + Definition: def, + Frontend: f, + ImportCacheRef: importRef, }) if err != nil { return nil, err diff --git a/frontend/gateway/client/client.go b/frontend/gateway/client/client.go index 092274ba..3798765f 100644 --- a/frontend/gateway/client/client.go +++ b/frontend/gateway/client/client.go @@ -9,7 +9,7 @@ import ( // TODO: make this take same options as LLBBridge. Add Return() type Client interface { - Solve(ctx context.Context, def *pb.Definition, frontend string, exporterAttr map[string][]byte, final bool) (Reference, error) + Solve(ctx context.Context, def *pb.Definition, frontend string, importRef string, exporterAttr map[string][]byte, final bool) (Reference, error) ResolveImageConfig(ctx context.Context, ref string) (digest.Digest, []byte, error) Opts() map[string]string SessionID() string