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:
4
vendor/github.com/moby/buildkit/util/appcontext/appcontext.go
generated
vendored
4
vendor/github.com/moby/buildkit/util/appcontext/appcontext.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
||||
"os/signal"
|
||||
"sync"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/moby/buildkit/util/bklog"
|
||||
)
|
||||
|
||||
var appContextCache context.Context
|
||||
@ -36,7 +36,7 @@ func Context() context.Context {
|
||||
cancel()
|
||||
retries++
|
||||
if retries >= exitLimit {
|
||||
logrus.Errorf("got %d SIGTERM/SIGINTs, forcing shutdown", retries)
|
||||
bklog.G(ctx).Errorf("got %d SIGTERM/SIGINTs, forcing shutdown", retries)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
52
vendor/github.com/moby/buildkit/util/buildinfo/types/types.go
generated
vendored
52
vendor/github.com/moby/buildkit/util/buildinfo/types/types.go
generated
vendored
@ -1,52 +0,0 @@
|
||||
package binfotypes
|
||||
|
||||
import (
|
||||
srctypes "github.com/moby/buildkit/source/types"
|
||||
)
|
||||
|
||||
// ImageConfigField defines the key of build dependencies.
|
||||
const ImageConfigField = "moby.buildkit.buildinfo.v1"
|
||||
|
||||
// ImageConfig defines the structure of build dependencies
|
||||
// inside image config.
|
||||
type ImageConfig struct {
|
||||
BuildInfo string `json:"moby.buildkit.buildinfo.v1,omitempty"`
|
||||
}
|
||||
|
||||
// BuildInfo defines the main structure added to image config as
|
||||
// ImageConfigField key and returned in solver ExporterResponse as
|
||||
// exptypes.ExporterBuildInfo key.
|
||||
type BuildInfo struct {
|
||||
// Frontend defines the frontend used to build.
|
||||
Frontend string `json:"frontend,omitempty"`
|
||||
// Attrs defines build request attributes.
|
||||
Attrs map[string]*string `json:"attrs,omitempty"`
|
||||
// Sources defines build dependencies.
|
||||
Sources []Source `json:"sources,omitempty"`
|
||||
// Deps defines context dependencies.
|
||||
Deps map[string]BuildInfo `json:"deps,omitempty"`
|
||||
}
|
||||
|
||||
// Source defines a build dependency.
|
||||
type Source struct {
|
||||
// Type defines the SourceType source type (docker-image, git, http).
|
||||
Type SourceType `json:"type,omitempty"`
|
||||
// Ref is the reference of the source.
|
||||
Ref string `json:"ref,omitempty"`
|
||||
// Alias is a special field used to match with the actual source ref
|
||||
// because frontend might have already transformed a string user typed
|
||||
// before generating LLB.
|
||||
Alias string `json:"alias,omitempty"`
|
||||
// Pin is the source digest.
|
||||
Pin string `json:"pin,omitempty"`
|
||||
}
|
||||
|
||||
// SourceType contains source type.
|
||||
type SourceType string
|
||||
|
||||
// List of source types.
|
||||
const (
|
||||
SourceTypeDockerImage SourceType = srctypes.DockerImageScheme
|
||||
SourceTypeGit SourceType = srctypes.GitScheme
|
||||
SourceTypeHTTP SourceType = srctypes.HTTPScheme
|
||||
)
|
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)
|
||||
}
|
||||
|
32
vendor/github.com/moby/buildkit/util/imageutil/buildinfo.go
generated
vendored
32
vendor/github.com/moby/buildkit/util/imageutil/buildinfo.go
generated
vendored
@ -1,32 +0,0 @@
|
||||
package imageutil
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
|
||||
binfotypes "github.com/moby/buildkit/util/buildinfo/types"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// BuildInfo returns build info from image config.
|
||||
func BuildInfo(dt []byte) (*binfotypes.BuildInfo, error) {
|
||||
if len(dt) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
var config binfotypes.ImageConfig
|
||||
if err := json.Unmarshal(dt, &config); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal image config")
|
||||
}
|
||||
if len(config.BuildInfo) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
dtbi, err := base64.StdEncoding.DecodeString(config.BuildInfo)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var bi binfotypes.BuildInfo
|
||||
if err = json.Unmarshal(dtbi, &bi); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to decode buildinfo from image config")
|
||||
}
|
||||
return &bi, nil
|
||||
}
|
18
vendor/github.com/moby/buildkit/util/progress/progressui/colors.go
generated
vendored
18
vendor/github.com/moby/buildkit/util/progress/progressui/colors.go
generated
vendored
@ -6,8 +6,8 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/moby/buildkit/util/bklog"
|
||||
"github.com/morikuni/aec"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var termColorMap = map[string]aec.ANSI{
|
||||
@ -41,7 +41,7 @@ func setUserDefinedTermColors(colorsEnv string) {
|
||||
k, v, ok := strings.Cut(field, "=")
|
||||
if !ok || strings.Contains(v, "=") {
|
||||
err := errors.New("A valid entry must have exactly two fields")
|
||||
logrus.WithError(err).Warnf("Could not parse BUILDKIT_COLORS component: %s", field)
|
||||
bklog.L.WithError(err).Warnf("Could not parse BUILDKIT_COLORS component: %s", field)
|
||||
continue
|
||||
}
|
||||
k = strings.ToLower(k)
|
||||
@ -53,7 +53,7 @@ func setUserDefinedTermColors(colorsEnv string) {
|
||||
}
|
||||
} else {
|
||||
err := errors.New("Colors must be a name from the pre-defined list or a valid 3-part RGB value")
|
||||
logrus.WithError(err).Warnf("Unknown color value found in BUILDKIT_COLORS: %s=%s", k, v)
|
||||
bklog.L.WithError(err).Warnf("Unknown color value found in BUILDKIT_COLORS: %s=%s", k, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -63,7 +63,7 @@ func readBuildkitColorsEnv(colorsEnv string) []string {
|
||||
csvReader.Comma = ':'
|
||||
fields, err := csvReader.Read()
|
||||
if err != nil {
|
||||
logrus.WithError(err).Warnf("Could not parse BUILDKIT_COLORS. Falling back to defaults.")
|
||||
bklog.L.WithError(err).Warnf("Could not parse BUILDKIT_COLORS. Falling back to defaults.")
|
||||
return nil
|
||||
}
|
||||
return fields
|
||||
@ -73,12 +73,12 @@ func readRGB(v string) aec.ANSI {
|
||||
csvReader := csv.NewReader(strings.NewReader(v))
|
||||
fields, err := csvReader.Read()
|
||||
if err != nil {
|
||||
logrus.WithError(err).Warnf("Could not parse value %s as valid comma-separated RGB color. Ignoring.", v)
|
||||
bklog.L.WithError(err).Warnf("Could not parse value %s as valid comma-separated RGB color. Ignoring.", v)
|
||||
return nil
|
||||
}
|
||||
if len(fields) != 3 {
|
||||
err = errors.New("A valid RGB color must have three fields")
|
||||
logrus.WithError(err).Warnf("Could not parse value %s as valid RGB color. Ignoring.", v)
|
||||
bklog.L.WithError(err).Warnf("Could not parse value %s as valid RGB color. Ignoring.", v)
|
||||
return nil
|
||||
}
|
||||
ok := isValidRGB(fields)
|
||||
@ -103,7 +103,7 @@ func parseKeys(k string, c aec.ANSI) {
|
||||
case "warning":
|
||||
colorWarning = c
|
||||
default:
|
||||
logrus.Warnf("Unknown key found in BUILDKIT_COLORS (expected: run, cancel, error, or warning): %s", k)
|
||||
bklog.L.Warnf("Unknown key found in BUILDKIT_COLORS (expected: run, cancel, error, or warning): %s", k)
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,14 +111,14 @@ func isValidRGB(s []string) bool {
|
||||
for _, n := range s {
|
||||
num, err := strconv.Atoi(n)
|
||||
if err != nil {
|
||||
logrus.Warnf("A field in BUILDKIT_COLORS appears to contain an RGB value that is not an integer: %s", strings.Join(s, ","))
|
||||
bklog.L.Warnf("A field in BUILDKIT_COLORS appears to contain an RGB value that is not an integer: %s", strings.Join(s, ","))
|
||||
return false
|
||||
}
|
||||
ok := isValidRGBValue(num)
|
||||
if ok {
|
||||
continue
|
||||
} else {
|
||||
logrus.Warnf("A field in BUILDKIT_COLORS appears to contain an RGB value that is not within the valid range of 0-255: %s", strings.Join(s, ","))
|
||||
bklog.L.Warnf("A field in BUILDKIT_COLORS appears to contain an RGB value that is not within the valid range of 0-255: %s", strings.Join(s, ","))
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
4
vendor/github.com/moby/buildkit/util/resolver/limited/group.go
generated
vendored
4
vendor/github.com/moby/buildkit/util/resolver/limited/group.go
generated
vendored
@ -11,8 +11,8 @@ import (
|
||||
"github.com/containerd/containerd/images"
|
||||
"github.com/containerd/containerd/remotes"
|
||||
"github.com/docker/distribution/reference"
|
||||
"github.com/moby/buildkit/util/bklog"
|
||||
ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/sirupsen/logrus"
|
||||
"golang.org/x/sync/semaphore"
|
||||
)
|
||||
|
||||
@ -119,7 +119,7 @@ func (f *fetcher) Fetch(ctx context.Context, desc ocispecs.Descriptor) (io.ReadC
|
||||
rcw := &readCloser{ReadCloser: rc}
|
||||
closer := func() {
|
||||
if !rcw.closed {
|
||||
logrus.Warnf("fetcher not closed cleanly: %s", desc.Digest)
|
||||
bklog.G(ctx).Warnf("fetcher not closed cleanly: %s", desc.Digest)
|
||||
}
|
||||
release()
|
||||
}
|
||||
|
2
vendor/github.com/moby/buildkit/util/stack/stack.go
generated
vendored
2
vendor/github.com/moby/buildkit/util/stack/stack.go
generated
vendored
@ -9,7 +9,7 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/containerd/typeurl"
|
||||
"github.com/containerd/typeurl/v2"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
|
2
vendor/github.com/moby/buildkit/util/tracing/detect/detect.go
generated
vendored
2
vendor/github.com/moby/buildkit/util/tracing/detect/detect.go
generated
vendored
@ -12,7 +12,7 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
sdktrace "go.opentelemetry.io/otel/sdk/trace"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.12.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.17.0"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
|
2
vendor/github.com/moby/buildkit/util/tracing/tracing.go
generated
vendored
2
vendor/github.com/moby/buildkit/util/tracing/tracing.go
generated
vendored
@ -12,7 +12,7 @@ import (
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/codes"
|
||||
"go.opentelemetry.io/otel/propagation"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.12.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.17.0"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user