mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-14 07:27:07 +08:00
vendor: update buildkit to v0.18.0-rc1
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
5
vendor/github.com/containerd/containerd/content/helpers.go
generated
vendored
5
vendor/github.com/containerd/containerd/content/helpers.go
generated
vendored
@ -24,11 +24,12 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/pkg/randutil"
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/containerd/log"
|
||||
"github.com/opencontainers/go-digest"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/pkg/randutil"
|
||||
)
|
||||
|
||||
var ErrReset = errors.New("writer has been reset")
|
||||
|
2
vendor/github.com/containerd/containerd/content/local/locks.go
generated
vendored
2
vendor/github.com/containerd/containerd/content/local/locks.go
generated
vendored
@ -21,7 +21,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
)
|
||||
|
||||
// Handles locking references
|
||||
|
2
vendor/github.com/containerd/containerd/content/local/readerat.go
generated
vendored
2
vendor/github.com/containerd/containerd/content/local/readerat.go
generated
vendored
@ -22,7 +22,7 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
)
|
||||
|
||||
// readerat implements io.ReaderAt in a completely stateless manner by opening
|
||||
|
37
vendor/github.com/containerd/containerd/content/local/store.go
generated
vendored
37
vendor/github.com/containerd/containerd/content/local/store.go
generated
vendored
@ -27,13 +27,14 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/filters"
|
||||
"github.com/containerd/containerd/pkg/randutil"
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/containerd/log"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/filters"
|
||||
"github.com/containerd/containerd/pkg/randutil"
|
||||
|
||||
"github.com/opencontainers/go-digest"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
)
|
||||
@ -66,6 +67,8 @@ type LabelStore interface {
|
||||
type store struct {
|
||||
root string
|
||||
ls LabelStore
|
||||
|
||||
ensureIngestRootOnce func() error
|
||||
}
|
||||
|
||||
// NewStore returns a local content store
|
||||
@ -79,14 +82,13 @@ func NewStore(root string) (content.Store, error) {
|
||||
// require labels and should use `NewStore`. `NewLabeledStore` is primarily
|
||||
// useful for tests or standalone implementations.
|
||||
func NewLabeledStore(root string, ls LabelStore) (content.Store, error) {
|
||||
if err := os.MkdirAll(filepath.Join(root, "ingest"), 0777); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &store{
|
||||
s := &store{
|
||||
root: root,
|
||||
ls: ls,
|
||||
}, nil
|
||||
}
|
||||
|
||||
s.ensureIngestRootOnce = sync.OnceValue(s.ensureIngestRoot)
|
||||
return s, nil
|
||||
}
|
||||
|
||||
func (s *store) Info(ctx context.Context, dgst digest.Digest) (content.Info, error) {
|
||||
@ -293,6 +295,9 @@ func (s *store) Status(ctx context.Context, ref string) (content.Status, error)
|
||||
func (s *store) ListStatuses(ctx context.Context, fs ...string) ([]content.Status, error) {
|
||||
fp, err := os.Open(filepath.Join(s.root, "ingest"))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return nil, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -343,6 +348,9 @@ func (s *store) ListStatuses(ctx context.Context, fs ...string) ([]content.Statu
|
||||
func (s *store) WalkStatusRefs(ctx context.Context, fn func(string) error) error {
|
||||
fp, err := os.Open(filepath.Join(s.root, "ingest"))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@ -544,6 +552,11 @@ func (s *store) writer(ctx context.Context, ref string, total int64, expected di
|
||||
)
|
||||
|
||||
foundValidIngest := false
|
||||
|
||||
if err := s.ensureIngestRootOnce(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// ensure that the ingest path has been created.
|
||||
if err := os.Mkdir(path, 0755); err != nil {
|
||||
if !os.IsExist(err) {
|
||||
@ -654,6 +667,10 @@ func (s *store) ingestPaths(ref string) (string, string, string) {
|
||||
return fp, rp, dp
|
||||
}
|
||||
|
||||
func (s *store) ensureIngestRoot() error {
|
||||
return os.MkdirAll(filepath.Join(s.root, "ingest"), 0777)
|
||||
}
|
||||
|
||||
func readFileString(path string) (string, error) {
|
||||
p, err := os.ReadFile(path)
|
||||
return string(p), err
|
||||
|
5
vendor/github.com/containerd/containerd/content/local/writer.go
generated
vendored
5
vendor/github.com/containerd/containerd/content/local/writer.go
generated
vendored
@ -26,10 +26,11 @@ import (
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/containerd/log"
|
||||
"github.com/opencontainers/go-digest"
|
||||
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
)
|
||||
|
||||
// writer represents a write transaction against the blob store.
|
||||
|
2
vendor/github.com/containerd/containerd/content/proxy/content_store.go
generated
vendored
2
vendor/github.com/containerd/containerd/content/proxy/content_store.go
generated
vendored
@ -22,9 +22,9 @@ import (
|
||||
|
||||
contentapi "github.com/containerd/containerd/api/services/content/v1"
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/protobuf"
|
||||
protobuftypes "github.com/containerd/containerd/protobuf/types"
|
||||
"github.com/containerd/errdefs"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
)
|
||||
|
2
vendor/github.com/containerd/containerd/content/proxy/content_writer.go
generated
vendored
2
vendor/github.com/containerd/containerd/content/proxy/content_writer.go
generated
vendored
@ -23,8 +23,8 @@ import (
|
||||
|
||||
contentapi "github.com/containerd/containerd/api/services/content/v1"
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/protobuf"
|
||||
"github.com/containerd/errdefs"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
)
|
||||
|
||||
|
72
vendor/github.com/containerd/containerd/errdefs/errors.go
generated
vendored
Normal file
72
vendor/github.com/containerd/containerd/errdefs/errors.go
generated
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
Copyright The containerd Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package errdefs defines the common errors used throughout containerd
|
||||
// packages.
|
||||
//
|
||||
// Use with fmt.Errorf to add context to an error.
|
||||
//
|
||||
// To detect an error class, use the IsXXX functions to tell whether an error
|
||||
// is of a certain type.
|
||||
package errdefs
|
||||
|
||||
import (
|
||||
"github.com/containerd/errdefs"
|
||||
)
|
||||
|
||||
// Definitions of common error types used throughout containerd. All containerd
|
||||
// errors returned by most packages will map into one of these errors classes.
|
||||
// Packages should return errors of these types when they want to instruct a
|
||||
// client to take a particular action.
|
||||
//
|
||||
// These errors map closely to grpc errors.
|
||||
var (
|
||||
ErrUnknown = errdefs.ErrUnknown
|
||||
ErrInvalidArgument = errdefs.ErrInvalidArgument
|
||||
ErrNotFound = errdefs.ErrNotFound
|
||||
ErrAlreadyExists = errdefs.ErrAlreadyExists
|
||||
ErrPermissionDenied = errdefs.ErrPermissionDenied
|
||||
ErrResourceExhausted = errdefs.ErrResourceExhausted
|
||||
ErrFailedPrecondition = errdefs.ErrFailedPrecondition
|
||||
ErrConflict = errdefs.ErrConflict
|
||||
ErrNotModified = errdefs.ErrNotModified
|
||||
ErrAborted = errdefs.ErrAborted
|
||||
ErrOutOfRange = errdefs.ErrOutOfRange
|
||||
ErrNotImplemented = errdefs.ErrNotImplemented
|
||||
ErrInternal = errdefs.ErrInternal
|
||||
ErrUnavailable = errdefs.ErrUnavailable
|
||||
ErrDataLoss = errdefs.ErrDataLoss
|
||||
ErrUnauthenticated = errdefs.ErrUnauthenticated
|
||||
|
||||
IsCanceled = errdefs.IsCanceled
|
||||
IsUnknown = errdefs.IsUnknown
|
||||
IsInvalidArgument = errdefs.IsInvalidArgument
|
||||
IsDeadlineExceeded = errdefs.IsDeadlineExceeded
|
||||
IsNotFound = errdefs.IsNotFound
|
||||
IsAlreadyExists = errdefs.IsAlreadyExists
|
||||
IsPermissionDenied = errdefs.IsPermissionDenied
|
||||
IsResourceExhausted = errdefs.IsResourceExhausted
|
||||
IsFailedPrecondition = errdefs.IsFailedPrecondition
|
||||
IsConflict = errdefs.IsConflict
|
||||
IsNotModified = errdefs.IsNotModified
|
||||
IsAborted = errdefs.IsAborted
|
||||
IsOutOfRange = errdefs.IsOutOfRange
|
||||
IsNotImplemented = errdefs.IsNotImplemented
|
||||
IsInternal = errdefs.IsInternal
|
||||
IsUnavailable = errdefs.IsUnavailable
|
||||
IsDataLoss = errdefs.IsDataLoss
|
||||
IsUnauthorized = errdefs.IsUnauthorized
|
||||
)
|
147
vendor/github.com/containerd/containerd/errdefs/grpc.go
generated
vendored
Normal file
147
vendor/github.com/containerd/containerd/errdefs/grpc.go
generated
vendored
Normal file
@ -0,0 +1,147 @@
|
||||
/*
|
||||
Copyright The containerd Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package errdefs
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// ToGRPC will attempt to map the backend containerd error into a grpc error,
|
||||
// using the original error message as a description.
|
||||
//
|
||||
// Further information may be extracted from certain errors depending on their
|
||||
// type.
|
||||
//
|
||||
// If the error is unmapped, the original error will be returned to be handled
|
||||
// by the regular grpc error handling stack.
|
||||
func ToGRPC(err error) error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if isGRPCError(err) {
|
||||
// error has already been mapped to grpc
|
||||
return err
|
||||
}
|
||||
|
||||
switch {
|
||||
case IsInvalidArgument(err):
|
||||
return status.Errorf(codes.InvalidArgument, err.Error())
|
||||
case IsNotFound(err):
|
||||
return status.Errorf(codes.NotFound, err.Error())
|
||||
case IsAlreadyExists(err):
|
||||
return status.Errorf(codes.AlreadyExists, err.Error())
|
||||
case IsFailedPrecondition(err):
|
||||
return status.Errorf(codes.FailedPrecondition, err.Error())
|
||||
case IsUnavailable(err):
|
||||
return status.Errorf(codes.Unavailable, err.Error())
|
||||
case IsNotImplemented(err):
|
||||
return status.Errorf(codes.Unimplemented, err.Error())
|
||||
case IsCanceled(err):
|
||||
return status.Errorf(codes.Canceled, err.Error())
|
||||
case IsDeadlineExceeded(err):
|
||||
return status.Errorf(codes.DeadlineExceeded, err.Error())
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// ToGRPCf maps the error to grpc error codes, assembling the formatting string
|
||||
// and combining it with the target error string.
|
||||
//
|
||||
// This is equivalent to errdefs.ToGRPC(fmt.Errorf("%s: %w", fmt.Sprintf(format, args...), err))
|
||||
func ToGRPCf(err error, format string, args ...interface{}) error {
|
||||
return ToGRPC(fmt.Errorf("%s: %w", fmt.Sprintf(format, args...), err))
|
||||
}
|
||||
|
||||
// FromGRPC returns the underlying error from a grpc service based on the grpc error code
|
||||
func FromGRPC(err error) error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var cls error // divide these into error classes, becomes the cause
|
||||
|
||||
switch code(err) {
|
||||
case codes.InvalidArgument:
|
||||
cls = ErrInvalidArgument
|
||||
case codes.AlreadyExists:
|
||||
cls = ErrAlreadyExists
|
||||
case codes.NotFound:
|
||||
cls = ErrNotFound
|
||||
case codes.Unavailable:
|
||||
cls = ErrUnavailable
|
||||
case codes.FailedPrecondition:
|
||||
cls = ErrFailedPrecondition
|
||||
case codes.Unimplemented:
|
||||
cls = ErrNotImplemented
|
||||
case codes.Canceled:
|
||||
cls = context.Canceled
|
||||
case codes.DeadlineExceeded:
|
||||
cls = context.DeadlineExceeded
|
||||
default:
|
||||
cls = ErrUnknown
|
||||
}
|
||||
|
||||
msg := rebaseMessage(cls, err)
|
||||
if msg != "" {
|
||||
err = fmt.Errorf("%s: %w", msg, cls)
|
||||
} else {
|
||||
err = cls
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// rebaseMessage removes the repeats for an error at the end of an error
|
||||
// string. This will happen when taking an error over grpc then remapping it.
|
||||
//
|
||||
// Effectively, we just remove the string of cls from the end of err if it
|
||||
// appears there.
|
||||
func rebaseMessage(cls error, err error) string {
|
||||
desc := errDesc(err)
|
||||
clss := cls.Error()
|
||||
if desc == clss {
|
||||
return ""
|
||||
}
|
||||
|
||||
return strings.TrimSuffix(desc, ": "+clss)
|
||||
}
|
||||
|
||||
func isGRPCError(err error) bool {
|
||||
_, ok := status.FromError(err)
|
||||
return ok
|
||||
}
|
||||
|
||||
func code(err error) codes.Code {
|
||||
if s, ok := status.FromError(err); ok {
|
||||
return s.Code()
|
||||
}
|
||||
return codes.Unknown
|
||||
}
|
||||
|
||||
func errDesc(err error) string {
|
||||
if s, ok := status.FromError(err); ok {
|
||||
return s.Message()
|
||||
}
|
||||
return err.Error()
|
||||
}
|
2
vendor/github.com/containerd/containerd/filters/parser.go
generated
vendored
2
vendor/github.com/containerd/containerd/filters/parser.go
generated
vendored
@ -20,7 +20,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
)
|
||||
|
||||
/*
|
||||
|
2
vendor/github.com/containerd/containerd/identifiers/validate.go
generated
vendored
2
vendor/github.com/containerd/containerd/identifiers/validate.go
generated
vendored
@ -28,7 +28,7 @@ import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
)
|
||||
|
||||
const (
|
||||
|
9
vendor/github.com/containerd/containerd/images/archive/exporter.go
generated
vendored
9
vendor/github.com/containerd/containerd/images/archive/exporter.go
generated
vendored
@ -26,15 +26,16 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/images"
|
||||
"github.com/containerd/containerd/labels"
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/containerd/log"
|
||||
"github.com/containerd/platforms"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
ocispecs "github.com/opencontainers/image-spec/specs-go"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/images"
|
||||
"github.com/containerd/containerd/labels"
|
||||
)
|
||||
|
||||
type exportOptions struct {
|
||||
|
2
vendor/github.com/containerd/containerd/images/archive/importer.go
generated
vendored
2
vendor/github.com/containerd/containerd/images/archive/importer.go
generated
vendored
@ -29,9 +29,9 @@ import (
|
||||
|
||||
"github.com/containerd/containerd/archive/compression"
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/images"
|
||||
"github.com/containerd/containerd/labels"
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/containerd/log"
|
||||
"github.com/containerd/platforms"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
|
5
vendor/github.com/containerd/containerd/images/handlers.go
generated
vendored
5
vendor/github.com/containerd/containerd/images/handlers.go
generated
vendored
@ -22,12 +22,13 @@ import (
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/containerd/platforms"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"golang.org/x/sync/errgroup"
|
||||
"golang.org/x/sync/semaphore"
|
||||
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
)
|
||||
|
||||
var (
|
||||
|
5
vendor/github.com/containerd/containerd/images/image.go
generated
vendored
5
vendor/github.com/containerd/containerd/images/image.go
generated
vendored
@ -23,12 +23,13 @@ import (
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/containerd/log"
|
||||
"github.com/containerd/platforms"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
)
|
||||
|
||||
// Image provides the model for how containerd views container images.
|
||||
|
2
vendor/github.com/containerd/containerd/images/mediatypes.go
generated
vendored
2
vendor/github.com/containerd/containerd/images/mediatypes.go
generated
vendored
@ -22,7 +22,7 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
)
|
||||
|
||||
|
2
vendor/github.com/containerd/containerd/labels/validate.go
generated
vendored
2
vendor/github.com/containerd/containerd/labels/validate.go
generated
vendored
@ -19,7 +19,7 @@ package labels
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
)
|
||||
|
||||
const (
|
||||
|
2
vendor/github.com/containerd/containerd/namespaces/context.go
generated
vendored
2
vendor/github.com/containerd/containerd/namespaces/context.go
generated
vendored
@ -21,8 +21,8 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/identifiers"
|
||||
"github.com/containerd/errdefs"
|
||||
)
|
||||
|
||||
const (
|
||||
|
5
vendor/github.com/containerd/containerd/remotes/docker/authorizer.go
generated
vendored
5
vendor/github.com/containerd/containerd/remotes/docker/authorizer.go
generated
vendored
@ -25,10 +25,11 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/containerd/log"
|
||||
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/remotes/docker/auth"
|
||||
remoteerrors "github.com/containerd/containerd/remotes/errors"
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/containerd/log"
|
||||
)
|
||||
|
||||
type dockerAuthorizer struct {
|
||||
|
5
vendor/github.com/containerd/containerd/remotes/docker/fetcher.go
generated
vendored
5
vendor/github.com/containerd/containerd/remotes/docker/fetcher.go
generated
vendored
@ -26,11 +26,12 @@ import (
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/containerd/containerd/images"
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/containerd/log"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/images"
|
||||
)
|
||||
|
||||
type dockerFetcher struct {
|
||||
|
3
vendor/github.com/containerd/containerd/remotes/docker/httpreadseeker.go
generated
vendored
3
vendor/github.com/containerd/containerd/remotes/docker/httpreadseeker.go
generated
vendored
@ -21,8 +21,9 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/containerd/log"
|
||||
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
)
|
||||
|
||||
const maxRetry = 3
|
||||
|
11
vendor/github.com/containerd/containerd/remotes/docker/pusher.go
generated
vendored
11
vendor/github.com/containerd/containerd/remotes/docker/pusher.go
generated
vendored
@ -28,14 +28,15 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/images"
|
||||
"github.com/containerd/containerd/remotes"
|
||||
remoteserrors "github.com/containerd/containerd/remotes/errors"
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/containerd/log"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/images"
|
||||
"github.com/containerd/containerd/remotes"
|
||||
remoteserrors "github.com/containerd/containerd/remotes/errors"
|
||||
)
|
||||
|
||||
type dockerPusher struct {
|
||||
|
40
vendor/github.com/containerd/containerd/remotes/docker/resolver.go
generated
vendored
40
vendor/github.com/containerd/containerd/remotes/docker/resolver.go
generated
vendored
@ -25,9 +25,16 @@ import (
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/containerd/log"
|
||||
"github.com/opencontainers/go-digest"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/images"
|
||||
"github.com/containerd/containerd/reference"
|
||||
"github.com/containerd/containerd/remotes"
|
||||
@ -35,10 +42,6 @@ import (
|
||||
remoteerrors "github.com/containerd/containerd/remotes/errors"
|
||||
"github.com/containerd/containerd/tracing"
|
||||
"github.com/containerd/containerd/version"
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/containerd/log"
|
||||
"github.com/opencontainers/go-digest"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -716,13 +719,18 @@ func NewHTTPFallback(transport http.RoundTripper) http.RoundTripper {
|
||||
type httpFallback struct {
|
||||
super http.RoundTripper
|
||||
host string
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
func (f *httpFallback) RoundTrip(r *http.Request) (*http.Response, error) {
|
||||
f.mu.Lock()
|
||||
fallback := f.host == r.URL.Host
|
||||
f.mu.Unlock()
|
||||
|
||||
// only fall back if the same host had previously fell back
|
||||
if f.host != r.URL.Host {
|
||||
if !fallback {
|
||||
resp, err := f.super.RoundTrip(r)
|
||||
if !isTLSError(err) {
|
||||
if !isTLSError(err) && !isPortError(err, r.URL.Host) {
|
||||
return resp, err
|
||||
}
|
||||
}
|
||||
@ -733,8 +741,12 @@ func (f *httpFallback) RoundTrip(r *http.Request) (*http.Response, error) {
|
||||
plainHTTPRequest := *r
|
||||
plainHTTPRequest.URL = &plainHTTPUrl
|
||||
|
||||
if f.host != r.URL.Host {
|
||||
f.host = r.URL.Host
|
||||
if !fallback {
|
||||
f.mu.Lock()
|
||||
if f.host != r.URL.Host {
|
||||
f.host = r.URL.Host
|
||||
}
|
||||
f.mu.Unlock()
|
||||
|
||||
// update body on the second attempt
|
||||
if r.Body != nil && r.GetBody != nil {
|
||||
@ -764,6 +776,18 @@ func isTLSError(err error) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func isPortError(err error, host string) bool {
|
||||
if isConnError(err) || os.IsTimeout(err) {
|
||||
if _, port, _ := net.SplitHostPort(host); port != "" {
|
||||
// Port is specified, will not retry on different port with scheme change
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// HTTPFallback is an http.RoundTripper which allows fallback from https to http
|
||||
// for registry endpoints with configurations for both http and TLS, such as
|
||||
// defaulted localhost endpoints.
|
||||
|
28
vendor/github.com/containerd/containerd/remotes/docker/resolver_unix.go
generated
vendored
Normal file
28
vendor/github.com/containerd/containerd/remotes/docker/resolver_unix.go
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
//go:build !windows
|
||||
|
||||
/*
|
||||
Copyright The containerd Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package docker
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func isConnError(err error) bool {
|
||||
return errors.Is(err, syscall.ECONNREFUSED)
|
||||
}
|
30
vendor/github.com/containerd/containerd/remotes/docker/resolver_windows.go
generated
vendored
Normal file
30
vendor/github.com/containerd/containerd/remotes/docker/resolver_windows.go
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
//go:build windows
|
||||
|
||||
/*
|
||||
Copyright The containerd Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package docker
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"syscall"
|
||||
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
func isConnError(err error) bool {
|
||||
return errors.Is(err, syscall.ECONNREFUSED) || errors.Is(err, windows.WSAECONNREFUSED)
|
||||
}
|
13
vendor/github.com/containerd/containerd/remotes/docker/schema1/converter.go
generated
vendored
13
vendor/github.com/containerd/containerd/remotes/docker/schema1/converter.go
generated
vendored
@ -32,17 +32,18 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/archive/compression"
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/images"
|
||||
"github.com/containerd/containerd/labels"
|
||||
"github.com/containerd/containerd/remotes"
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/containerd/log"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
specs "github.com/opencontainers/image-spec/specs-go"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
"github.com/containerd/containerd/archive/compression"
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/images"
|
||||
"github.com/containerd/containerd/labels"
|
||||
"github.com/containerd/containerd/remotes"
|
||||
)
|
||||
|
||||
const (
|
||||
|
2
vendor/github.com/containerd/containerd/remotes/docker/status.go
generated
vendored
2
vendor/github.com/containerd/containerd/remotes/docker/status.go
generated
vendored
@ -21,7 +21,7 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/moby/locker"
|
||||
)
|
||||
|
||||
|
9
vendor/github.com/containerd/containerd/remotes/handlers.go
generated
vendored
9
vendor/github.com/containerd/containerd/remotes/handlers.go
generated
vendored
@ -25,14 +25,15 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/images"
|
||||
"github.com/containerd/containerd/labels"
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/containerd/log"
|
||||
"github.com/containerd/platforms"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"golang.org/x/sync/semaphore"
|
||||
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/images"
|
||||
"github.com/containerd/containerd/labels"
|
||||
)
|
||||
|
||||
type refKeyPrefix struct{}
|
||||
|
11
vendor/github.com/containerd/containerd/services/content/contentserver/contentserver.go
generated
vendored
11
vendor/github.com/containerd/containerd/services/content/contentserver/contentserver.go
generated
vendored
@ -22,17 +22,18 @@ import (
|
||||
"io"
|
||||
"sync"
|
||||
|
||||
api "github.com/containerd/containerd/api/services/content/v1"
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/protobuf"
|
||||
ptypes "github.com/containerd/containerd/protobuf/types"
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/containerd/log"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
api "github.com/containerd/containerd/api/services/content/v1"
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/protobuf"
|
||||
ptypes "github.com/containerd/containerd/protobuf/types"
|
||||
)
|
||||
|
||||
type service struct {
|
||||
|
2
vendor/github.com/containerd/containerd/version/version.go
generated
vendored
2
vendor/github.com/containerd/containerd/version/version.go
generated
vendored
@ -23,7 +23,7 @@ var (
|
||||
Package = "github.com/containerd/containerd"
|
||||
|
||||
// Version holds the complete version number. Filled in at linking time.
|
||||
Version = "1.7.22+unknown"
|
||||
Version = "1.7.24+unknown"
|
||||
|
||||
// Revision is filled with the VCS (e.g. git) revision being used to build
|
||||
// the program at linking time.
|
||||
|
Reference in New Issue
Block a user