mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
vendor: update buildkit to master@8b7bcb900d3c
Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
13
vendor/github.com/moby/buildkit/util/grpcerrors/grpcerrors.go
generated
vendored
13
vendor/github.com/moby/buildkit/util/grpcerrors/grpcerrors.go
generated
vendored
@ -1,16 +1,17 @@
|
||||
package grpcerrors
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"github.com/containerd/typeurl"
|
||||
"github.com/containerd/typeurl/v2"
|
||||
rpc "github.com/gogo/googleapis/google/rpc"
|
||||
gogotypes "github.com/gogo/protobuf/types"
|
||||
"github.com/golang/protobuf/proto" //nolint:staticcheck
|
||||
"github.com/golang/protobuf/ptypes/any"
|
||||
"github.com/moby/buildkit/util/bklog"
|
||||
"github.com/moby/buildkit/util/stack"
|
||||
"github.com/sirupsen/logrus"
|
||||
spb "google.golang.org/genproto/googleapis/rpc/status"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
@ -25,7 +26,7 @@ type TypedErrorProto interface {
|
||||
WrapError(error) error
|
||||
}
|
||||
|
||||
func ToGRPC(err error) error {
|
||||
func ToGRPC(ctx context.Context, err error) error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
@ -64,7 +65,7 @@ func ToGRPC(err error) error {
|
||||
})
|
||||
|
||||
if len(details) > 0 {
|
||||
if st2, err := withDetails(st, details...); err == nil {
|
||||
if st2, err := withDetails(ctx, st, details...); err == nil {
|
||||
st = st2
|
||||
}
|
||||
}
|
||||
@ -72,7 +73,7 @@ func ToGRPC(err error) error {
|
||||
return st.Err()
|
||||
}
|
||||
|
||||
func withDetails(s *status.Status, details ...proto.Message) (*status.Status, error) {
|
||||
func withDetails(ctx context.Context, s *status.Status, details ...proto.Message) (*status.Status, error) {
|
||||
if s.Code() == codes.OK {
|
||||
return nil, errors.New("no error details for status with code OK")
|
||||
}
|
||||
@ -80,7 +81,7 @@ func withDetails(s *status.Status, details ...proto.Message) (*status.Status, er
|
||||
for _, detail := range details {
|
||||
url, err := typeurl.TypeURL(detail)
|
||||
if err != nil {
|
||||
logrus.Warnf("ignoring typed error %T: not registered", detail)
|
||||
bklog.G(ctx).Warnf("ignoring typed error %T: not registered", detail)
|
||||
continue
|
||||
}
|
||||
dt, err := json.Marshal(detail)
|
||||
|
6
vendor/github.com/moby/buildkit/util/grpcerrors/intercept.go
generated
vendored
6
vendor/github.com/moby/buildkit/util/grpcerrors/intercept.go
generated
vendored
@ -15,7 +15,7 @@ func UnaryServerInterceptor(ctx context.Context, req interface{}, info *grpc.Una
|
||||
oldErr := err
|
||||
if err != nil {
|
||||
stack.Helper()
|
||||
err = ToGRPC(err)
|
||||
err = ToGRPC(ctx, err)
|
||||
}
|
||||
if oldErr != nil && err == nil {
|
||||
logErr := errors.Wrap(err, "invalid grpc error conversion")
|
||||
@ -30,7 +30,7 @@ func UnaryServerInterceptor(ctx context.Context, req interface{}, info *grpc.Una
|
||||
}
|
||||
|
||||
func StreamServerInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
|
||||
err := ToGRPC(handler(srv, ss))
|
||||
err := ToGRPC(ss.Context(), handler(srv, ss))
|
||||
if err != nil {
|
||||
stack.Helper()
|
||||
}
|
||||
@ -50,5 +50,5 @@ func StreamClientInterceptor(ctx context.Context, desc *grpc.StreamDesc, cc *grp
|
||||
if err != nil {
|
||||
stack.Helper()
|
||||
}
|
||||
return s, ToGRPC(err)
|
||||
return s, ToGRPC(ctx, err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user