mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-10 05:27:07 +08:00
vendor: update buildkit to v0.14.0-rc2
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
10
vendor/github.com/moby/buildkit/util/contentutil/buffer.go
generated
vendored
10
vendor/github.com/moby/buildkit/util/contentutil/buffer.go
generated
vendored
@ -9,7 +9,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
cerrdefs "github.com/containerd/errdefs"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/pkg/errors"
|
||||
@ -43,7 +43,7 @@ func (b *buffer) Info(ctx context.Context, dgst digest.Digest) (content.Info, er
|
||||
v, ok := b.infos[dgst]
|
||||
b.mu.Unlock()
|
||||
if !ok {
|
||||
return content.Info{}, errdefs.ErrNotFound
|
||||
return content.Info{}, cerrdefs.ErrNotFound
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
@ -54,7 +54,7 @@ func (b *buffer) Update(ctx context.Context, new content.Info, fieldpaths ...str
|
||||
|
||||
updated, ok := b.infos[new.Digest]
|
||||
if !ok {
|
||||
return content.Info{}, errdefs.ErrNotFound
|
||||
return content.Info{}, cerrdefs.ErrNotFound
|
||||
}
|
||||
|
||||
if len(fieldpaths) == 0 {
|
||||
@ -96,7 +96,7 @@ func (b *buffer) Writer(ctx context.Context, opts ...content.WriterOpt) (content
|
||||
}
|
||||
b.mu.Lock()
|
||||
if _, ok := b.refs[wOpts.Ref]; ok {
|
||||
return nil, errors.Wrapf(errdefs.ErrUnavailable, "ref %s locked", wOpts.Ref)
|
||||
return nil, errors.Wrapf(cerrdefs.ErrUnavailable, "ref %s locked", wOpts.Ref)
|
||||
}
|
||||
b.mu.Unlock()
|
||||
return &bufferedWriter{
|
||||
@ -128,7 +128,7 @@ func (b *buffer) getBytesReader(dgst digest.Digest) (*bytes.Reader, error) {
|
||||
return bytes.NewReader(dt), nil
|
||||
}
|
||||
|
||||
return nil, errors.Wrapf(errdefs.ErrNotFound, "content %v", dgst)
|
||||
return nil, errors.Wrapf(cerrdefs.ErrNotFound, "content %v", dgst)
|
||||
}
|
||||
|
||||
func (b *buffer) addValue(k digest.Digest, dt []byte) {
|
||||
|
6
vendor/github.com/moby/buildkit/util/contentutil/multiprovider.go
generated
vendored
6
vendor/github.com/moby/buildkit/util/contentutil/multiprovider.go
generated
vendored
@ -5,7 +5,7 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
cerrdefs "github.com/containerd/errdefs"
|
||||
"github.com/moby/buildkit/session"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
@ -60,7 +60,7 @@ func (mp *MultiProvider) ReaderAt(ctx context.Context, desc ocispecs.Descriptor)
|
||||
}
|
||||
mp.mu.RUnlock()
|
||||
if mp.base == nil {
|
||||
return nil, errors.Wrapf(errdefs.ErrNotFound, "content %v", desc.Digest)
|
||||
return nil, errors.Wrapf(cerrdefs.ErrNotFound, "content %v", desc.Digest)
|
||||
}
|
||||
return mp.base.ReaderAt(ctx, desc)
|
||||
}
|
||||
@ -74,7 +74,7 @@ func (mp *MultiProvider) Info(ctx context.Context, dgst digest.Digest) (content.
|
||||
}
|
||||
mp.mu.RUnlock()
|
||||
if mp.base == nil {
|
||||
return content.Info{}, errors.Wrapf(errdefs.ErrNotFound, "content %v", dgst)
|
||||
return content.Info{}, errors.Wrapf(cerrdefs.ErrNotFound, "content %v", dgst)
|
||||
}
|
||||
return mp.base.Info(ctx, dgst)
|
||||
}
|
||||
|
6
vendor/github.com/moby/buildkit/util/contentutil/pusher.go
generated
vendored
6
vendor/github.com/moby/buildkit/util/contentutil/pusher.go
generated
vendored
@ -7,8 +7,8 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/remotes"
|
||||
cerrdefs "github.com/containerd/errdefs"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
@ -41,7 +41,7 @@ func (i *pushingIngester) Writer(ctx context.Context, opts ...content.WriterOpt)
|
||||
}
|
||||
}
|
||||
if wOpts.Ref == "" {
|
||||
return nil, errors.Wrap(errdefs.ErrInvalidArgument, "ref must not be empty")
|
||||
return nil, errors.Wrap(cerrdefs.ErrInvalidArgument, "ref must not be empty")
|
||||
}
|
||||
|
||||
st := time.Now()
|
||||
@ -50,7 +50,7 @@ func (i *pushingIngester) Writer(ctx context.Context, opts ...content.WriterOpt)
|
||||
for {
|
||||
if time.Since(st) > time.Hour {
|
||||
i.mu.Unlock()
|
||||
return nil, errors.Wrapf(errdefs.ErrUnavailable, "ref %v locked", wOpts.Desc.Digest)
|
||||
return nil, errors.Wrapf(cerrdefs.ErrUnavailable, "ref %v locked", wOpts.Desc.Digest)
|
||||
}
|
||||
if _, ok := i.active[wOpts.Desc.Digest]; ok {
|
||||
i.c.Wait()
|
||||
|
4
vendor/github.com/moby/buildkit/util/contentutil/refs.go
generated
vendored
4
vendor/github.com/moby/buildkit/util/contentutil/refs.go
generated
vendored
@ -6,9 +6,9 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/remotes"
|
||||
"github.com/containerd/containerd/remotes/docker"
|
||||
cerrdefs "github.com/containerd/errdefs"
|
||||
"github.com/moby/buildkit/version"
|
||||
"github.com/moby/locker"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
@ -70,7 +70,7 @@ func (w *ingester) Writer(ctx context.Context, opts ...content.WriterOpt) (conte
|
||||
}
|
||||
}
|
||||
if wo.Ref == "" {
|
||||
return nil, errors.Wrap(errdefs.ErrInvalidArgument, "ref must not be empty")
|
||||
return nil, errors.Wrap(cerrdefs.ErrInvalidArgument, "ref must not be empty")
|
||||
}
|
||||
w.locker.Lock(wo.Ref)
|
||||
var once sync.Once
|
||||
|
6
vendor/github.com/moby/buildkit/util/gitutil/git_ref.go
generated
vendored
6
vendor/github.com/moby/buildkit/util/gitutil/git_ref.go
generated
vendored
@ -4,7 +4,7 @@ import (
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
cerrdefs "github.com/containerd/errdefs"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
@ -58,7 +58,7 @@ func ParseGitRef(ref string) (*GitRef, error) {
|
||||
)
|
||||
|
||||
if strings.HasPrefix(ref, "./") || strings.HasPrefix(ref, "../") {
|
||||
return nil, errdefs.ErrInvalidArgument
|
||||
return nil, cerrdefs.ErrInvalidArgument
|
||||
} else if strings.HasPrefix(ref, "github.com/") {
|
||||
res.IndistinguishableFromLocal = true // Deprecated
|
||||
remote = fromURL(&url.URL{
|
||||
@ -84,7 +84,7 @@ func ParseGitRef(ref string) (*GitRef, error) {
|
||||
// An HTTP(S) URL is considered to be a valid git ref only when it has the ".git[...]" suffix.
|
||||
case HTTPProtocol, HTTPSProtocol:
|
||||
if !strings.HasSuffix(remote.Path, ".git") {
|
||||
return nil, errdefs.ErrInvalidArgument
|
||||
return nil, cerrdefs.ErrInvalidArgument
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
vendor/github.com/moby/buildkit/util/stack/stack.go
generated
vendored
27
vendor/github.com/moby/buildkit/util/stack/stack.go
generated
vendored
@ -46,22 +46,23 @@ func Helper() {
|
||||
func Traces(err error) []*Stack {
|
||||
var st []*Stack
|
||||
|
||||
wrapped, ok := err.(interface {
|
||||
Unwrap() error
|
||||
})
|
||||
if ok {
|
||||
st = Traces(wrapped.Unwrap())
|
||||
switch e := err.(type) {
|
||||
case interface{ Unwrap() error }:
|
||||
st = Traces(e.Unwrap())
|
||||
case interface{ Unwrap() []error }:
|
||||
for _, ue := range e.Unwrap() {
|
||||
st = Traces(ue)
|
||||
// Only take first stack
|
||||
if len(st) > 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ste, ok := err.(interface {
|
||||
StackTrace() errors.StackTrace
|
||||
}); ok {
|
||||
switch ste := err.(type) {
|
||||
case interface{ StackTrace() errors.StackTrace }:
|
||||
st = append(st, convertStack(ste.StackTrace()))
|
||||
}
|
||||
|
||||
if ste, ok := err.(interface {
|
||||
StackTrace() *Stack
|
||||
}); ok {
|
||||
case interface{ StackTrace() *Stack }:
|
||||
st = append(st, ste.StackTrace())
|
||||
}
|
||||
|
||||
|
30
vendor/github.com/moby/buildkit/util/tracing/tracing.go
generated
vendored
30
vendor/github.com/moby/buildkit/util/tracing/tracing.go
generated
vendored
@ -6,7 +6,6 @@ import (
|
||||
"net/http"
|
||||
"net/http/httptrace"
|
||||
|
||||
"github.com/moby/buildkit/util/bklog"
|
||||
"go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace"
|
||||
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
@ -15,6 +14,11 @@ import (
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.17.0"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
"go.opentelemetry.io/otel/trace/noop"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/moby/buildkit/util/bklog"
|
||||
"github.com/moby/buildkit/util/stack"
|
||||
)
|
||||
|
||||
// StartSpan starts a new span as a child of the span in context.
|
||||
@ -30,14 +34,30 @@ func StartSpan(ctx context.Context, operationName string, opts ...trace.SpanStar
|
||||
return span, ctx
|
||||
}
|
||||
|
||||
func hasStacktrace(err error) bool {
|
||||
switch e := err.(type) {
|
||||
case interface{ StackTrace() *stack.Stack }:
|
||||
return true
|
||||
case interface{ StackTrace() errors.StackTrace }:
|
||||
return true
|
||||
case interface{ Unwrap() error }:
|
||||
return hasStacktrace(e.Unwrap())
|
||||
case interface{ Unwrap() []error }:
|
||||
for _, ue := range e.Unwrap() {
|
||||
if hasStacktrace(ue) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// FinishWithError finalizes the span and sets the error if one is passed
|
||||
func FinishWithError(span trace.Span, err error) {
|
||||
if err != nil {
|
||||
span.RecordError(err)
|
||||
if _, ok := err.(interface {
|
||||
Cause() error
|
||||
}); ok {
|
||||
span.SetAttributes(attribute.String(string(semconv.ExceptionStacktraceKey), fmt.Sprintf("%+v", err)))
|
||||
if hasStacktrace(err) {
|
||||
span.SetAttributes(attribute.String(string(semconv.ExceptionStacktraceKey), fmt.Sprintf("%+v", stack.Formatter(err))))
|
||||
}
|
||||
span.SetStatus(codes.Error, err.Error())
|
||||
}
|
||||
|
Reference in New Issue
Block a user