frontend: enable importref for frontends

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
docker-18.09
Tonis Tiigi 2018-04-19 23:41:59 -07:00
parent 3ca07f1467
commit 11ada4c27b
3 changed files with 8 additions and 7 deletions

View File

@ -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 {

View File

@ -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

View File

@ -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