mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-04 10:03:42 +08:00 
			
		
		
		
	vendor: update buildkit with typed errors support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
		
							
								
								
									
										28
									
								
								vendor/github.com/moby/buildkit/frontend/gateway/grpcclient/client.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										28
									
								
								vendor/github.com/moby/buildkit/frontend/gateway/grpcclient/client.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -10,11 +10,14 @@ import (
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"github.com/gogo/googleapis/google/rpc"
 | 
			
		||||
	gogotypes "github.com/gogo/protobuf/types"
 | 
			
		||||
	"github.com/golang/protobuf/ptypes/any"
 | 
			
		||||
	"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"
 | 
			
		||||
	"github.com/moby/buildkit/util/apicaps"
 | 
			
		||||
	"github.com/moby/buildkit/util/grpcerrors"
 | 
			
		||||
	digest "github.com/opencontainers/go-digest"
 | 
			
		||||
	"github.com/pkg/errors"
 | 
			
		||||
	fstypes "github.com/tonistiigi/fsutil/types"
 | 
			
		||||
@@ -29,7 +32,7 @@ type GrpcClient interface {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func New(ctx context.Context, opts map[string]string, session, product string, c pb.LLBBridgeClient, w []client.WorkerInfo) (GrpcClient, error) {
 | 
			
		||||
	ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
 | 
			
		||||
	ctx, cancel := context.WithTimeout(ctx, 15*time.Second)
 | 
			
		||||
	defer cancel()
 | 
			
		||||
	resp, err := c.Ping(ctx, &pb.PingRequest{})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
@@ -150,12 +153,12 @@ func (c *grpcClient) Run(ctx context.Context, f client.BuildFunc) (retError erro
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			if retError != nil {
 | 
			
		||||
				st, _ := status.FromError(errors.Cause(retError))
 | 
			
		||||
				st, _ := status.FromError(grpcerrors.ToGRPC(retError))
 | 
			
		||||
				stp := st.Proto()
 | 
			
		||||
				req.Error = &rpc.Status{
 | 
			
		||||
					Code:    stp.Code,
 | 
			
		||||
					Message: stp.Message,
 | 
			
		||||
					// Details: stp.Details,
 | 
			
		||||
					Details: convertToGogoAny(stp.Details),
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			if _, err := c.client.Return(ctx, req); err != nil && retError == nil {
 | 
			
		||||
@@ -424,10 +427,9 @@ func (c *grpcClient) Inputs(ctx context.Context) (map[string]llb.State, error) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type reference struct {
 | 
			
		||||
	c      *grpcClient
 | 
			
		||||
	id     string
 | 
			
		||||
	def    *opspb.Definition
 | 
			
		||||
	output llb.Output
 | 
			
		||||
	c   *grpcClient
 | 
			
		||||
	id  string
 | 
			
		||||
	def *opspb.Definition
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func newReference(c *grpcClient, ref *pb.Ref) (*reference, error) {
 | 
			
		||||
@@ -499,11 +501,11 @@ func (r *reference) StatFile(ctx context.Context, req client.StatRequest) (*fsty
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func grpcClientConn(ctx context.Context) (context.Context, *grpc.ClientConn, error) {
 | 
			
		||||
	dialOpt := grpc.WithDialer(func(addr string, d time.Duration) (net.Conn, error) {
 | 
			
		||||
	dialOpt := grpc.WithContextDialer(func(ctx context.Context, addr string) (net.Conn, error) {
 | 
			
		||||
		return stdioConn(), nil
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	cc, err := grpc.DialContext(ctx, "", dialOpt, grpc.WithInsecure())
 | 
			
		||||
	cc, err := grpc.DialContext(ctx, "", dialOpt, grpc.WithInsecure(), grpc.WithUnaryInterceptor(grpcerrors.UnaryClientInterceptor), grpc.WithStreamInterceptor(grpcerrors.StreamClientInterceptor))
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, nil, errors.Wrap(err, "failed to create grpc client")
 | 
			
		||||
	}
 | 
			
		||||
@@ -589,3 +591,11 @@ func workers() []client.WorkerInfo {
 | 
			
		||||
func product() string {
 | 
			
		||||
	return os.Getenv("BUILDKIT_EXPORTEDPRODUCT")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func convertToGogoAny(in []*any.Any) []*gogotypes.Any {
 | 
			
		||||
	out := make([]*gogotypes.Any, len(in))
 | 
			
		||||
	for i := range in {
 | 
			
		||||
		out[i] = &gogotypes.Any{TypeUrl: in[i].TypeUrl, Value: in[i].Value}
 | 
			
		||||
	}
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								vendor/github.com/moby/buildkit/frontend/gateway/pb/caps.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/moby/buildkit/frontend/gateway/pb/caps.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
package moby_buildkit_v1_frontend
 | 
			
		||||
package moby_buildkit_v1_frontend //nolint:golint
 | 
			
		||||
 | 
			
		||||
import "github.com/moby/buildkit/util/apicaps"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								vendor/github.com/moby/buildkit/frontend/gateway/pb/gateway.proto
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								vendor/github.com/moby/buildkit/frontend/gateway/pb/gateway.proto
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -32,7 +32,7 @@ service LLBBridge {
 | 
			
		||||
 | 
			
		||||
message Result {
 | 
			
		||||
	oneof result {
 | 
			
		||||
    		// Deprecated non-array refs.
 | 
			
		||||
		// Deprecated non-array refs.
 | 
			
		||||
		string refDeprecated = 1;
 | 
			
		||||
		RefMapDeprecated refsDeprecated = 2;
 | 
			
		||||
 | 
			
		||||
@@ -67,7 +67,7 @@ message InputsRequest {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message InputsResponse {
 | 
			
		||||
    map<string, pb.Definition> Definitions = 1;
 | 
			
		||||
	map<string, pb.Definition> Definitions = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message ResolveImageConfigRequest {
 | 
			
		||||
@@ -87,9 +87,9 @@ message SolveRequest {
 | 
			
		||||
	string Frontend = 2;
 | 
			
		||||
	map<string, string> FrontendOpt = 3;
 | 
			
		||||
	// ImportCacheRefsDeprecated is deprecated in favor or the new Imports since BuildKit v0.4.0.
 | 
			
		||||
        // When ImportCacheRefsDeprecated is set, the solver appends
 | 
			
		||||
        // {.Type = "registry", .Attrs = {"ref": importCacheRef}}
 | 
			
		||||
        // for each of the ImportCacheRefs entry to CacheImports for compatibility. (planned to be removed)
 | 
			
		||||
	// When ImportCacheRefsDeprecated is set, the solver appends
 | 
			
		||||
	// {.Type = "registry", .Attrs = {"ref": importCacheRef}}
 | 
			
		||||
	// for each of the ImportCacheRefs entry to CacheImports for compatibility. (planned to be removed)
 | 
			
		||||
	repeated string ImportCacheRefsDeprecated = 4;
 | 
			
		||||
	bool allowResultReturn = 5;
 | 
			
		||||
	bool allowResultArrayRef = 6;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								vendor/github.com/moby/buildkit/frontend/gateway/pb/generate.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/moby/buildkit/frontend/gateway/pb/generate.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,3 +1,3 @@
 | 
			
		||||
package moby_buildkit_v1_frontend
 | 
			
		||||
package moby_buildkit_v1_frontend //nolint:golint
 | 
			
		||||
 | 
			
		||||
//go:generate protoc -I=. -I=../../../vendor/ -I=../../../../../../ --gogo_out=plugins=grpc:. gateway.proto
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user