mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-04 10:03:42 +08:00 
			
		
		
		
	Bump buildkit to master and fix versions incompatible with go mod 1.13
Bump github.com/gogo/googleapis to v1.3.2 Bump github.com/docker/cli to master Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
This commit is contained in:
		
							
								
								
									
										20
									
								
								vendor/github.com/moby/buildkit/frontend/gateway/client/client.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										20
									
								
								vendor/github.com/moby/buildkit/frontend/gateway/client/client.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -3,6 +3,7 @@ package client
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
 | 
			
		||||
	"github.com/moby/buildkit/client/llb"
 | 
			
		||||
	"github.com/moby/buildkit/solver/pb"
 | 
			
		||||
	"github.com/moby/buildkit/util/apicaps"
 | 
			
		||||
	digest "github.com/opencontainers/go-digest"
 | 
			
		||||
@@ -12,11 +13,13 @@ import (
 | 
			
		||||
 | 
			
		||||
type Client interface {
 | 
			
		||||
	Solve(ctx context.Context, req SolveRequest) (*Result, error)
 | 
			
		||||
	ResolveImageConfig(ctx context.Context, ref string, opt ResolveImageConfigOpt) (digest.Digest, []byte, error)
 | 
			
		||||
	ResolveImageConfig(ctx context.Context, ref string, opt llb.ResolveImageConfigOpt) (digest.Digest, []byte, error)
 | 
			
		||||
	BuildOpts() BuildOpts
 | 
			
		||||
	Inputs(ctx context.Context) (map[string]llb.State, error)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type Reference interface {
 | 
			
		||||
	ToState() (llb.State, error)
 | 
			
		||||
	ReadFile(ctx context.Context, req ReadRequest) ([]byte, error)
 | 
			
		||||
	StatFile(ctx context.Context, req StatRequest) (*fstypes.Stat, error)
 | 
			
		||||
	ReadDir(ctx context.Context, req ReadDirRequest) ([]*fstypes.Stat, error)
 | 
			
		||||
@@ -43,10 +46,11 @@ type StatRequest struct {
 | 
			
		||||
 | 
			
		||||
// SolveRequest is same as frontend.SolveRequest but avoiding dependency
 | 
			
		||||
type SolveRequest struct {
 | 
			
		||||
	Definition   *pb.Definition
 | 
			
		||||
	Frontend     string
 | 
			
		||||
	FrontendOpt  map[string]string
 | 
			
		||||
	CacheImports []CacheOptionsEntry
 | 
			
		||||
	Definition     *pb.Definition
 | 
			
		||||
	Frontend       string
 | 
			
		||||
	FrontendOpt    map[string]string
 | 
			
		||||
	FrontendInputs map[string]*pb.Definition
 | 
			
		||||
	CacheImports   []CacheOptionsEntry
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type CacheOptionsEntry struct {
 | 
			
		||||
@@ -68,9 +72,3 @@ type BuildOpts struct {
 | 
			
		||||
	LLBCaps   apicaps.CapSet
 | 
			
		||||
	Caps      apicaps.CapSet
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type ResolveImageConfigOpt struct {
 | 
			
		||||
	Platform    *specs.Platform
 | 
			
		||||
	ResolveMode string
 | 
			
		||||
	LogName     string
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										140
									
								
								vendor/github.com/moby/buildkit/frontend/gateway/grpcclient/client.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										140
									
								
								vendor/github.com/moby/buildkit/frontend/gateway/grpcclient/client.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -10,6 +10,7 @@ import (
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"github.com/gogo/googleapis/google/rpc"
 | 
			
		||||
	"github.com/moby/buildkit/client/llb"
 | 
			
		||||
	"github.com/moby/buildkit/frontend/gateway/client"
 | 
			
		||||
	pb "github.com/moby/buildkit/frontend/gateway/pb"
 | 
			
		||||
	opspb "github.com/moby/buildkit/solver/pb"
 | 
			
		||||
@@ -68,15 +69,15 @@ func current() (GrpcClient, error) {
 | 
			
		||||
	return New(ctx, opts(), sessionID(), product(), pb.NewLLBBridgeClient(conn), workers())
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func convertRef(ref client.Reference) (string, error) {
 | 
			
		||||
func convertRef(ref client.Reference) (*pb.Ref, error) {
 | 
			
		||||
	if ref == nil {
 | 
			
		||||
		return "", nil
 | 
			
		||||
		return &pb.Ref{}, nil
 | 
			
		||||
	}
 | 
			
		||||
	r, ok := ref.(*reference)
 | 
			
		||||
	if !ok {
 | 
			
		||||
		return "", errors.Errorf("invalid return reference type %T", ref)
 | 
			
		||||
		return nil, errors.Errorf("invalid return reference type %T", ref)
 | 
			
		||||
	}
 | 
			
		||||
	return r.id, nil
 | 
			
		||||
	return &pb.Ref{Id: r.id, Def: r.def}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func RunFromEnvironment(ctx context.Context, f client.BuildFunc) error {
 | 
			
		||||
@@ -105,22 +106,43 @@ func (c *grpcClient) Run(ctx context.Context, f client.BuildFunc) (retError erro
 | 
			
		||||
					Metadata: res.Metadata,
 | 
			
		||||
				}
 | 
			
		||||
				if res.Refs != nil {
 | 
			
		||||
					m := map[string]string{}
 | 
			
		||||
					for k, r := range res.Refs {
 | 
			
		||||
						id, err := convertRef(r)
 | 
			
		||||
						if err != nil {
 | 
			
		||||
							retError = err
 | 
			
		||||
							continue
 | 
			
		||||
					if c.caps.Supports(pb.CapProtoRefArray) == nil {
 | 
			
		||||
						m := map[string]*pb.Ref{}
 | 
			
		||||
						for k, r := range res.Refs {
 | 
			
		||||
							pbRef, err := convertRef(r)
 | 
			
		||||
							if err != nil {
 | 
			
		||||
								retError = err
 | 
			
		||||
								continue
 | 
			
		||||
							}
 | 
			
		||||
							m[k] = pbRef
 | 
			
		||||
						}
 | 
			
		||||
						m[k] = id
 | 
			
		||||
						pbRes.Result = &pb.Result_Refs{Refs: &pb.RefMap{Refs: m}}
 | 
			
		||||
					} else {
 | 
			
		||||
						// Server doesn't support the new wire format for refs, so we construct
 | 
			
		||||
						// a deprecated result ref map.
 | 
			
		||||
						m := map[string]string{}
 | 
			
		||||
						for k, r := range res.Refs {
 | 
			
		||||
							pbRef, err := convertRef(r)
 | 
			
		||||
							if err != nil {
 | 
			
		||||
								retError = err
 | 
			
		||||
								continue
 | 
			
		||||
							}
 | 
			
		||||
							m[k] = pbRef.Id
 | 
			
		||||
						}
 | 
			
		||||
						pbRes.Result = &pb.Result_RefsDeprecated{RefsDeprecated: &pb.RefMapDeprecated{Refs: m}}
 | 
			
		||||
					}
 | 
			
		||||
					pbRes.Result = &pb.Result_Refs{Refs: &pb.RefMap{Refs: m}}
 | 
			
		||||
				} else {
 | 
			
		||||
					id, err := convertRef(res.Ref)
 | 
			
		||||
					pbRef, err := convertRef(res.Ref)
 | 
			
		||||
					if err != nil {
 | 
			
		||||
						retError = err
 | 
			
		||||
					} else {
 | 
			
		||||
						pbRes.Result = &pb.Result_Ref{Ref: id}
 | 
			
		||||
						if c.caps.Supports(pb.CapProtoRefArray) == nil {
 | 
			
		||||
							pbRes.Result = &pb.Result_Ref{Ref: pbRef}
 | 
			
		||||
						} else {
 | 
			
		||||
							// Server doesn't support the new wire format for refs, so we construct
 | 
			
		||||
							// a deprecated result ref.
 | 
			
		||||
							pbRes.Result = &pb.Result_RefDeprecated{RefDeprecated: pbRef.Id}
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				if retError == nil {
 | 
			
		||||
@@ -280,10 +302,12 @@ func (c *grpcClient) Solve(ctx context.Context, creq client.SolveRequest) (*clie
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	req := &pb.SolveRequest{
 | 
			
		||||
		Definition:        creq.Definition,
 | 
			
		||||
		Frontend:          creq.Frontend,
 | 
			
		||||
		FrontendOpt:       creq.FrontendOpt,
 | 
			
		||||
		AllowResultReturn: true,
 | 
			
		||||
		Definition:          creq.Definition,
 | 
			
		||||
		Frontend:            creq.Frontend,
 | 
			
		||||
		FrontendOpt:         creq.FrontendOpt,
 | 
			
		||||
		FrontendInputs:      creq.FrontendInputs,
 | 
			
		||||
		AllowResultReturn:   true,
 | 
			
		||||
		AllowResultArrayRef: true,
 | 
			
		||||
		// old API
 | 
			
		||||
		ImportCacheRefsDeprecated: legacyRegistryCacheImports,
 | 
			
		||||
		// new API
 | 
			
		||||
@@ -310,25 +334,44 @@ func (c *grpcClient) Solve(ctx context.Context, creq client.SolveRequest) (*clie
 | 
			
		||||
	} else {
 | 
			
		||||
		res.Metadata = resp.Result.Metadata
 | 
			
		||||
		switch pbRes := resp.Result.Result.(type) {
 | 
			
		||||
		case *pb.Result_Ref:
 | 
			
		||||
			if id := pbRes.Ref; id != "" {
 | 
			
		||||
		case *pb.Result_RefDeprecated:
 | 
			
		||||
			if id := pbRes.RefDeprecated; id != "" {
 | 
			
		||||
				res.SetRef(&reference{id: id, c: c})
 | 
			
		||||
			}
 | 
			
		||||
		case *pb.Result_Refs:
 | 
			
		||||
			for k, v := range pbRes.Refs.Refs {
 | 
			
		||||
		case *pb.Result_RefsDeprecated:
 | 
			
		||||
			for k, v := range pbRes.RefsDeprecated.Refs {
 | 
			
		||||
				ref := &reference{id: v, c: c}
 | 
			
		||||
				if v == "" {
 | 
			
		||||
					ref = nil
 | 
			
		||||
				}
 | 
			
		||||
				res.AddRef(k, ref)
 | 
			
		||||
			}
 | 
			
		||||
		case *pb.Result_Ref:
 | 
			
		||||
			if pbRes.Ref.Id != "" {
 | 
			
		||||
				ref, err := newReference(c, pbRes.Ref)
 | 
			
		||||
				if err != nil {
 | 
			
		||||
					return nil, err
 | 
			
		||||
				}
 | 
			
		||||
				res.SetRef(ref)
 | 
			
		||||
			}
 | 
			
		||||
		case *pb.Result_Refs:
 | 
			
		||||
			for k, v := range pbRes.Refs.Refs {
 | 
			
		||||
				var ref *reference
 | 
			
		||||
				if v.Id != "" {
 | 
			
		||||
					ref, err = newReference(c, v)
 | 
			
		||||
					if err != nil {
 | 
			
		||||
						return nil, err
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				res.AddRef(k, ref)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return res, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c *grpcClient) ResolveImageConfig(ctx context.Context, ref string, opt client.ResolveImageConfigOpt) (digest.Digest, []byte, error) {
 | 
			
		||||
func (c *grpcClient) ResolveImageConfig(ctx context.Context, ref string, opt llb.ResolveImageConfigOpt) (digest.Digest, []byte, error) {
 | 
			
		||||
	var p *opspb.Platform
 | 
			
		||||
	if platform := opt.Platform; platform != nil {
 | 
			
		||||
		p = &opspb.Platform{
 | 
			
		||||
@@ -357,9 +400,56 @@ func (c *grpcClient) BuildOpts() client.BuildOpts {
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c *grpcClient) Inputs(ctx context.Context) (map[string]llb.State, error) {
 | 
			
		||||
	err := c.caps.Supports(pb.CapFrontendInputs)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	resp, err := c.client.Inputs(ctx, &pb.InputsRequest{})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	inputs := make(map[string]llb.State)
 | 
			
		||||
	for key, def := range resp.Definitions {
 | 
			
		||||
		op, err := llb.NewDefinitionOp(def)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return nil, err
 | 
			
		||||
		}
 | 
			
		||||
		inputs[key] = llb.NewState(op)
 | 
			
		||||
	}
 | 
			
		||||
	return inputs, nil
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type reference struct {
 | 
			
		||||
	id string
 | 
			
		||||
	c  *grpcClient
 | 
			
		||||
	c      *grpcClient
 | 
			
		||||
	id     string
 | 
			
		||||
	def    *opspb.Definition
 | 
			
		||||
	output llb.Output
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func newReference(c *grpcClient, ref *pb.Ref) (*reference, error) {
 | 
			
		||||
	return &reference{c: c, id: ref.Id, def: ref.Def}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *reference) ToState() (st llb.State, err error) {
 | 
			
		||||
	err = r.c.caps.Supports(pb.CapReferenceOutput)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return st, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if r.def == nil {
 | 
			
		||||
		return st, errors.Errorf("gateway did not return reference with definition")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	defop, err := llb.NewDefinitionOp(r.def)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return st, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return llb.NewState(defop), nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *reference) ReadFile(ctx context.Context, req client.ReadRequest) ([]byte, error) {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										34
									
								
								vendor/github.com/moby/buildkit/frontend/gateway/pb/caps.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										34
									
								
								vendor/github.com/moby/buildkit/frontend/gateway/pb/caps.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -19,6 +19,19 @@ const (
 | 
			
		||||
	CapReadDir                 apicaps.CapID = "readdir"
 | 
			
		||||
	CapStatFile                apicaps.CapID = "statfile"
 | 
			
		||||
	CapImportCaches            apicaps.CapID = "importcaches"
 | 
			
		||||
 | 
			
		||||
	// CapProtoRefArray is a capability to return arrays of refs instead of single
 | 
			
		||||
	// refs. This capability is only for the wire format change and shouldn't be
 | 
			
		||||
	// used in frontends for feature detection.
 | 
			
		||||
	CapProtoRefArray apicaps.CapID = "proto.refarray"
 | 
			
		||||
 | 
			
		||||
	// CapReferenceOutput is a capability to use a reference of a solved result as
 | 
			
		||||
	// an llb.Output.
 | 
			
		||||
	CapReferenceOutput apicaps.CapID = "reference.output"
 | 
			
		||||
 | 
			
		||||
	// CapFrontendInputs is a capability to request frontend inputs from the
 | 
			
		||||
	// LLBBridge GRPC server.
 | 
			
		||||
	CapFrontendInputs apicaps.CapID = "frontend.inputs"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
@@ -92,4 +105,25 @@ func init() {
 | 
			
		||||
		Enabled: true,
 | 
			
		||||
		Status:  apicaps.CapStatusExperimental,
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	Caps.Init(apicaps.Cap{
 | 
			
		||||
		ID:      CapProtoRefArray,
 | 
			
		||||
		Name:    "wire format ref arrays",
 | 
			
		||||
		Enabled: true,
 | 
			
		||||
		Status:  apicaps.CapStatusExperimental,
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	Caps.Init(apicaps.Cap{
 | 
			
		||||
		ID:      CapReferenceOutput,
 | 
			
		||||
		Name:    "reference output",
 | 
			
		||||
		Enabled: true,
 | 
			
		||||
		Status:  apicaps.CapStatusExperimental,
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	Caps.Init(apicaps.Cap{
 | 
			
		||||
		ID:      CapFrontendInputs,
 | 
			
		||||
		Name:    "frontend inputs",
 | 
			
		||||
		Enabled: true,
 | 
			
		||||
		Status:  apicaps.CapStatusExperimental,
 | 
			
		||||
	})
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3228
									
								
								vendor/github.com/moby/buildkit/frontend/gateway/pb/gateway.pb.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										3228
									
								
								vendor/github.com/moby/buildkit/frontend/gateway/pb/gateway.pb.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										32
									
								
								vendor/github.com/moby/buildkit/frontend/gateway/pb/gateway.proto
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										32
									
								
								vendor/github.com/moby/buildkit/frontend/gateway/pb/gateway.proto
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -26,20 +26,35 @@ service LLBBridge {
 | 
			
		||||
	rpc StatFile(StatFileRequest) returns (StatFileResponse);
 | 
			
		||||
	rpc Ping(PingRequest) returns (PongResponse);
 | 
			
		||||
	rpc Return(ReturnRequest) returns (ReturnResponse);
 | 
			
		||||
	// apicaps:CapFrontendInputs
 | 
			
		||||
	rpc Inputs(InputsRequest) returns (InputsResponse);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message Result {
 | 
			
		||||
	oneof result {
 | 
			
		||||
		string ref = 1;
 | 
			
		||||
		RefMap refs = 2;
 | 
			
		||||
    		// Deprecated non-array refs.
 | 
			
		||||
		string refDeprecated = 1;
 | 
			
		||||
		RefMapDeprecated refsDeprecated = 2;
 | 
			
		||||
 | 
			
		||||
		Ref ref = 3;
 | 
			
		||||
		RefMap refs = 4;
 | 
			
		||||
	}
 | 
			
		||||
	map<string, bytes> metadata = 10;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message RefMap {
 | 
			
		||||
message RefMapDeprecated {
 | 
			
		||||
	map<string, string> refs = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message Ref {
 | 
			
		||||
	string id = 1;
 | 
			
		||||
	pb.Definition def = 2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message RefMap {
 | 
			
		||||
	map<string, Ref> refs = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message ReturnRequest {
 | 
			
		||||
	Result result = 1;
 | 
			
		||||
	google.rpc.Status error = 2;
 | 
			
		||||
@@ -48,6 +63,13 @@ message ReturnRequest {
 | 
			
		||||
message ReturnResponse {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message InputsRequest {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message InputsResponse {
 | 
			
		||||
    map<string, pb.Definition> Definitions = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message ResolveImageConfigRequest {
 | 
			
		||||
	string Ref = 1;
 | 
			
		||||
	pb.Platform Platform = 2;
 | 
			
		||||
@@ -70,6 +92,7 @@ message SolveRequest {
 | 
			
		||||
        // for each of the ImportCacheRefs entry to CacheImports for compatibility. (planned to be removed)
 | 
			
		||||
	repeated string ImportCacheRefsDeprecated = 4;
 | 
			
		||||
	bool allowResultReturn = 5;
 | 
			
		||||
	bool allowResultArrayRef = 6;
 | 
			
		||||
	
 | 
			
		||||
	// apicaps.CapSolveInlineReturn deprecated
 | 
			
		||||
	bool Final = 10;
 | 
			
		||||
@@ -77,6 +100,9 @@ message SolveRequest {
 | 
			
		||||
	// CacheImports was added in BuildKit v0.4.0.
 | 
			
		||||
	// apicaps:CapImportCaches
 | 
			
		||||
	repeated CacheOptionsEntry CacheImports = 12;
 | 
			
		||||
 | 
			
		||||
	// apicaps:CapFrontendInputs
 | 
			
		||||
	map<string, pb.Definition> FrontendInputs = 13;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CacheOptionsEntry corresponds to the control.CacheOptionsEntry
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user