1
0
mirror of https://github.com/moby/buildkit.git synced 2025-07-29 04:01:13 +03:00

vendor: github.com/containerd/containerd v1.7.18

Update to containerd 1.7.18, which now migrated to the errdefs module. The
existing errdefs package is now an alias for the module, and should no longer
be used directly.

This patch:

- updates the containerd dependency: https://github.com/containerd/containerd/compare/v1.7.17...v1.7.18
- replaces uses of the old package in favor of the new module
- adds a linter check to prevent accidental re-introduction of the old package
- adds a linter check to enforce using an alias, to prevent accidental use
  of the errdefs package in BuildKit or Moby.
- adds a linter check to prevent using the "log" package, which was also
  migrated to a separate module.

There are still some uses of the old package in (indirect) dependencies,
which should go away over time.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2024-05-28 13:27:13 +02:00
parent f9b730c753
commit 0f89a763aa
129 changed files with 571 additions and 384 deletions

View File

@ -48,8 +48,10 @@ linters-settings:
rules: rules:
main: main:
deny: deny:
# The io/ioutil package has been deprecated. - pkg: "github.com/containerd/containerd/errdefs"
# https://go.dev/doc/go1.16#ioutil desc: The containerd errdefs package was migrated to a separate module. Use github.com/containerd/errdefs instead.
- pkg: "github.com/containerd/containerd/log"
desc: The containerd log package was migrated to a separate module. Use github.com/containerd/log instead.
- pkg: "io/ioutil" - pkg: "io/ioutil"
desc: The io/ioutil package has been deprecated. desc: The io/ioutil package has been deprecated.
forbidigo: forbidigo:
@ -62,10 +64,16 @@ linters-settings:
- '^ctx\.Err(# use context\.Cause instead)?$' - '^ctx\.Err(# use context\.Cause instead)?$'
importas: importas:
alias: alias:
# Enforce alias to prevent it accidentally being used instead of our
# own errdefs package (or vice-versa).
- pkg: "github.com/containerd/errdefs"
alias: "cerrdefs"
- pkg: "github.com/opencontainers/image-spec/specs-go/v1" - pkg: "github.com/opencontainers/image-spec/specs-go/v1"
alias: "ocispecs" alias: "ocispecs"
- pkg: "github.com/opencontainers/go-digest" - pkg: "github.com/opencontainers/go-digest"
alias: "digest" alias: "digest"
# Do not allow unaliased imports of aliased packages.
no-unaliased: true no-unaliased: true
gosec: gosec:
excludes: excludes:

View File

@ -9,9 +9,9 @@ import (
"io" "io"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
labelspkg "github.com/containerd/containerd/labels" labelspkg "github.com/containerd/containerd/labels"
"github.com/containerd/containerd/mount" "github.com/containerd/containerd/mount"
cerrdefs "github.com/containerd/errdefs"
"github.com/moby/buildkit/util/bklog" "github.com/moby/buildkit/util/bklog"
"github.com/moby/buildkit/util/compression" "github.com/moby/buildkit/util/compression"
"github.com/moby/buildkit/util/overlay" "github.com/moby/buildkit/util/overlay"
@ -98,7 +98,7 @@ func (sr *immutableRef) tryComputeOverlayBlob(ctx context.Context, lower, upper
} }
dgst := cw.Digest() dgst := cw.Digest()
if err := cw.Commit(ctx, 0, dgst, commitopts...); err != nil { if err := cw.Commit(ctx, 0, dgst, commitopts...); err != nil {
if !errdefs.IsAlreadyExists(err) { if !cerrdefs.IsAlreadyExists(err) {
return emptyDesc, false, errors.Wrap(err, "failed to commit") return emptyDesc, false, errors.Wrap(err, "failed to commit")
} }
} }

View File

@ -9,8 +9,8 @@ import (
"io" "io"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/labels" "github.com/containerd/containerd/labels"
cerrdefs "github.com/containerd/errdefs"
"github.com/moby/buildkit/session" "github.com/moby/buildkit/session"
"github.com/moby/buildkit/util/compression" "github.com/moby/buildkit/util/compression"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
@ -95,7 +95,7 @@ func MergeNydus(ctx context.Context, ref ImmutableRef, comp compression.Config,
if err := cw.Commit(ctx, 0, compressedDgst, content.WithLabels(map[string]string{ if err := cw.Commit(ctx, 0, compressedDgst, content.WithLabels(map[string]string{
labels.LabelUncompressed: uncompressedDgst.Digest().String(), labels.LabelUncompressed: uncompressedDgst.Digest().String(),
})); err != nil { })); err != nil {
if !errdefs.IsAlreadyExists(err) { if !cerrdefs.IsAlreadyExists(err) {
return nil, errors.Wrap(err, "commit to content store") return nil, errors.Wrap(err, "commit to content store")
} }
} }

10
cache/manager.go vendored
View File

@ -10,11 +10,11 @@ import (
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/diff" "github.com/containerd/containerd/diff"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/filters" "github.com/containerd/containerd/filters"
"github.com/containerd/containerd/gc" "github.com/containerd/containerd/gc"
"github.com/containerd/containerd/labels" "github.com/containerd/containerd/labels"
"github.com/containerd/containerd/leases" "github.com/containerd/containerd/leases"
cerrdefs "github.com/containerd/errdefs"
"github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/idtools"
"github.com/moby/buildkit/cache/metadata" "github.com/moby/buildkit/cache/metadata"
"github.com/moby/buildkit/client" "github.com/moby/buildkit/client"
@ -137,7 +137,7 @@ func (cm *cacheManager) GetByBlob(ctx context.Context, desc ocispecs.Descriptor,
descHandlers := descHandlersOf(opts...) descHandlers := descHandlersOf(opts...)
if desc.Digest != "" && (descHandlers == nil || descHandlers[desc.Digest] == nil) { if desc.Digest != "" && (descHandlers == nil || descHandlers[desc.Digest] == nil) {
if _, err := cm.ContentStore.Info(ctx, desc.Digest); errors.Is(err, errdefs.ErrNotFound) { if _, err := cm.ContentStore.Info(ctx, desc.Digest); errors.Is(err, cerrdefs.ErrNotFound) {
return nil, NeedsRemoteProviderError([]digest.Digest{desc.Digest}) return nil, NeedsRemoteProviderError([]digest.Digest{desc.Digest})
} else if err != nil { } else if err != nil {
return nil, err return nil, err
@ -253,7 +253,7 @@ func (cm *cacheManager) GetByBlob(ctx context.Context, desc ocispecs.Descriptor,
if err := cm.LeaseManager.AddResource(ctx, l, leases.Resource{ if err := cm.LeaseManager.AddResource(ctx, l, leases.Resource{
ID: snapshotID, ID: snapshotID,
Type: "snapshots/" + cm.Snapshotter.Name(), Type: "snapshots/" + cm.Snapshotter.Name(),
}); err != nil && !errdefs.IsAlreadyExists(err) { }); err != nil && !cerrdefs.IsAlreadyExists(err) {
return nil, errors.Wrapf(err, "failed to add snapshot %s to lease", id) return nil, errors.Wrapf(err, "failed to add snapshot %s to lease", id)
} }
@ -484,7 +484,7 @@ func (cm *cacheManager) getRecord(ctx context.Context, id string, opts ...RefOpt
if rec.mutable { if rec.mutable {
// If the record is mutable, then the snapshot must exist // If the record is mutable, then the snapshot must exist
if _, err := cm.Snapshotter.Stat(ctx, rec.ID()); err != nil { if _, err := cm.Snapshotter.Stat(ctx, rec.ID()); err != nil {
if !errdefs.IsNotFound(err) { if !cerrdefs.IsNotFound(err) {
return nil, errors.Wrap(err, "failed to check mutable ref snapshot") return nil, errors.Wrap(err, "failed to check mutable ref snapshot")
} }
// the snapshot doesn't exist, clear this record // the snapshot doesn't exist, clear this record
@ -609,7 +609,7 @@ func (cm *cacheManager) New(ctx context.Context, s ImmutableRef, sess session.Gr
if err := cm.LeaseManager.AddResource(ctx, l, leases.Resource{ if err := cm.LeaseManager.AddResource(ctx, l, leases.Resource{
ID: snapshotID, ID: snapshotID,
Type: "snapshots/" + cm.Snapshotter.Name(), Type: "snapshots/" + cm.Snapshotter.Name(),
}); err != nil && !errdefs.IsAlreadyExists(err) { }); err != nil && !cerrdefs.IsAlreadyExists(err) {
return nil, errors.Wrapf(err, "failed to add snapshot %s to lease", snapshotID) return nil, errors.Wrapf(err, "failed to add snapshot %s to lease", snapshotID)
} }

View File

@ -24,7 +24,6 @@ import (
"github.com/containerd/containerd/content/local" "github.com/containerd/containerd/content/local"
"github.com/containerd/containerd/diff/apply" "github.com/containerd/containerd/diff/apply"
"github.com/containerd/containerd/diff/walking" "github.com/containerd/containerd/diff/walking"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/labels" "github.com/containerd/containerd/labels"
"github.com/containerd/containerd/leases" "github.com/containerd/containerd/leases"
ctdmetadata "github.com/containerd/containerd/metadata" ctdmetadata "github.com/containerd/containerd/metadata"
@ -33,6 +32,7 @@ import (
"github.com/containerd/containerd/snapshots" "github.com/containerd/containerd/snapshots"
"github.com/containerd/containerd/snapshots/native" "github.com/containerd/containerd/snapshots/native"
"github.com/containerd/continuity/fs/fstest" "github.com/containerd/continuity/fs/fstest"
cerrdefs "github.com/containerd/errdefs"
"github.com/containerd/stargz-snapshotter/estargz" "github.com/containerd/stargz-snapshotter/estargz"
"github.com/klauspost/compress/zstd" "github.com/klauspost/compress/zstd"
"github.com/moby/buildkit/cache/config" "github.com/moby/buildkit/cache/config"
@ -1196,7 +1196,7 @@ func TestLoopLeaseContent(t *testing.T) {
dgst := cur.Digest dgst := cur.Digest
visited[dgst] = struct{}{} visited[dgst] = struct{}{}
info, err := co.cs.Info(ctx, dgst) info, err := co.cs.Info(ctx, dgst)
if err != nil && !errors.Is(err, errdefs.ErrNotFound) { if err != nil && !errors.Is(err, cerrdefs.ErrNotFound) {
require.NoError(t, err) require.NoError(t, err)
} }
var children []ocispecs.Descriptor var children []ocispecs.Descriptor
@ -1232,7 +1232,7 @@ func TestLoopLeaseContent(t *testing.T) {
// Check if contents are cleaned up // Check if contents are cleaned up
for _, d := range gotChain { for _, d := range gotChain {
_, err := co.cs.Info(ctx, d) _, err := co.cs.Info(ctx, d)
require.ErrorIs(t, err, errdefs.ErrNotFound) require.ErrorIs(t, err, cerrdefs.ErrNotFound)
} }
} }
@ -2005,7 +2005,7 @@ func checkDescriptor(ctx context.Context, t *testing.T, cs content.Store, desc o
// Check annotation values are valid // Check annotation values are valid
c := new(iohelper.Counter) c := new(iohelper.Counter)
ra, err := cs.ReaderAt(ctx, desc) ra, err := cs.ReaderAt(ctx, desc)
if err != nil && errdefs.IsNotFound(err) { if err != nil && cerrdefs.IsNotFound(err) {
return // lazy layer return // lazy layer
} }
require.NoError(t, err) require.NoError(t, err)

8
cache/migrate_v2.go vendored
View File

@ -7,10 +7,10 @@ import (
"time" "time"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/leases" "github.com/containerd/containerd/leases"
"github.com/containerd/containerd/snapshots" "github.com/containerd/containerd/snapshots"
cerrdefs "github.com/containerd/errdefs"
"github.com/moby/buildkit/cache/metadata" "github.com/moby/buildkit/cache/metadata"
"github.com/moby/buildkit/snapshot" "github.com/moby/buildkit/snapshot"
"github.com/moby/buildkit/util/bklog" "github.com/moby/buildkit/util/bklog"
@ -185,7 +185,7 @@ func MigrateV2(ctx context.Context, from, to string, cs content.Store, s snapsho
}) })
if err != nil { if err != nil {
// if we are running the migration twice // if we are running the migration twice
if errors.Is(err, errdefs.ErrAlreadyExists) { if errors.Is(err, cerrdefs.ErrAlreadyExists) {
continue continue
} }
return errors.Wrap(err, "failed to create lease") return errors.Wrap(err, "failed to create lease")
@ -216,7 +216,7 @@ func MigrateV2(ctx context.Context, from, to string, cs content.Store, s snapsho
if _, err := s.Update(ctx, snapshots.Info{ if _, err := s.Update(ctx, snapshots.Info{
Name: md.getSnapshotID(), Name: md.getSnapshotID(),
}, "labels.containerd.io/gc.root"); err != nil { }, "labels.containerd.io/gc.root"); err != nil {
if !errors.Is(err, errdefs.ErrNotFound) { if !errors.Is(err, cerrdefs.ErrNotFound) {
return err return err
} }
} }
@ -237,7 +237,7 @@ func MigrateV2(ctx context.Context, from, to string, cs content.Store, s snapsho
if _, err := s.Update(ctx, snapshots.Info{ if _, err := s.Update(ctx, snapshots.Info{
Name: info.Name, Name: info.Name,
}, "labels.containerd.io/gc.root"); err != nil { }, "labels.containerd.io/gc.root"); err != nil {
if !errors.Is(err, errdefs.ErrNotFound) { if !errors.Is(err, cerrdefs.ErrNotFound) {
return err return err
} }
} }

34
cache/refs.go vendored
View File

@ -10,13 +10,13 @@ import (
"time" "time"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/labels" "github.com/containerd/containerd/labels"
"github.com/containerd/containerd/leases" "github.com/containerd/containerd/leases"
"github.com/containerd/containerd/mount" "github.com/containerd/containerd/mount"
"github.com/containerd/containerd/pkg/userns" "github.com/containerd/containerd/pkg/userns"
"github.com/containerd/containerd/snapshots" "github.com/containerd/containerd/snapshots"
cerrdefs "github.com/containerd/errdefs"
"github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/idtools"
"github.com/hashicorp/go-multierror" "github.com/hashicorp/go-multierror"
"github.com/moby/buildkit/cache/config" "github.com/moby/buildkit/cache/config"
@ -292,7 +292,7 @@ func (cr *cacheRecord) isLazy(ctx context.Context) (bool, error) {
return false, nil return false, nil
} }
_, err := cr.cm.ContentStore.Info(ctx, dgst) _, err := cr.cm.ContentStore.Info(ctx, dgst)
if errors.Is(err, errdefs.ErrNotFound) { if errors.Is(err, cerrdefs.ErrNotFound) {
return true, nil return true, nil
} else if err != nil { } else if err != nil {
return false, err return false, err
@ -349,7 +349,7 @@ func (cr *cacheRecord) size(ctx context.Context) (int64, error) {
if isDead { if isDead {
return 0, nil return 0, nil
} }
if !errors.Is(err, errdefs.ErrNotFound) { if !errors.Is(err, cerrdefs.ErrNotFound) {
return s, errors.Wrapf(err, "failed to get usage for %s", cr.ID()) return s, errors.Wrapf(err, "failed to get usage for %s", cr.ID())
} }
} }
@ -401,7 +401,7 @@ func (cr *cacheRecord) mount(ctx context.Context) (_ snapshot.Mountable, rerr er
"containerd.io/gc.flat": time.Now().UTC().Format(time.RFC3339Nano), "containerd.io/gc.flat": time.Now().UTC().Format(time.RFC3339Nano),
} }
return nil return nil
}, leaseutil.MakeTemporary); err != nil && !errdefs.IsAlreadyExists(err) { }, leaseutil.MakeTemporary); err != nil && !cerrdefs.IsAlreadyExists(err) {
return nil, err return nil, err
} }
defer func() { defer func() {
@ -412,14 +412,14 @@ func (cr *cacheRecord) mount(ctx context.Context) (_ snapshot.Mountable, rerr er
if err := cr.cm.LeaseManager.AddResource(ctx, leases.Lease{ID: cr.viewLeaseID()}, leases.Resource{ if err := cr.cm.LeaseManager.AddResource(ctx, leases.Lease{ID: cr.viewLeaseID()}, leases.Resource{
ID: mountSnapshotID, ID: mountSnapshotID,
Type: "snapshots/" + cr.cm.Snapshotter.Name(), Type: "snapshots/" + cr.cm.Snapshotter.Name(),
}); err != nil && !errdefs.IsAlreadyExists(err) { }); err != nil && !cerrdefs.IsAlreadyExists(err) {
return nil, err return nil, err
} }
// Return the mount direct from View rather than setting it using the Mounts call below. // Return the mount direct from View rather than setting it using the Mounts call below.
// The two are equivalent for containerd snapshotters but the moby snapshotter requires // The two are equivalent for containerd snapshotters but the moby snapshotter requires
// the use of the mountable returned by View in this case. // the use of the mountable returned by View in this case.
mnts, err := cr.cm.Snapshotter.View(ctx, mountSnapshotID, cr.getSnapshotID()) mnts, err := cr.cm.Snapshotter.View(ctx, mountSnapshotID, cr.getSnapshotID())
if err != nil && !errdefs.IsAlreadyExists(err) { if err != nil && !cerrdefs.IsAlreadyExists(err) {
return nil, err return nil, err
} }
cr.mountCache = mnts cr.mountCache = mnts
@ -455,12 +455,12 @@ func (cr *cacheRecord) remove(ctx context.Context, removeSnapshot bool) (rerr er
if removeSnapshot { if removeSnapshot {
if err := cr.cm.LeaseManager.Delete(ctx, leases.Lease{ if err := cr.cm.LeaseManager.Delete(ctx, leases.Lease{
ID: cr.ID(), ID: cr.ID(),
}); err != nil && !errdefs.IsNotFound(err) { }); err != nil && !cerrdefs.IsNotFound(err) {
return errors.Wrapf(err, "failed to delete lease for %s", cr.ID()) return errors.Wrapf(err, "failed to delete lease for %s", cr.ID())
} }
if err := cr.cm.LeaseManager.Delete(ctx, leases.Lease{ if err := cr.cm.LeaseManager.Delete(ctx, leases.Lease{
ID: cr.compressionVariantsLeaseID(), ID: cr.compressionVariantsLeaseID(),
}); err != nil && !errdefs.IsNotFound(err) { }); err != nil && !cerrdefs.IsNotFound(err) {
return errors.Wrapf(err, "failed to delete compression variant lease for %s", cr.ID()) return errors.Wrapf(err, "failed to delete compression variant lease for %s", cr.ID())
} }
} }
@ -764,7 +764,7 @@ func (sr *immutableRef) linkBlob(ctx context.Context, desc ocispecs.Descriptor)
l.ID = sr.compressionVariantsLeaseID() l.ID = sr.compressionVariantsLeaseID()
// do not make it flat lease to allow linking blobs using gc label // do not make it flat lease to allow linking blobs using gc label
return nil return nil
}); err != nil && !errdefs.IsAlreadyExists(err) { }); err != nil && !cerrdefs.IsAlreadyExists(err) {
return err return err
} }
if err := sr.cm.LeaseManager.AddResource(ctx, leases.Lease{ID: sr.compressionVariantsLeaseID()}, leases.Resource{ if err := sr.cm.LeaseManager.AddResource(ctx, leases.Lease{ID: sr.compressionVariantsLeaseID()}, leases.Resource{
@ -828,7 +828,7 @@ func getBlobWithCompression(ctx context.Context, cs content.Store, desc ocispecs
} }
return true return true
}); err != nil || target == nil { }); err != nil || target == nil {
return ocispecs.Descriptor{}, errdefs.ErrNotFound return ocispecs.Descriptor{}, cerrdefs.ErrNotFound
} }
return *target, nil return *target, nil
} }
@ -849,7 +849,7 @@ func walkBlobVariantsOnly(ctx context.Context, cs content.Store, dgst digest.Dig
} }
visited[dgst] = struct{}{} visited[dgst] = struct{}{}
info, err := cs.Info(ctx, dgst) info, err := cs.Info(ctx, dgst)
if errors.Is(err, errdefs.ErrNotFound) { if errors.Is(err, cerrdefs.ErrNotFound) {
return true, nil return true, nil
} else if err != nil { } else if err != nil {
return false, err return false, err
@ -1025,9 +1025,9 @@ func (sr *immutableRef) withRemoteSnapshotLabelsStargzMode(ctx context.Context,
for _, r := range sr.layerChain() { for _, r := range sr.layerChain() {
r := r r := r
info, err := r.cm.Snapshotter.Stat(ctx, r.getSnapshotID()) info, err := r.cm.Snapshotter.Stat(ctx, r.getSnapshotID())
if err != nil && !errdefs.IsNotFound(err) { if err != nil && !cerrdefs.IsNotFound(err) {
return err return err
} else if errdefs.IsNotFound(err) { } else if cerrdefs.IsNotFound(err) {
continue // This snpashot doesn't exist; skip continue // This snpashot doesn't exist; skip
} else if _, ok := info.Labels["containerd.io/snapshot/remote"]; !ok { } else if _, ok := info.Labels["containerd.io/snapshot/remote"]; !ok {
continue // This isn't a remote snapshot; skip continue // This isn't a remote snapshot; skip
@ -1100,7 +1100,7 @@ func (sr *immutableRef) prepareRemoteSnapshotsStargzMode(ctx context.Context, s
parentID = r.layerParent.getSnapshotID() parentID = r.layerParent.getSnapshotID()
} }
if err := r.cm.Snapshotter.Prepare(ctx, key, parentID, opts...); err != nil { if err := r.cm.Snapshotter.Prepare(ctx, key, parentID, opts...); err != nil {
if errdefs.IsAlreadyExists(err) { if cerrdefs.IsAlreadyExists(err) {
// Check if the targeting snapshot ID has been prepared as // Check if the targeting snapshot ID has been prepared as
// a remote snapshot in the snapshotter. // a remote snapshot in the snapshotter.
info, err := r.cm.Snapshotter.Stat(ctx, snapshotID) info, err := r.cm.Snapshotter.Stat(ctx, snapshotID)
@ -1332,7 +1332,7 @@ func (sr *immutableRef) unlazyLayer(ctx context.Context, dhs DescHandlers, pg pr
return err return err
} }
if err := sr.cm.Snapshotter.Commit(ctx, sr.getSnapshotID(), key); err != nil { if err := sr.cm.Snapshotter.Commit(ctx, sr.getSnapshotID(), key); err != nil {
if !errors.Is(err, errdefs.ErrAlreadyExists) { if !errors.Is(err, cerrdefs.ErrAlreadyExists) {
return err return err
} }
} }
@ -1391,7 +1391,7 @@ func (sr *immutableRef) release(ctx context.Context) (rerr error) {
if sr.equalMutable != nil { if sr.equalMutable != nil {
sr.equalMutable.release(ctx) sr.equalMutable.release(ctx)
} else { } else {
if err := sr.cm.LeaseManager.Delete(ctx, leases.Lease{ID: sr.viewLeaseID()}); err != nil && !errdefs.IsNotFound(err) { if err := sr.cm.LeaseManager.Delete(ctx, leases.Lease{ID: sr.viewLeaseID()}); err != nil && !cerrdefs.IsNotFound(err) {
return err return err
} }
sr.mountCache = nil sr.mountCache = nil
@ -1422,7 +1422,7 @@ func (cr *cacheRecord) finalize(ctx context.Context) error {
return nil return nil
}) })
if err != nil { if err != nil {
if !errors.Is(err, errdefs.ErrAlreadyExists) { // migrator adds leases for everything if !errors.Is(err, cerrdefs.ErrAlreadyExists) { // migrator adds leases for everything
return errors.Wrap(err, "failed to create lease") return errors.Wrap(err, "failed to create lease")
} }
} }

6
cache/remote.go vendored
View File

@ -7,8 +7,8 @@ import (
"strings" "strings"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/reference" "github.com/containerd/containerd/reference"
cerrdefs "github.com/containerd/errdefs"
"github.com/moby/buildkit/cache/config" "github.com/moby/buildkit/cache/config"
"github.com/moby/buildkit/session" "github.com/moby/buildkit/session"
"github.com/moby/buildkit/solver" "github.com/moby/buildkit/solver"
@ -301,7 +301,7 @@ type lazyRefProvider struct {
func (p lazyRefProvider) ReaderAt(ctx context.Context, desc ocispecs.Descriptor) (content.ReaderAt, error) { func (p lazyRefProvider) ReaderAt(ctx context.Context, desc ocispecs.Descriptor) (content.ReaderAt, error) {
if desc.Digest != p.desc.Digest { if desc.Digest != p.desc.Digest {
return nil, errdefs.ErrNotFound return nil, cerrdefs.ErrNotFound
} }
if err := p.Unlazy(ctx); err != nil { if err := p.Unlazy(ctx); err != nil {
return nil, err return nil, err
@ -311,7 +311,7 @@ func (p lazyRefProvider) ReaderAt(ctx context.Context, desc ocispecs.Descriptor)
func (p lazyRefProvider) Info(ctx context.Context, dgst digest.Digest) (content.Info, error) { func (p lazyRefProvider) Info(ctx context.Context, dgst digest.Digest) (content.Info, error) {
if dgst != p.desc.Digest { if dgst != p.desc.Digest {
return content.Info{}, errdefs.ErrNotFound return content.Info{}, cerrdefs.ErrNotFound
} }
info, err := p.ref.cm.ContentStore.Info(ctx, dgst) info, err := p.ref.cm.ContentStore.Info(ctx, dgst)
if err == nil { if err == nil {

View File

@ -30,13 +30,13 @@ import (
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/content/local" "github.com/containerd/containerd/content/local"
"github.com/containerd/containerd/content/proxy" "github.com/containerd/containerd/content/proxy"
ctderrdefs "github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/namespaces"
"github.com/containerd/containerd/platforms" "github.com/containerd/containerd/platforms"
"github.com/containerd/containerd/remotes/docker" "github.com/containerd/containerd/remotes/docker"
"github.com/containerd/containerd/snapshots" "github.com/containerd/containerd/snapshots"
"github.com/containerd/continuity/fs/fstest" "github.com/containerd/continuity/fs/fstest"
cerrdefs "github.com/containerd/errdefs"
"github.com/distribution/reference" "github.com/distribution/reference"
intoto "github.com/in-toto/in-toto-golang/in_toto" intoto "github.com/in-toto/in-toto-golang/in_toto"
controlapi "github.com/moby/buildkit/api/services/control" controlapi "github.com/moby/buildkit/api/services/control"
@ -492,12 +492,12 @@ func testExportedImageLabels(t *testing.T, sb integration.Sandbox) {
// layers should be deleted // layers should be deleted
_, err = store.Info(ctx, mfst.Layers[1].Digest) _, err = store.Info(ctx, mfst.Layers[1].Digest)
require.Error(t, err) require.Error(t, err)
require.True(t, errors.Is(err, ctderrdefs.ErrNotFound)) require.True(t, errors.Is(err, cerrdefs.ErrNotFound))
// config should be deleted // config should be deleted
_, err = store.Info(ctx, mfst.Config.Digest) _, err = store.Info(ctx, mfst.Config.Digest)
require.Error(t, err) require.Error(t, err)
require.True(t, errors.Is(err, ctderrdefs.ErrNotFound)) require.True(t, errors.Is(err, cerrdefs.ErrNotFound))
// buildkit contentstore still has the layer because it is multi-ns // buildkit contentstore still has the layer because it is multi-ns
bkstore := proxy.NewContentStore(c.ContentClient()) bkstore := proxy.NewContentStore(c.ContentClient())
@ -3926,7 +3926,7 @@ func testBuildExportWithForeignLayer(t *testing.T, sb integration.Sandbox) {
// The request is only made when we attempt to read from the reader. // The request is only made when we attempt to read from the reader.
buf := make([]byte, 1) buf := make([]byte, 1)
_, err = rc.Read(buf) _, err = rc.Read(buf)
require.Truef(t, ctderrdefs.IsNotFound(err), "expected error for blob that should not be in registry: %s, %v", mfst.Layers[0].Digest, err) require.Truef(t, cerrdefs.IsNotFound(err), "expected error for blob that should not be in registry: %s, %v", mfst.Layers[0].Digest, err)
}) })
t.Run("propagate=0", func(t *testing.T) { t.Run("propagate=0", func(t *testing.T) {
registry, err := sb.NewRegistry() registry, err := sb.NewRegistry()
@ -4681,7 +4681,7 @@ func testStargzLazyRegistryCacheImportExport(t *testing.T, sb integration.Sandbo
var sgzLayers []ocispecs.Descriptor var sgzLayers []ocispecs.Descriptor
for i, layer := range manifest.Layers[:len(manifest.Layers)-1] { for i, layer := range manifest.Layers[:len(manifest.Layers)-1] {
_, err = contentStore.Info(ctx, layer.Digest) _, err = contentStore.Info(ctx, layer.Digest)
require.ErrorIs(t, err, ctderrdefs.ErrNotFound, "unexpected error %v on layer %+v (%d)", err, layer, i) require.ErrorIs(t, err, cerrdefs.ErrNotFound, "unexpected error %v on layer %+v (%d)", err, layer, i)
sgzLayers = append(sgzLayers, layer) sgzLayers = append(sgzLayers, layer)
} }
require.NotEqual(t, 0, len(sgzLayers), "no layer can be used for checking lazypull") require.NotEqual(t, 0, len(sgzLayers), "no layer can be used for checking lazypull")
@ -4871,7 +4871,7 @@ func testStargzLazyInlineCacheImportExport(t *testing.T, sb integration.Sandbox)
var sgzLayers []ocispecs.Descriptor var sgzLayers []ocispecs.Descriptor
for i, layer := range manifest.Layers[:len(manifest.Layers)-1] { for i, layer := range manifest.Layers[:len(manifest.Layers)-1] {
_, err = contentStore.Info(ctx, layer.Digest) _, err = contentStore.Info(ctx, layer.Digest)
require.ErrorIs(t, err, ctderrdefs.ErrNotFound, "unexpected error %v on layer %+v (%d)", err, layer, i) require.ErrorIs(t, err, cerrdefs.ErrNotFound, "unexpected error %v on layer %+v (%d)", err, layer, i)
sgzLayers = append(sgzLayers, layer) sgzLayers = append(sgzLayers, layer)
} }
require.NotEqual(t, 0, len(sgzLayers), "no layer can be used for checking lazypull") require.NotEqual(t, 0, len(sgzLayers), "no layer can be used for checking lazypull")
@ -5009,7 +5009,7 @@ func testStargzLazyPull(t *testing.T, sb integration.Sandbox) {
var sgzLayers []ocispecs.Descriptor var sgzLayers []ocispecs.Descriptor
for _, layer := range manifest.Layers[:len(manifest.Layers)-1] { for _, layer := range manifest.Layers[:len(manifest.Layers)-1] {
_, err = contentStore.Info(ctx, layer.Digest) _, err = contentStore.Info(ctx, layer.Digest)
require.ErrorIs(t, err, ctderrdefs.ErrNotFound, "unexpected error %v", err) require.ErrorIs(t, err, cerrdefs.ErrNotFound, "unexpected error %v", err)
sgzLayers = append(sgzLayers, layer) sgzLayers = append(sgzLayers, layer)
} }
require.NotEqual(t, 0, len(sgzLayers), "no layer can be used for checking lazypull") require.NotEqual(t, 0, len(sgzLayers), "no layer can be used for checking lazypull")
@ -5167,7 +5167,7 @@ func testLazyImagePush(t *testing.T, sb integration.Sandbox) {
for _, layer := range manifest.Layers { for _, layer := range manifest.Layers {
_, err = contentStore.Info(ctx, layer.Digest) _, err = contentStore.Info(ctx, layer.Digest)
require.ErrorIs(t, err, ctderrdefs.ErrNotFound, "unexpected error %v", err) require.ErrorIs(t, err, cerrdefs.ErrNotFound, "unexpected error %v", err)
} }
// clear all local state out again // clear all local state out again
@ -5201,7 +5201,7 @@ func testLazyImagePush(t *testing.T, sb integration.Sandbox) {
for _, layer := range manifest.Layers { for _, layer := range manifest.Layers {
_, err = contentStore.Info(ctx, layer.Digest) _, err = contentStore.Info(ctx, layer.Digest)
require.ErrorIs(t, err, ctderrdefs.ErrNotFound, "unexpected error %v", err) require.ErrorIs(t, err, cerrdefs.ErrNotFound, "unexpected error %v", err)
} }
// check that a subsequent build can use the previously lazy image in an exec // check that a subsequent build can use the previously lazy image in an exec
@ -6006,7 +6006,7 @@ func testRegistryEmptyCacheExport(t *testing.T, sb integration.Sandbox) {
defer client.Close() defer client.Close()
_, err := client.Fetch(ctx, cacheTarget) _, err := client.Fetch(ctx, cacheTarget)
require.ErrorIs(t, err, ctderrdefs.ErrNotFound, "unexpected error %v", err) require.ErrorIs(t, err, cerrdefs.ErrNotFound, "unexpected error %v", err)
} }
}) })
} }
@ -7317,7 +7317,7 @@ func testMergeOpCache(t *testing.T, sb integration.Sandbox, mode string) {
for _, layer := range busyboxManifest.Layers { for _, layer := range busyboxManifest.Layers {
_, err = contentStore.Info(ctx, layer.Digest) _, err = contentStore.Info(ctx, layer.Digest)
require.ErrorIs(t, err, ctderrdefs.ErrNotFound, "unexpected error %v", err) require.ErrorIs(t, err, cerrdefs.ErrNotFound, "unexpected error %v", err)
} }
// make a new merge that includes the lazy busybox as a base and exports inline cache // make a new merge that includes the lazy busybox as a base and exports inline cache
@ -7403,7 +7403,7 @@ func testMergeOpCache(t *testing.T, sb integration.Sandbox, mode string) {
// verify that the busybox image stayed lazy // verify that the busybox image stayed lazy
for _, layer := range busyboxManifest.Layers { for _, layer := range busyboxManifest.Layers {
_, err = contentStore.Info(ctx, layer.Digest) _, err = contentStore.Info(ctx, layer.Digest)
require.ErrorIs(t, err, ctderrdefs.ErrNotFound, "unexpected error %v", err) require.ErrorIs(t, err, cerrdefs.ErrNotFound, "unexpected error %v", err)
} }
// get the random value at /bar/2 // get the random value at /bar/2
@ -7435,7 +7435,7 @@ func testMergeOpCache(t *testing.T, sb integration.Sandbox, mode string) {
for _, layer := range manifest.Layers { for _, layer := range manifest.Layers {
_, err = contentStore.Info(ctx, layer.Digest) _, err = contentStore.Info(ctx, layer.Digest)
require.ErrorIs(t, err, ctderrdefs.ErrNotFound, "unexpected error %v", err) require.ErrorIs(t, err, cerrdefs.ErrNotFound, "unexpected error %v", err)
} }
// re-run the same build with cache imports and verify everything stays lazy // re-run the same build with cache imports and verify everything stays lazy
@ -7463,7 +7463,7 @@ func testMergeOpCache(t *testing.T, sb integration.Sandbox, mode string) {
for i, layer := range manifest.Layers { for i, layer := range manifest.Layers {
_, err = contentStore.Info(ctx, layer.Digest) _, err = contentStore.Info(ctx, layer.Digest)
require.ErrorIs(t, err, ctderrdefs.ErrNotFound, "unexpected error %v for index %d (%s)", err, i, layer.Digest) require.ErrorIs(t, err, cerrdefs.ErrNotFound, "unexpected error %v for index %d (%s)", err, i, layer.Digest)
} }
// re-run the build with a change only to input1 using the remote cache // re-run the build with a change only to input1 using the remote cache
@ -7504,7 +7504,7 @@ func testMergeOpCache(t *testing.T, sb integration.Sandbox, mode string) {
case 0, 2: case 0, 2:
// bottom and top layer should stay lazy as they didn't change // bottom and top layer should stay lazy as they didn't change
_, err = contentStore.Info(ctx, layer.Digest) _, err = contentStore.Info(ctx, layer.Digest)
require.ErrorIs(t, err, ctderrdefs.ErrNotFound, "unexpected error %v for index %d", err, i) require.ErrorIs(t, err, cerrdefs.ErrNotFound, "unexpected error %v for index %d", err, i)
case 1: case 1:
// middle layer had to be rebuilt, should exist locally // middle layer had to be rebuilt, should exist locally
_, err = contentStore.Info(ctx, layer.Digest) _, err = contentStore.Info(ctx, layer.Digest)
@ -7540,7 +7540,7 @@ func testMergeOpCache(t *testing.T, sb integration.Sandbox, mode string) {
for _, layer := range manifest.Layers { for _, layer := range manifest.Layers {
_, err = contentStore.Info(ctx, layer.Digest) _, err = contentStore.Info(ctx, layer.Digest)
require.ErrorIs(t, err, ctderrdefs.ErrNotFound, "unexpected error %v", err) require.ErrorIs(t, err, cerrdefs.ErrNotFound, "unexpected error %v", err)
} }
mergePlusLayer := merge.File(llb.Mkfile("/3", 0444, nil)) mergePlusLayer := merge.File(llb.Mkfile("/3", 0444, nil))
@ -7589,7 +7589,7 @@ func testMergeOpCache(t *testing.T, sb integration.Sandbox, mode string) {
for _, layer := range manifest.Layers { for _, layer := range manifest.Layers {
_, err = contentStore.Info(ctx, layer.Digest) _, err = contentStore.Info(ctx, layer.Digest)
require.ErrorIs(t, err, ctderrdefs.ErrNotFound, "unexpected error %v", err) require.ErrorIs(t, err, cerrdefs.ErrNotFound, "unexpected error %v", err)
} }
_, err = c.Solve(sb.Context(), def, SolveOpt{ _, err = c.Solve(sb.Context(), def, SolveOpt{
@ -7615,7 +7615,7 @@ func testMergeOpCache(t *testing.T, sb integration.Sandbox, mode string) {
for i, layer := range manifest.Layers { for i, layer := range manifest.Layers {
_, err = contentStore.Info(ctx, layer.Digest) _, err = contentStore.Info(ctx, layer.Digest)
require.ErrorIs(t, err, ctderrdefs.ErrNotFound, "unexpected error %v for index %d", err, i) require.ErrorIs(t, err, cerrdefs.ErrNotFound, "unexpected error %v for index %d", err, i)
} }
} }

View File

@ -6,10 +6,10 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/namespaces"
"github.com/containerd/continuity/fs/fstest" "github.com/containerd/continuity/fs/fstest"
cerrdefs "github.com/containerd/errdefs"
"github.com/moby/buildkit/client/llb" "github.com/moby/buildkit/client/llb"
"github.com/moby/buildkit/util/testutil/integration" "github.com/moby/buildkit/util/testutil/integration"
"github.com/moby/buildkit/util/testutil/workers" "github.com/moby/buildkit/util/testutil/workers"
@ -1321,7 +1321,7 @@ func (tc verifyContents) Run(t *testing.T, sb integration.Sandbox) {
if err == nil { if err == nil {
unexpectedLayers = append(unexpectedLayers, desc) unexpectedLayers = append(unexpectedLayers, desc)
} else { } else {
require.True(t, errdefs.IsNotFound(err)) require.True(t, cerrdefs.IsNotFound(err))
} }
} }
return images.Children(ctx, client.ContentStore(), desc) return images.Children(ctx, client.ContentStore(), desc)

View File

@ -10,7 +10,6 @@ import (
"strings" "strings"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/labels" "github.com/containerd/containerd/labels"
"github.com/containerd/containerd/leases" "github.com/containerd/containerd/leases"
@ -18,6 +17,7 @@ import (
"github.com/containerd/containerd/platforms" "github.com/containerd/containerd/platforms"
"github.com/containerd/containerd/remotes/docker" "github.com/containerd/containerd/remotes/docker"
"github.com/containerd/containerd/rootfs" "github.com/containerd/containerd/rootfs"
cerrdefs "github.com/containerd/errdefs"
"github.com/moby/buildkit/cache" "github.com/moby/buildkit/cache"
cacheconfig "github.com/moby/buildkit/cache/config" cacheconfig "github.com/moby/buildkit/cache/config"
"github.com/moby/buildkit/exporter" "github.com/moby/buildkit/exporter"
@ -270,7 +270,7 @@ func (e *imageExporterInstance) Export(ctx context.Context, src *exporter.Source
for _, sfx := range sfx { for _, sfx := range sfx {
img.Name = targetName + sfx img.Name = targetName + sfx
if _, err := e.opt.Images.Update(imageClientCtx, img); err != nil { if _, err := e.opt.Images.Update(imageClientCtx, img); err != nil {
if !errors.Is(err, errdefs.ErrNotFound) { if !errors.Is(err, cerrdefs.ErrNotFound) {
return nil, nil, tagDone(err) return nil, nil, tagDone(err)
} }
@ -284,7 +284,7 @@ func (e *imageExporterInstance) Export(ctx context.Context, src *exporter.Source
if e.unpack { if e.unpack {
if opts.RewriteTimestamp { if opts.RewriteTimestamp {
// e.unpackImage cannot be used because src ref does not point to the rewritten image // e.unpackImage cannot be used because src ref does not point to the rewritten image
/// // /
// TODO: change e.unpackImage so that it takes Result[Remote] as parameter. // TODO: change e.unpackImage so that it takes Result[Remote] as parameter.
// https://github.com/moby/buildkit/pull/4057#discussion_r1324106088 // https://github.com/moby/buildkit/pull/4057#discussion_r1324106088
return nil, nil, errors.New("exporter option \"rewrite-timestamp\" conflicts with \"unpack\"") return nil, nil, errors.New("exporter option \"rewrite-timestamp\" conflicts with \"unpack\"")

3
go.mod
View File

@ -15,8 +15,9 @@ require (
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.15.15 github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.15.15
github.com/aws/aws-sdk-go-v2/service/s3 v1.48.1 github.com/aws/aws-sdk-go-v2/service/s3 v1.48.1
github.com/containerd/console v1.0.4 github.com/containerd/console v1.0.4
github.com/containerd/containerd v1.7.17 github.com/containerd/containerd v1.7.18
github.com/containerd/continuity v0.4.3 github.com/containerd/continuity v0.4.3
github.com/containerd/errdefs v0.1.0
github.com/containerd/fuse-overlayfs-snapshotter v1.0.8 github.com/containerd/fuse-overlayfs-snapshotter v1.0.8
github.com/containerd/go-cni v1.1.9 github.com/containerd/go-cni v1.1.9
github.com/containerd/go-runc v1.1.0 github.com/containerd/go-runc v1.1.0

6
go.sum
View File

@ -94,10 +94,12 @@ github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaD
github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw=
github.com/containerd/console v1.0.4 h1:F2g4+oChYvBTsASRTz8NP6iIAi97J3TtSAsLbIFn4ro= github.com/containerd/console v1.0.4 h1:F2g4+oChYvBTsASRTz8NP6iIAi97J3TtSAsLbIFn4ro=
github.com/containerd/console v1.0.4/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= github.com/containerd/console v1.0.4/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk=
github.com/containerd/containerd v1.7.17 h1:KjNnn0+tAVQHAoaWRjmdak9WlvnFR/8rU1CHHy8Rm2A= github.com/containerd/containerd v1.7.18 h1:jqjZTQNfXGoEaZdW1WwPU0RqSn1Bm2Ay/KJPUuO8nao=
github.com/containerd/containerd v1.7.17/go.mod h1:vK+hhT4TIv2uejlcDlbVIc8+h/BqtKLIyNrtCZol8lI= github.com/containerd/containerd v1.7.18/go.mod h1:IYEk9/IO6wAPUz2bCMVUbsfXjzw5UNP5fLz4PsUygQ4=
github.com/containerd/continuity v0.4.3 h1:6HVkalIp+2u1ZLH1J/pYX2oBVXlJZvh1X1A7bEZ9Su8= github.com/containerd/continuity v0.4.3 h1:6HVkalIp+2u1ZLH1J/pYX2oBVXlJZvh1X1A7bEZ9Su8=
github.com/containerd/continuity v0.4.3/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= github.com/containerd/continuity v0.4.3/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ=
github.com/containerd/errdefs v0.1.0 h1:m0wCRBiu1WJT/Fr+iOoQHMQS/eP5myQ8lCv4Dz5ZURM=
github.com/containerd/errdefs v0.1.0/go.mod h1:YgWiiHtLmSeBrvpw+UfPijzbLaB77mEG1WwJTDETIV0=
github.com/containerd/fifo v1.1.0 h1:4I2mbh5stb1u6ycIABlBw9zgtlK8viPI9QkQNRQEEmY= github.com/containerd/fifo v1.1.0 h1:4I2mbh5stb1u6ycIABlBw9zgtlK8viPI9QkQNRQEEmY=
github.com/containerd/fifo v1.1.0/go.mod h1:bmC4NWMbXlt2EZ0Hc7Fx7QzTFxgPID13eH0Qu+MAb2o= github.com/containerd/fifo v1.1.0/go.mod h1:bmC4NWMbXlt2EZ0Hc7Fx7QzTFxgPID13eH0Qu+MAb2o=
github.com/containerd/fuse-overlayfs-snapshotter v1.0.8 h1:O471INHO59/fnSVE+B+THGjvRA2d1K6/FdpUuhNnXwk= github.com/containerd/fuse-overlayfs-snapshotter v1.0.8 h1:O471INHO59/fnSVE+B+THGjvRA2d1K6/FdpUuhNnXwk=

View File

@ -5,8 +5,8 @@ import (
api "github.com/containerd/containerd/api/services/content/v1" api "github.com/containerd/containerd/api/services/content/v1"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/services/content/contentserver" "github.com/containerd/containerd/services/content/contentserver"
cerrdefs "github.com/containerd/errdefs"
"github.com/moby/buildkit/session" "github.com/moby/buildkit/session"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
ocispecs "github.com/opencontainers/image-spec/specs-go/v1" ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
@ -25,17 +25,17 @@ type attachableContentStore struct {
func (cs *attachableContentStore) choose(ctx context.Context) (content.Store, error) { func (cs *attachableContentStore) choose(ctx context.Context) (content.Store, error) {
md, ok := metadata.FromIncomingContext(ctx) md, ok := metadata.FromIncomingContext(ctx)
if !ok { if !ok {
return nil, errors.Wrap(errdefs.ErrInvalidArgument, "request lacks metadata") return nil, errors.Wrap(cerrdefs.ErrInvalidArgument, "request lacks metadata")
} }
values := md[GRPCHeaderID] values := md[GRPCHeaderID]
if len(values) == 0 { if len(values) == 0 {
return nil, errors.Wrapf(errdefs.ErrInvalidArgument, "request lacks metadata %q", GRPCHeaderID) return nil, errors.Wrapf(cerrdefs.ErrInvalidArgument, "request lacks metadata %q", GRPCHeaderID)
} }
id := values[0] id := values[0]
store, ok := cs.stores[id] store, ok := cs.stores[id]
if !ok { if !ok {
return nil, errors.Wrapf(errdefs.ErrNotFound, "unknown store %s", id) return nil, errors.Wrapf(cerrdefs.ErrNotFound, "unknown store %s", id)
} }
return store, nil return store, nil
} }

View File

@ -4,8 +4,8 @@ import (
"os" "os"
"github.com/Microsoft/go-winio/pkg/bindfilter" "github.com/Microsoft/go-winio/pkg/bindfilter"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/mount" "github.com/containerd/containerd/mount"
cerrdefs "github.com/containerd/errdefs"
"github.com/pkg/errors" "github.com/pkg/errors"
"golang.org/x/sys/windows" "golang.org/x/sys/windows"
) )
@ -26,7 +26,7 @@ func (lm *localMounter) Mount() (string, error) {
// Windows can only mount a single mount at a given location. // Windows can only mount a single mount at a given location.
// Parent layers are carried in Options, opaquely to localMounter. // Parent layers are carried in Options, opaquely to localMounter.
if len(lm.mounts) != 1 { if len(lm.mounts) != 1 {
return "", errors.Wrapf(errdefs.ErrNotImplemented, "request to mount %d layers, only 1 is supported", len(lm.mounts)) return "", errors.Wrapf(cerrdefs.ErrNotImplemented, "request to mount %d layers, only 1 is supported", len(lm.mounts))
} }
m := lm.mounts[0] m := lm.mounts[0]
@ -66,7 +66,7 @@ func (lm *localMounter) Unmount() error {
// Calling Mount() would fail on an instance of the localMounter where mounts contains // Calling Mount() would fail on an instance of the localMounter where mounts contains
// anything other than 1 mount. // anything other than 1 mount.
if len(lm.mounts) != 1 { if len(lm.mounts) != 1 {
return errors.Wrapf(errdefs.ErrNotImplemented, "request to mount %d layers, only 1 is supported", len(lm.mounts)) return errors.Wrapf(cerrdefs.ErrNotImplemented, "request to mount %d layers, only 1 is supported", len(lm.mounts))
} }
m := lm.mounts[0] m := lm.mounts[0]

View File

@ -14,8 +14,8 @@ import (
"time" "time"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/leases" "github.com/containerd/containerd/leases"
cerrdefs "github.com/containerd/errdefs"
controlapi "github.com/moby/buildkit/api/services/control" controlapi "github.com/moby/buildkit/api/services/control"
"github.com/moby/buildkit/client" "github.com/moby/buildkit/client"
"github.com/moby/buildkit/cmd/buildkitd/config" "github.com/moby/buildkit/cmd/buildkitd/config"
@ -137,7 +137,7 @@ func (h *HistoryQueue) migrateV2() error {
return b.ForEach(func(key, dt []byte) error { return b.ForEach(func(key, dt []byte) error {
recs, err := h.opt.LeaseManager.ListResources(ctx, leases.Lease{ID: h.leaseID(string(key))}) recs, err := h.opt.LeaseManager.ListResources(ctx, leases.Lease{ID: h.leaseID(string(key))})
if err != nil { if err != nil {
if errdefs.IsNotFound(err) { if cerrdefs.IsNotFound(err) {
return nil return nil
} }
return err return err
@ -157,7 +157,7 @@ func (h *HistoryQueue) migrateV2() error {
l, err := h.hLeaseManager.Create(ctx, leases.WithID(h.leaseID(string(key)))) l, err := h.hLeaseManager.Create(ctx, leases.WithID(h.leaseID(string(key))))
if err != nil { if err != nil {
if !errors.Is(err, errdefs.ErrAlreadyExists) { if !errors.Is(err, cerrdefs.ErrAlreadyExists) {
return err return err
} }
l = leases.Lease{ID: string(key)} l = leases.Lease{ID: string(key)}
@ -242,7 +242,7 @@ func (h *HistoryQueue) migrateBlobV2(ctx context.Context, id string, detectSkipL
Digest: dgst, Digest: dgst,
}), content.WithRef("history-migrate-"+id)) }), content.WithRef("history-migrate-"+id))
if err != nil { if err != nil {
if errdefs.IsAlreadyExists(err) { if cerrdefs.IsAlreadyExists(err) {
return true, nil return true, nil
} }
return false, err return false, err
@ -365,7 +365,7 @@ func (h *HistoryQueue) addResource(ctx context.Context, l leases.Lease, desc *co
return nil return nil
} }
if _, err := h.hContentStore.Info(ctx, desc.Digest); err != nil { if _, err := h.hContentStore.Info(ctx, desc.Digest); err != nil {
if errdefs.IsNotFound(err) { if cerrdefs.IsNotFound(err) {
lr, ctx, err := leaseutil.NewLease(ctx, h.hLeaseManager, leases.WithID("history_migration_"+identity.NewID()), leaseutil.MakeTemporary) lr, ctx, err := leaseutil.NewLease(ctx, h.hLeaseManager, leases.WithID("history_migration_"+identity.NewID()), leaseutil.MakeTemporary)
if err != nil { if err != nil {
return err return err
@ -509,7 +509,7 @@ func (h *HistoryQueue) update(ctx context.Context, rec controlapi.BuildHistoryRe
l, err := h.hLeaseManager.Create(ctx, leases.WithID(h.leaseID(rec.Ref))) l, err := h.hLeaseManager.Create(ctx, leases.WithID(h.leaseID(rec.Ref)))
created := true created := true
if err != nil { if err != nil {
if !errors.Is(err, errdefs.ErrAlreadyExists) { if !errors.Is(err, cerrdefs.ErrAlreadyExists) {
return err return err
} }
l = leases.Lease{ID: h.leaseID(rec.Ref)} l = leases.Lease{ID: h.leaseID(rec.Ref)}
@ -645,7 +645,7 @@ func (w *Writer) Commit(ctx context.Context) (*ocispecs.Descriptor, func(), erro
dgst := w.dgstr.Digest() dgst := w.dgstr.Digest()
sz := int64(w.sz) sz := int64(w.sz)
if err := w.w.Commit(leases.WithLease(ctx, w.l.ID), int64(w.sz), dgst); err != nil { if err := w.w.Commit(leases.WithLease(ctx, w.l.ID), int64(w.sz), dgst); err != nil {
if !errdefs.IsAlreadyExists(err) { if !cerrdefs.IsAlreadyExists(err) {
w.Discard() w.Discard()
return nil, nil, err return nil, nil, err
} }

View File

@ -7,12 +7,12 @@ import (
"time" "time"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
containerderrdefs "github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/leases" "github.com/containerd/containerd/leases"
"github.com/containerd/containerd/remotes" "github.com/containerd/containerd/remotes"
"github.com/containerd/containerd/remotes/docker" "github.com/containerd/containerd/remotes/docker"
"github.com/containerd/containerd/snapshots" "github.com/containerd/containerd/snapshots"
cerrdefs "github.com/containerd/errdefs"
"github.com/moby/buildkit/cache" "github.com/moby/buildkit/cache"
"github.com/moby/buildkit/client" "github.com/moby/buildkit/client"
"github.com/moby/buildkit/client/llb/sourceresolver" "github.com/moby/buildkit/client/llb/sourceresolver"
@ -249,7 +249,7 @@ func (p *puller) Snapshot(ctx context.Context, g session.Group) (ir cache.Immuta
} }
for _, desc := range p.manifest.Nonlayers { for _, desc := range p.manifest.Nonlayers {
if _, err := p.ContentStore.Info(ctx, desc.Digest); containerderrdefs.IsNotFound(err) { if _, err := p.ContentStore.Info(ctx, desc.Digest); cerrdefs.IsNotFound(err) {
// manifest or config must have gotten gc'd after CacheKey, re-pull them // manifest or config must have gotten gc'd after CacheKey, re-pull them
ctx, done, err := leaseutil.WithLease(ctx, p.LeaseManager, leaseutil.MakeTemporary) ctx, done, err := leaseutil.WithLease(ctx, p.LeaseManager, leaseutil.MakeTemporary)
if err != nil { if err != nil {

View File

@ -9,7 +9,7 @@ import (
"time" "time"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs" cerrdefs "github.com/containerd/errdefs"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
ocispecs "github.com/opencontainers/image-spec/specs-go/v1" ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors" "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] v, ok := b.infos[dgst]
b.mu.Unlock() b.mu.Unlock()
if !ok { if !ok {
return content.Info{}, errdefs.ErrNotFound return content.Info{}, cerrdefs.ErrNotFound
} }
return v, nil 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] updated, ok := b.infos[new.Digest]
if !ok { if !ok {
return content.Info{}, errdefs.ErrNotFound return content.Info{}, cerrdefs.ErrNotFound
} }
if len(fieldpaths) == 0 { if len(fieldpaths) == 0 {
@ -96,7 +96,7 @@ func (b *buffer) Writer(ctx context.Context, opts ...content.WriterOpt) (content
} }
b.mu.Lock() b.mu.Lock()
if _, ok := b.refs[wOpts.Ref]; ok { 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() b.mu.Unlock()
return &bufferedWriter{ return &bufferedWriter{
@ -128,7 +128,7 @@ func (b *buffer) getBytesReader(dgst digest.Digest) (*bytes.Reader, error) {
return bytes.NewReader(dt), nil 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) { func (b *buffer) addValue(k digest.Digest, dt []byte) {

View File

@ -7,8 +7,8 @@ import (
"testing" "testing"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/remotes/docker" "github.com/containerd/containerd/remotes/docker"
cerrdefs "github.com/containerd/errdefs"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
ocispecs "github.com/opencontainers/image-spec/specs-go/v1" ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors" "github.com/pkg/errors"
@ -42,7 +42,7 @@ func TestReadWrite(t *testing.T) {
_, err = content.ReadBlob(ctx, b, ocispecs.Descriptor{Digest: digest.FromBytes([]byte("foo3"))}) _, err = content.ReadBlob(ctx, b, ocispecs.Descriptor{Digest: digest.FromBytes([]byte("foo3"))})
require.Error(t, err) require.Error(t, err)
require.Equal(t, true, errors.Is(err, errdefs.ErrNotFound)) require.Equal(t, true, errors.Is(err, cerrdefs.ErrNotFound))
} }
func TestReaderAt(t *testing.T) { func TestReaderAt(t *testing.T) {

View File

@ -5,7 +5,7 @@ import (
"sync" "sync"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs" cerrdefs "github.com/containerd/errdefs"
"github.com/moby/buildkit/session" "github.com/moby/buildkit/session"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
ocispecs "github.com/opencontainers/image-spec/specs-go/v1" 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() mp.mu.RUnlock()
if mp.base == nil { 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) return mp.base.ReaderAt(ctx, desc)
} }
@ -74,7 +74,7 @@ func (mp *MultiProvider) Info(ctx context.Context, dgst digest.Digest) (content.
} }
mp.mu.RUnlock() mp.mu.RUnlock()
if mp.base == nil { 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) return mp.base.Info(ctx, dgst)
} }

View File

@ -6,7 +6,7 @@ import (
"testing" "testing"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs" cerrdefs "github.com/containerd/errdefs"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
ocispecs "github.com/opencontainers/image-spec/specs-go/v1" ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors" "github.com/pkg/errors"
@ -40,5 +40,5 @@ func TestMultiProvider(t *testing.T) {
_, err = content.ReadBlob(ctx, mp, ocispecs.Descriptor{Digest: digest.FromBytes([]byte("foo2"))}) _, err = content.ReadBlob(ctx, mp, ocispecs.Descriptor{Digest: digest.FromBytes([]byte("foo2"))})
require.Error(t, err) require.Error(t, err)
require.Equal(t, true, errors.Is(err, errdefs.ErrNotFound)) require.Equal(t, true, errors.Is(err, cerrdefs.ErrNotFound))
} }

View File

@ -7,8 +7,8 @@ import (
"time" "time"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/remotes" "github.com/containerd/containerd/remotes"
cerrdefs "github.com/containerd/errdefs"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
"github.com/pkg/errors" "github.com/pkg/errors"
) )
@ -41,7 +41,7 @@ func (i *pushingIngester) Writer(ctx context.Context, opts ...content.WriterOpt)
} }
} }
if wOpts.Ref == "" { 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() st := time.Now()
@ -50,7 +50,7 @@ func (i *pushingIngester) Writer(ctx context.Context, opts ...content.WriterOpt)
for { for {
if time.Since(st) > time.Hour { if time.Since(st) > time.Hour {
i.mu.Unlock() 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 { if _, ok := i.active[wOpts.Desc.Digest]; ok {
i.c.Wait() i.c.Wait()

View File

@ -6,9 +6,9 @@ import (
"sync" "sync"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/remotes" "github.com/containerd/containerd/remotes"
"github.com/containerd/containerd/remotes/docker" "github.com/containerd/containerd/remotes/docker"
cerrdefs "github.com/containerd/errdefs"
"github.com/moby/buildkit/version" "github.com/moby/buildkit/version"
"github.com/moby/locker" "github.com/moby/locker"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
@ -70,7 +70,7 @@ func (w *ingester) Writer(ctx context.Context, opts ...content.WriterOpt) (conte
} }
} }
if wo.Ref == "" { 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) w.locker.Lock(wo.Ref)
var once sync.Once var once sync.Once

View File

@ -10,9 +10,9 @@ import (
"time" "time"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images/converter" "github.com/containerd/containerd/images/converter"
"github.com/containerd/containerd/labels" "github.com/containerd/containerd/labels"
cerrdefs "github.com/containerd/errdefs"
"github.com/moby/buildkit/identity" "github.com/moby/buildkit/identity"
"github.com/moby/buildkit/util/bklog" "github.com/moby/buildkit/util/bklog"
"github.com/moby/buildkit/util/compression" "github.com/moby/buildkit/util/compression"
@ -148,7 +148,7 @@ func (c *conversion) convert(ctx context.Context, cs content.Store, desc ocispec
if c.rewriteTimestamp != nil { if c.rewriteTimestamp != nil {
labelz[labelRewrittenTimestamp] = fmt.Sprintf("%d", c.rewriteTimestamp.UTC().Unix()) labelz[labelRewrittenTimestamp] = fmt.Sprintf("%d", c.rewriteTimestamp.UTC().Unix())
} }
if err = w.Commit(ctx, 0, "", content.WithLabels(labelz)); err != nil && !errdefs.IsAlreadyExists(err) { if err = w.Commit(ctx, 0, "", content.WithLabels(labelz)); err != nil && !cerrdefs.IsAlreadyExists(err) {
return nil, err return nil, err
} }
if err := w.Close(); err != nil { if err := w.Close(); err != nil {

View File

@ -4,7 +4,7 @@ import (
"net/url" "net/url"
"strings" "strings"
"github.com/containerd/containerd/errdefs" cerrdefs "github.com/containerd/errdefs"
"github.com/pkg/errors" "github.com/pkg/errors"
) )
@ -58,7 +58,7 @@ func ParseGitRef(ref string) (*GitRef, error) {
) )
if strings.HasPrefix(ref, "./") || strings.HasPrefix(ref, "../") { if strings.HasPrefix(ref, "./") || strings.HasPrefix(ref, "../") {
return nil, errdefs.ErrInvalidArgument return nil, cerrdefs.ErrInvalidArgument
} else if strings.HasPrefix(ref, "github.com/") { } else if strings.HasPrefix(ref, "github.com/") {
res.IndistinguishableFromLocal = true // Deprecated res.IndistinguishableFromLocal = true // Deprecated
remote = fromURL(&url.URL{ 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. // An HTTP(S) URL is considered to be a valid git ref only when it has the ".git[...]" suffix.
case HTTPProtocol, HTTPSProtocol: case HTTPProtocol, HTTPSProtocol:
if !strings.HasSuffix(remote.Path, ".git") { if !strings.HasSuffix(remote.Path, ".git") {
return nil, errdefs.ErrInvalidArgument return nil, cerrdefs.ErrInvalidArgument
} }
} }
} }

View File

@ -9,9 +9,9 @@ import (
"testing" "testing"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/platforms" "github.com/containerd/containerd/platforms"
"github.com/containerd/containerd/remotes" "github.com/containerd/containerd/remotes"
cerrdefs "github.com/containerd/errdefs"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
ocispecs "github.com/opencontainers/image-spec/specs-go/v1" ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -68,7 +68,7 @@ func TestConfigMultiplatform(t *testing.T) {
// Make sure it doesn't select a non-matching platform // Make sure it doesn't select a non-matching platform
pArmv7 := platforms.MustParse("linux/arm/v7") pArmv7 := platforms.MustParse("linux/arm/v7")
_, _, err = Config(ctx, ref, r, cc, nil, &pArmv7) _, _, err = Config(ctx, ref, r, cc, nil, &pArmv7)
require.ErrorIs(t, err, errdefs.ErrNotFound) require.ErrorIs(t, err, cerrdefs.ErrNotFound)
} }
check(t) check(t)
@ -159,7 +159,7 @@ func (*sectionNopCloser) Close() error {
func (c *testCache) ReaderAt(ctx context.Context, desc ocispecs.Descriptor) (content.ReaderAt, error) { func (c *testCache) ReaderAt(ctx context.Context, desc ocispecs.Descriptor) (content.ReaderAt, error) {
ra, ok := c.content[desc.Digest] ra, ok := c.content[desc.Digest]
if !ok { if !ok {
return nil, errdefs.ErrNotFound return nil, cerrdefs.ErrNotFound
} }
return ra, nil return ra, nil
} }

View File

@ -6,8 +6,8 @@ import (
"time" "time"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/remotes" "github.com/containerd/containerd/remotes"
cerrdefs "github.com/containerd/errdefs"
"github.com/moby/buildkit/util/bklog" "github.com/moby/buildkit/util/bklog"
"github.com/moby/buildkit/util/progress" "github.com/moby/buildkit/util/progress"
ocispecs "github.com/opencontainers/image-spec/specs-go/v1" ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
@ -122,7 +122,7 @@ func trackProgress(ctx context.Context, desc ocispecs.Descriptor, manager PullMa
Started: &started, Started: &started,
}) })
continue continue
} else if !errors.Is(err, errdefs.ErrNotFound) { } else if !errors.Is(err, cerrdefs.ErrNotFound) {
bklog.G(ctx).Errorf("unexpected error getting ingest status of %q: %v", ingestRef, err) bklog.G(ctx).Errorf("unexpected error getting ingest status of %q: %v", ingestRef, err)
return return
} }

View File

@ -8,10 +8,10 @@ import (
"sync" "sync"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/remotes" "github.com/containerd/containerd/remotes"
"github.com/containerd/containerd/remotes/docker" "github.com/containerd/containerd/remotes/docker"
cerrdefs "github.com/containerd/errdefs"
"github.com/containerd/log" "github.com/containerd/log"
"github.com/distribution/reference" "github.com/distribution/reference"
intoto "github.com/in-toto/in-toto-golang/in_toto" intoto "github.com/in-toto/in-toto-golang/in_toto"
@ -191,7 +191,7 @@ func annotateDistributionSourceHandler(manager content.Manager, annotations map[
children[i] = child children[i] = child
info, err := manager.Info(ctx, child.Digest) info, err := manager.Info(ctx, child.Digest)
if errors.Is(err, errdefs.ErrNotFound) { if errors.Is(err, cerrdefs.ErrNotFound) {
continue continue
} else if err != nil { } else if err != nil {
return nil, err return nil, err

View File

@ -10,10 +10,10 @@ import (
"sync" "sync"
"time" "time"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/remotes/docker" "github.com/containerd/containerd/remotes/docker"
"github.com/containerd/containerd/remotes/docker/auth" "github.com/containerd/containerd/remotes/docker/auth"
remoteserrors "github.com/containerd/containerd/remotes/errors" remoteserrors "github.com/containerd/containerd/remotes/errors"
cerrdefs "github.com/containerd/errdefs"
"github.com/moby/buildkit/session" "github.com/moby/buildkit/session"
sessionauth "github.com/moby/buildkit/session/auth" sessionauth "github.com/moby/buildkit/session/auth"
log "github.com/moby/buildkit/util/bklog" log "github.com/moby/buildkit/util/bklog"
@ -219,7 +219,7 @@ func (a *dockerAuthorizer) AddResponses(ctx context.Context, responses []*http.R
} }
} }
} }
return errors.Wrap(errdefs.ErrNotImplemented, "failed to find supported auth scheme") return errors.Wrap(cerrdefs.ErrNotImplemented, "failed to find supported auth scheme")
} }
// authResult is used to control limit rate. // authResult is used to control limit rate.
@ -271,7 +271,7 @@ func (ah *authHandler) authorize(ctx context.Context, sm *session.Manager, g ses
case auth.BearerAuth: case auth.BearerAuth:
return ah.doBearerAuth(ctx, sm, g) return ah.doBearerAuth(ctx, sm, g)
default: default:
return "", errors.Wrapf(errdefs.ErrNotImplemented, "failed to find supported auth scheme: %s", string(ah.scheme)) return "", errors.Wrapf(cerrdefs.ErrNotImplemented, "failed to find supported auth scheme: %s", string(ah.scheme))
} }
} }

View File

@ -12,9 +12,9 @@ import (
"github.com/containerd/containerd/archive/compression" "github.com/containerd/containerd/archive/compression"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/diff" "github.com/containerd/containerd/diff"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/mount" "github.com/containerd/containerd/mount"
cerrdefs "github.com/containerd/errdefs"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
ocispecs "github.com/opencontainers/image-spec/specs-go/v1" ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors" "github.com/pkg/errors"
@ -49,7 +49,7 @@ func (s *winApplier) Apply(ctx context.Context, desc ocispecs.Descriptor, mounts
compressed, err := images.DiffCompression(ctx, desc.MediaType) compressed, err := images.DiffCompression(ctx, desc.MediaType)
if err != nil { if err != nil {
return ocispecs.Descriptor{}, errors.Wrapf(errdefs.ErrNotImplemented, "unsupported diff media type: %v", desc.MediaType) return ocispecs.Descriptor{}, errors.Wrapf(cerrdefs.ErrNotImplemented, "unsupported diff media type: %v", desc.MediaType)
} }
var ocidesc ocispecs.Descriptor var ocidesc ocispecs.Descriptor

View File

@ -13,9 +13,9 @@ import (
"github.com/containerd/containerd/archive/compression" "github.com/containerd/containerd/archive/compression"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/diff" "github.com/containerd/containerd/diff"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/labels" "github.com/containerd/containerd/labels"
"github.com/containerd/containerd/mount" "github.com/containerd/containerd/mount"
cerrdefs "github.com/containerd/errdefs"
log "github.com/moby/buildkit/util/bklog" log "github.com/moby/buildkit/util/bklog"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
ocispecs "github.com/opencontainers/image-spec/specs-go/v1" ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
@ -66,7 +66,7 @@ func (s *winDiffer) Compare(ctx context.Context, lower, upper []mount.Mount, opt
case ocispecs.MediaTypeImageLayerGzip: case ocispecs.MediaTypeImageLayerGzip:
isCompressed = true isCompressed = true
default: default:
return emptyDesc, errors.Wrapf(errdefs.ErrNotImplemented, "unsupported diff media type: %v", config.MediaType) return emptyDesc, errors.Wrapf(cerrdefs.ErrNotImplemented, "unsupported diff media type: %v", config.MediaType)
} }
var ocidesc ocispecs.Descriptor var ocidesc ocispecs.Descriptor

View File

@ -102,7 +102,7 @@ EOF
config.vm.provision "install-golang", type: "shell", run: "once" do |sh| config.vm.provision "install-golang", type: "shell", run: "once" do |sh|
sh.upload_path = "/tmp/vagrant-install-golang" sh.upload_path = "/tmp/vagrant-install-golang"
sh.env = { sh.env = {
'GO_VERSION': ENV['GO_VERSION'] || "1.21.10", 'GO_VERSION': ENV['GO_VERSION'] || "1.21.11",
} }
sh.inline = <<~SHELL sh.inline = <<~SHELL
#!/usr/bin/env bash #!/usr/bin/env bash

View File

@ -29,7 +29,7 @@ import (
"strconv" "strconv"
"sync" "sync"
"github.com/containerd/containerd/log" "github.com/containerd/log"
"github.com/klauspost/compress/zstd" "github.com/klauspost/compress/zstd"
) )

View File

@ -30,10 +30,10 @@ import (
"time" "time"
"github.com/containerd/containerd/archive/tarheader" "github.com/containerd/containerd/archive/tarheader"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/pkg/epoch" "github.com/containerd/containerd/pkg/epoch"
"github.com/containerd/containerd/pkg/userns" "github.com/containerd/containerd/pkg/userns"
"github.com/containerd/continuity/fs" "github.com/containerd/continuity/fs"
"github.com/containerd/log"
) )
var bufPool = &sync.Pool{ var bufPool = &sync.Pool{

View File

@ -22,7 +22,7 @@ import (
"io" "io"
winio "github.com/Microsoft/go-winio" winio "github.com/Microsoft/go-winio"
"github.com/containerd/containerd/log" "github.com/containerd/log"
) )
const pipeRoot = `\\.\pipe` const pipeRoot = `\\.\pipe`

View File

@ -44,7 +44,6 @@ import (
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
contentproxy "github.com/containerd/containerd/content/proxy" contentproxy "github.com/containerd/containerd/content/proxy"
"github.com/containerd/containerd/defaults" "github.com/containerd/containerd/defaults"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/events" "github.com/containerd/containerd/events"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/leases" "github.com/containerd/containerd/leases"
@ -61,6 +60,7 @@ import (
"github.com/containerd/containerd/services/introspection" "github.com/containerd/containerd/services/introspection"
"github.com/containerd/containerd/snapshots" "github.com/containerd/containerd/snapshots"
snproxy "github.com/containerd/containerd/snapshots/proxy" snproxy "github.com/containerd/containerd/snapshots/proxy"
"github.com/containerd/errdefs"
"github.com/containerd/typeurl/v2" "github.com/containerd/typeurl/v2"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/opencontainers/runtime-spec/specs-go" "github.com/opencontainers/runtime-spec/specs-go"

View File

@ -29,11 +29,11 @@ import (
tasktypes "github.com/containerd/containerd/api/types/task" tasktypes "github.com/containerd/containerd/api/types/task"
"github.com/containerd/containerd/cio" "github.com/containerd/containerd/cio"
"github.com/containerd/containerd/containers" "github.com/containerd/containerd/containers"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/oci" "github.com/containerd/containerd/oci"
"github.com/containerd/containerd/protobuf" "github.com/containerd/containerd/protobuf"
"github.com/containerd/containerd/runtime/v2/runc/options" "github.com/containerd/containerd/runtime/v2/runc/options"
"github.com/containerd/errdefs"
"github.com/containerd/fifo" "github.com/containerd/fifo"
"github.com/containerd/typeurl/v2" "github.com/containerd/typeurl/v2"
ver "github.com/opencontainers/image-spec/specs-go" ver "github.com/opencontainers/image-spec/specs-go"

View File

@ -24,12 +24,12 @@ import (
"github.com/containerd/containerd/containers" "github.com/containerd/containerd/containers"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/namespaces"
"github.com/containerd/containerd/oci" "github.com/containerd/containerd/oci"
"github.com/containerd/containerd/protobuf" "github.com/containerd/containerd/protobuf"
"github.com/containerd/containerd/snapshots" "github.com/containerd/containerd/snapshots"
"github.com/containerd/errdefs"
"github.com/containerd/typeurl/v2" "github.com/containerd/typeurl/v2"
"github.com/opencontainers/image-spec/identity" "github.com/opencontainers/image-spec/identity"
v1 "github.com/opencontainers/image-spec/specs-go/v1" v1 "github.com/opencontainers/image-spec/specs-go/v1"

View File

@ -26,8 +26,8 @@ import (
"syscall" "syscall"
"github.com/containerd/containerd/containers" "github.com/containerd/containerd/containers"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/mount" "github.com/containerd/containerd/mount"
"github.com/containerd/errdefs"
"github.com/opencontainers/image-spec/identity" "github.com/opencontainers/image-spec/identity"
) )

View File

@ -23,9 +23,9 @@ import (
containersapi "github.com/containerd/containerd/api/services/containers/v1" containersapi "github.com/containerd/containerd/api/services/containers/v1"
"github.com/containerd/containerd/containers" "github.com/containerd/containerd/containers"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/protobuf" "github.com/containerd/containerd/protobuf"
ptypes "github.com/containerd/containerd/protobuf/types" ptypes "github.com/containerd/containerd/protobuf/types"
"github.com/containerd/errdefs"
"github.com/containerd/typeurl/v2" "github.com/containerd/typeurl/v2"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
"google.golang.org/grpc/status" "google.golang.org/grpc/status"

View File

@ -24,9 +24,9 @@ import (
"sync" "sync"
"time" "time"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/pkg/randutil" "github.com/containerd/containerd/pkg/randutil"
"github.com/containerd/errdefs"
"github.com/containerd/log"
"github.com/opencontainers/go-digest" "github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
) )

View File

@ -21,7 +21,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/containerd/containerd/errdefs" "github.com/containerd/errdefs"
) )
// Handles locking references // Handles locking references

View File

@ -22,7 +22,7 @@ import (
"os" "os"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs" "github.com/containerd/errdefs"
) )
// readerat implements io.ReaderAt in a completely stateless manner by opening // readerat implements io.ReaderAt in a completely stateless manner by opening

View File

@ -28,10 +28,10 @@ import (
"time" "time"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/filters" "github.com/containerd/containerd/filters"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/pkg/randutil" "github.com/containerd/containerd/pkg/randutil"
"github.com/containerd/errdefs"
"github.com/containerd/log"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/opencontainers/go-digest" "github.com/opencontainers/go-digest"

View File

@ -27,8 +27,8 @@ import (
"time" "time"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs" "github.com/containerd/errdefs"
"github.com/containerd/containerd/log" "github.com/containerd/log"
"github.com/opencontainers/go-digest" "github.com/opencontainers/go-digest"
) )

View File

@ -22,9 +22,9 @@ import (
contentapi "github.com/containerd/containerd/api/services/content/v1" contentapi "github.com/containerd/containerd/api/services/content/v1"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/protobuf" "github.com/containerd/containerd/protobuf"
protobuftypes "github.com/containerd/containerd/protobuf/types" protobuftypes "github.com/containerd/containerd/protobuf/types"
"github.com/containerd/errdefs"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
) )

View File

@ -23,8 +23,8 @@ import (
contentapi "github.com/containerd/containerd/api/services/content/v1" contentapi "github.com/containerd/containerd/api/services/content/v1"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/protobuf" "github.com/containerd/containerd/protobuf"
"github.com/containerd/errdefs"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
) )

View File

@ -24,8 +24,8 @@ import (
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/diff" "github.com/containerd/containerd/diff"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/mount" "github.com/containerd/containerd/mount"
"github.com/containerd/log"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
) )

View File

@ -24,9 +24,9 @@ import (
"strings" "strings"
"github.com/containerd/containerd/archive" "github.com/containerd/containerd/archive"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/mount" "github.com/containerd/containerd/mount"
"github.com/containerd/containerd/pkg/userns" "github.com/containerd/containerd/pkg/userns"
"github.com/containerd/errdefs"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
) )

View File

@ -22,11 +22,11 @@ import (
diffapi "github.com/containerd/containerd/api/services/diff/v1" diffapi "github.com/containerd/containerd/api/services/diff/v1"
"github.com/containerd/containerd/api/types" "github.com/containerd/containerd/api/types"
"github.com/containerd/containerd/diff" "github.com/containerd/containerd/diff"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/mount" "github.com/containerd/containerd/mount"
"github.com/containerd/containerd/pkg/epoch" "github.com/containerd/containerd/pkg/epoch"
"github.com/containerd/containerd/protobuf" "github.com/containerd/containerd/protobuf"
ptypes "github.com/containerd/containerd/protobuf/types" ptypes "github.com/containerd/containerd/protobuf/types"
"github.com/containerd/errdefs"
"github.com/opencontainers/go-digest" "github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"

View File

@ -29,11 +29,11 @@ import (
"github.com/containerd/containerd/archive/compression" "github.com/containerd/containerd/archive/compression"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/diff" "github.com/containerd/containerd/diff"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/labels" "github.com/containerd/containerd/labels"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/mount" "github.com/containerd/containerd/mount"
"github.com/containerd/containerd/pkg/epoch" "github.com/containerd/containerd/pkg/epoch"
"github.com/containerd/errdefs"
"github.com/containerd/log"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
) )

View File

@ -0,0 +1,116 @@
/*
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.
//
// The functions ToGRPC and FromGRPC can be used to map server-side and
// client-side errors to the correct types.
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.
//
// For the most part, we just try to provide local grpc errors. Most conditions
// map very well to those defined by grpc.
var (
ErrUnknown = errdefs.ErrUnknown
ErrInvalidArgument = errdefs.ErrInvalidArgument
ErrNotFound = errdefs.ErrNotFound
ErrAlreadyExists = errdefs.ErrAlreadyExists
ErrFailedPrecondition = errdefs.ErrFailedPrecondition
ErrUnavailable = errdefs.ErrUnavailable
ErrNotImplemented = errdefs.ErrNotImplemented
)
// IsInvalidArgument returns true if the error is due to an invalid argument
func IsInvalidArgument(err error) bool {
return errdefs.IsInvalidArgument(err)
}
// IsNotFound returns true if the error is due to a missing object
func IsNotFound(err error) bool {
return errdefs.IsNotFound(err)
}
// IsAlreadyExists returns true if the error is due to an already existing
// metadata item
func IsAlreadyExists(err error) bool {
return errdefs.IsAlreadyExists(err)
}
// IsFailedPrecondition returns true if an operation could not proceed to the
// lack of a particular condition
func IsFailedPrecondition(err error) bool {
return errdefs.IsFailedPrecondition(err)
}
// IsUnavailable returns true if the error is due to a resource being unavailable
func IsUnavailable(err error) bool {
return errdefs.IsUnavailable(err)
}
// IsNotImplemented returns true if the error is due to not being implemented
func IsNotImplemented(err error) bool {
return errdefs.IsNotImplemented(err)
}
// IsCanceled returns true if the error is due to `context.Canceled`.
func IsCanceled(err error) bool {
return errdefs.IsCanceled(err)
}
// IsDeadlineExceeded returns true if the error is due to
// `context.DeadlineExceeded`.
func IsDeadlineExceeded(err error) bool {
return errdefs.IsDeadlineExceeded(err)
}
// 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 {
return errdefs.ToGRPC(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 errdefs.ToGRPCf(err, format, args...)
}
// FromGRPC returns the underlying error from a grpc service based on the grpc error code
func FromGRPC(err error) error {
return errdefs.FromGRPC(err)
}

View File

@ -20,9 +20,9 @@ import (
"context" "context"
eventsapi "github.com/containerd/containerd/api/services/events/v1" eventsapi "github.com/containerd/containerd/api/services/events/v1"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/events" "github.com/containerd/containerd/events"
"github.com/containerd/containerd/protobuf" "github.com/containerd/containerd/protobuf"
"github.com/containerd/errdefs"
"github.com/containerd/typeurl/v2" "github.com/containerd/typeurl/v2"
) )

View File

@ -22,12 +22,12 @@ import (
"strings" "strings"
"time" "time"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/events" "github.com/containerd/containerd/events"
"github.com/containerd/containerd/filters" "github.com/containerd/containerd/filters"
"github.com/containerd/containerd/identifiers" "github.com/containerd/containerd/identifiers"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/namespaces"
"github.com/containerd/errdefs"
"github.com/containerd/log"
"github.com/containerd/typeurl/v2" "github.com/containerd/typeurl/v2"
goevents "github.com/docker/go-events" goevents "github.com/docker/go-events"
) )

View File

@ -70,7 +70,7 @@ package filters
import ( import (
"regexp" "regexp"
"github.com/containerd/containerd/log" "github.com/containerd/log"
) )
// Filter matches specific resources based the provided filter // Filter matches specific resources based the provided filter

View File

@ -20,7 +20,7 @@ import (
"fmt" "fmt"
"io" "io"
"github.com/containerd/containerd/errdefs" "github.com/containerd/errdefs"
) )
/* /*

View File

@ -28,7 +28,7 @@ import (
"fmt" "fmt"
"regexp" "regexp"
"github.com/containerd/containerd/errdefs" "github.com/containerd/errdefs"
) )
const ( const (

View File

@ -26,13 +26,13 @@ import (
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/diff" "github.com/containerd/containerd/diff"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/labels" "github.com/containerd/containerd/labels"
"github.com/containerd/containerd/pkg/kmutex" "github.com/containerd/containerd/pkg/kmutex"
"github.com/containerd/containerd/platforms" "github.com/containerd/containerd/platforms"
"github.com/containerd/containerd/rootfs" "github.com/containerd/containerd/rootfs"
"github.com/containerd/containerd/snapshots" "github.com/containerd/containerd/snapshots"
"github.com/containerd/errdefs"
"github.com/opencontainers/go-digest" "github.com/opencontainers/go-digest"
"github.com/opencontainers/image-spec/identity" "github.com/opencontainers/image-spec/identity"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"

View File

@ -21,11 +21,11 @@ import (
imagesapi "github.com/containerd/containerd/api/services/images/v1" imagesapi "github.com/containerd/containerd/api/services/images/v1"
"github.com/containerd/containerd/api/types" "github.com/containerd/containerd/api/types"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/pkg/epoch" "github.com/containerd/containerd/pkg/epoch"
"github.com/containerd/containerd/protobuf" "github.com/containerd/containerd/protobuf"
ptypes "github.com/containerd/containerd/protobuf/types" ptypes "github.com/containerd/containerd/protobuf/types"
"github.com/containerd/errdefs"
"github.com/opencontainers/go-digest" "github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"google.golang.org/protobuf/types/known/timestamppb" "google.golang.org/protobuf/types/known/timestamppb"

View File

@ -27,10 +27,10 @@ import (
"strings" "strings"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/labels" "github.com/containerd/containerd/labels"
"github.com/containerd/containerd/platforms" "github.com/containerd/containerd/platforms"
"github.com/containerd/errdefs"
"github.com/containerd/log" "github.com/containerd/log"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
ocispecs "github.com/opencontainers/image-spec/specs-go" ocispecs "github.com/opencontainers/image-spec/specs-go"

View File

@ -29,11 +29,11 @@ import (
"github.com/containerd/containerd/archive/compression" "github.com/containerd/containerd/archive/compression"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/labels" "github.com/containerd/containerd/labels"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/platforms" "github.com/containerd/containerd/platforms"
"github.com/containerd/errdefs"
"github.com/containerd/log"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
specs "github.com/opencontainers/image-spec/specs-go" specs "github.com/opencontainers/image-spec/specs-go"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"

View File

@ -23,8 +23,8 @@ import (
"sort" "sort"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/platforms" "github.com/containerd/containerd/platforms"
"github.com/containerd/errdefs"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"golang.org/x/sync/errgroup" "golang.org/x/sync/errgroup"
"golang.org/x/sync/semaphore" "golang.org/x/sync/semaphore"

View File

@ -24,9 +24,9 @@ import (
"time" "time"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/platforms" "github.com/containerd/containerd/platforms"
"github.com/containerd/errdefs"
"github.com/containerd/log"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
) )
@ -268,6 +268,9 @@ func Platforms(ctx context.Context, provider content.Provider, image ocispec.Des
var platformSpecs []ocispec.Platform var platformSpecs []ocispec.Platform
return platformSpecs, Walk(ctx, Handlers(HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { return platformSpecs, Walk(ctx, Handlers(HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
if desc.Platform != nil { if desc.Platform != nil {
if desc.Platform.OS == "unknown" || desc.Platform.Architecture == "unknown" {
return nil, ErrSkipDesc
}
platformSpecs = append(platformSpecs, *desc.Platform) platformSpecs = append(platformSpecs, *desc.Platform)
return nil, ErrSkipDesc return nil, ErrSkipDesc
} }

View File

@ -22,7 +22,7 @@ import (
"sort" "sort"
"strings" "strings"
"github.com/containerd/containerd/errdefs" "github.com/containerd/errdefs"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
) )

View File

@ -22,10 +22,10 @@ import (
"io" "io"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/images/archive" "github.com/containerd/containerd/images/archive"
"github.com/containerd/containerd/platforms" "github.com/containerd/containerd/platforms"
"github.com/containerd/errdefs"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
) )

View File

@ -19,7 +19,7 @@ package labels
import ( import (
"fmt" "fmt"
"github.com/containerd/containerd/errdefs" "github.com/containerd/errdefs"
) )
const ( const (

View File

@ -20,9 +20,9 @@ import (
"context" "context"
leasesapi "github.com/containerd/containerd/api/services/leases/v1" leasesapi "github.com/containerd/containerd/api/services/leases/v1"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/leases" "github.com/containerd/containerd/leases"
"github.com/containerd/containerd/protobuf" "github.com/containerd/containerd/protobuf"
"github.com/containerd/errdefs"
) )
type proxyManager struct { type proxyManager struct {

View File

@ -1,149 +0,0 @@
/*
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 log
import (
"context"
"github.com/containerd/log"
)
// G is a shorthand for [GetLogger].
//
// Deprecated: use [log.G].
var G = log.G
// L is an alias for the standard logger.
//
// Deprecated: use [log.L].
var L = log.L
// Fields type to pass to "WithFields".
//
// Deprecated: use [log.Fields].
type Fields = log.Fields
// Entry is a logging entry.
//
// Deprecated: use [log.Entry].
type Entry = log.Entry
// RFC3339NanoFixed is [time.RFC3339Nano] with nanoseconds padded using
// zeros to ensure the formatted time is always the same number of
// characters.
//
// Deprecated: use [log.RFC3339NanoFixed].
const RFC3339NanoFixed = log.RFC3339NanoFixed
// Level is a logging level.
//
// Deprecated: use [log.Level].
type Level = log.Level
// Supported log levels.
const (
// TraceLevel level.
//
// Deprecated: use [log.TraceLevel].
TraceLevel Level = log.TraceLevel
// DebugLevel level.
//
// Deprecated: use [log.DebugLevel].
DebugLevel Level = log.DebugLevel
// InfoLevel level.
//
// Deprecated: use [log.InfoLevel].
InfoLevel Level = log.InfoLevel
// WarnLevel level.
//
// Deprecated: use [log.WarnLevel].
WarnLevel Level = log.WarnLevel
// ErrorLevel level
//
// Deprecated: use [log.ErrorLevel].
ErrorLevel Level = log.ErrorLevel
// FatalLevel level.
//
// Deprecated: use [log.FatalLevel].
FatalLevel Level = log.FatalLevel
// PanicLevel level.
//
// Deprecated: use [log.PanicLevel].
PanicLevel Level = log.PanicLevel
)
// SetLevel sets log level globally. It returns an error if the given
// level is not supported.
//
// Deprecated: use [log.SetLevel].
func SetLevel(level string) error {
return log.SetLevel(level)
}
// GetLevel returns the current log level.
//
// Deprecated: use [log.GetLevel].
func GetLevel() log.Level {
return log.GetLevel()
}
// OutputFormat specifies a log output format.
//
// Deprecated: use [log.OutputFormat].
type OutputFormat = log.OutputFormat
// Supported log output formats.
const (
// TextFormat represents the text logging format.
//
// Deprecated: use [log.TextFormat].
TextFormat log.OutputFormat = "text"
// JSONFormat represents the JSON logging format.
//
// Deprecated: use [log.JSONFormat].
JSONFormat log.OutputFormat = "json"
)
// SetFormat sets the log output format.
//
// Deprecated: use [log.SetFormat].
func SetFormat(format OutputFormat) error {
return log.SetFormat(format)
}
// WithLogger returns a new context with the provided logger. Use in
// combination with logger.WithField(s) for great effect.
//
// Deprecated: use [log.WithLogger].
func WithLogger(ctx context.Context, logger *log.Entry) context.Context {
return log.WithLogger(ctx, logger)
}
// GetLogger retrieves the current logger from the context. If no logger is
// available, the default logger is returned.
//
// Deprecated: use [log.GetLogger].
func GetLogger(ctx context.Context) *log.Entry {
return log.GetLogger(ctx)
}

View File

@ -24,7 +24,6 @@ import (
"time" "time"
"github.com/containerd/containerd/containers" "github.com/containerd/containerd/containers"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/filters" "github.com/containerd/containerd/filters"
"github.com/containerd/containerd/identifiers" "github.com/containerd/containerd/identifiers"
"github.com/containerd/containerd/labels" "github.com/containerd/containerd/labels"
@ -32,6 +31,7 @@ import (
"github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/namespaces"
"github.com/containerd/containerd/protobuf/proto" "github.com/containerd/containerd/protobuf/proto"
"github.com/containerd/containerd/protobuf/types" "github.com/containerd/containerd/protobuf/types"
"github.com/containerd/errdefs"
"github.com/containerd/typeurl/v2" "github.com/containerd/typeurl/v2"
bolt "go.etcd.io/bbolt" bolt "go.etcd.io/bbolt"
) )

View File

@ -26,12 +26,12 @@ import (
"time" "time"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/filters" "github.com/containerd/containerd/filters"
"github.com/containerd/containerd/labels" "github.com/containerd/containerd/labels"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/metadata/boltutil" "github.com/containerd/containerd/metadata/boltutil"
"github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/namespaces"
"github.com/containerd/errdefs"
"github.com/containerd/log"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
bolt "go.etcd.io/bbolt" bolt "go.etcd.io/bbolt"

View File

@ -30,10 +30,10 @@ import (
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/events" "github.com/containerd/containerd/events"
"github.com/containerd/containerd/gc" "github.com/containerd/containerd/gc"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/namespaces"
"github.com/containerd/containerd/pkg/cleanup" "github.com/containerd/containerd/pkg/cleanup"
"github.com/containerd/containerd/snapshots" "github.com/containerd/containerd/snapshots"
"github.com/containerd/log"
bolt "go.etcd.io/bbolt" bolt "go.etcd.io/bbolt"
) )

View File

@ -26,7 +26,7 @@ import (
eventstypes "github.com/containerd/containerd/api/events" eventstypes "github.com/containerd/containerd/api/events"
"github.com/containerd/containerd/gc" "github.com/containerd/containerd/gc"
"github.com/containerd/containerd/log" "github.com/containerd/log"
bolt "go.etcd.io/bbolt" bolt "go.etcd.io/bbolt"
) )

View File

@ -25,13 +25,13 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/filters" "github.com/containerd/containerd/filters"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/labels" "github.com/containerd/containerd/labels"
"github.com/containerd/containerd/metadata/boltutil" "github.com/containerd/containerd/metadata/boltutil"
"github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/namespaces"
"github.com/containerd/containerd/pkg/epoch" "github.com/containerd/containerd/pkg/epoch"
"github.com/containerd/errdefs"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
bolt "go.etcd.io/bbolt" bolt "go.etcd.io/bbolt"

View File

@ -24,11 +24,11 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/filters" "github.com/containerd/containerd/filters"
"github.com/containerd/containerd/leases" "github.com/containerd/containerd/leases"
"github.com/containerd/containerd/metadata/boltutil" "github.com/containerd/containerd/metadata/boltutil"
"github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/namespaces"
"github.com/containerd/errdefs"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
bolt "go.etcd.io/bbolt" bolt "go.etcd.io/bbolt"
) )

View File

@ -21,10 +21,10 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/identifiers" "github.com/containerd/containerd/identifiers"
l "github.com/containerd/containerd/labels" l "github.com/containerd/containerd/labels"
"github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/namespaces"
"github.com/containerd/errdefs"
bolt "go.etcd.io/bbolt" bolt "go.etcd.io/bbolt"
) )

View File

@ -23,12 +23,12 @@ import (
"strings" "strings"
"time" "time"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/filters" "github.com/containerd/containerd/filters"
"github.com/containerd/containerd/identifiers" "github.com/containerd/containerd/identifiers"
"github.com/containerd/containerd/metadata/boltutil" "github.com/containerd/containerd/metadata/boltutil"
"github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/namespaces"
api "github.com/containerd/containerd/sandbox" api "github.com/containerd/containerd/sandbox"
"github.com/containerd/errdefs"
"github.com/containerd/typeurl/v2" "github.com/containerd/typeurl/v2"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
) )

View File

@ -25,14 +25,14 @@ import (
"time" "time"
eventstypes "github.com/containerd/containerd/api/events" eventstypes "github.com/containerd/containerd/api/events"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/filters" "github.com/containerd/containerd/filters"
"github.com/containerd/containerd/labels" "github.com/containerd/containerd/labels"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/metadata/boltutil" "github.com/containerd/containerd/metadata/boltutil"
"github.com/containerd/containerd/mount" "github.com/containerd/containerd/mount"
"github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/namespaces"
"github.com/containerd/containerd/snapshots" "github.com/containerd/containerd/snapshots"
"github.com/containerd/errdefs"
"github.com/containerd/log"
bolt "go.etcd.io/bbolt" bolt "go.etcd.io/bbolt"
) )

View File

@ -27,7 +27,7 @@ import (
"github.com/Microsoft/go-winio/pkg/bindfilter" "github.com/Microsoft/go-winio/pkg/bindfilter"
"github.com/Microsoft/hcsshim" "github.com/Microsoft/hcsshim"
"github.com/containerd/containerd/log" "github.com/containerd/log"
"golang.org/x/sys/windows" "golang.org/x/sys/windows"
) )

View File

@ -21,7 +21,7 @@ import (
"fmt" "fmt"
"os" "os"
"github.com/containerd/containerd/log" "github.com/containerd/log"
) )
var tempMountLocation = getTempDir() var tempMountLocation = getTempDir()

View File

@ -21,9 +21,9 @@ import (
"strings" "strings"
api "github.com/containerd/containerd/api/services/namespaces/v1" api "github.com/containerd/containerd/api/services/namespaces/v1"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/namespaces"
"github.com/containerd/containerd/protobuf/types" "github.com/containerd/containerd/protobuf/types"
"github.com/containerd/errdefs"
) )
// NewNamespaceStoreFromClient returns a new namespace store // NewNamespaceStoreFromClient returns a new namespace store

View File

@ -21,8 +21,8 @@ import (
"fmt" "fmt"
"os" "os"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/identifiers" "github.com/containerd/containerd/identifiers"
"github.com/containerd/errdefs"
) )
const ( const (

View File

@ -21,7 +21,7 @@ import (
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/labels" "github.com/containerd/containerd/labels"
"github.com/containerd/containerd/log" "github.com/containerd/log"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
) )

View File

@ -25,10 +25,10 @@ import (
transferapi "github.com/containerd/containerd/api/services/transfer/v1" transferapi "github.com/containerd/containerd/api/services/transfer/v1"
transfertypes "github.com/containerd/containerd/api/types/transfer" transfertypes "github.com/containerd/containerd/api/types/transfer"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/pkg/streaming" "github.com/containerd/containerd/pkg/streaming"
"github.com/containerd/containerd/pkg/transfer" "github.com/containerd/containerd/pkg/transfer"
tstreaming "github.com/containerd/containerd/pkg/transfer/streaming" tstreaming "github.com/containerd/containerd/pkg/transfer/streaming"
"github.com/containerd/log"
"github.com/containerd/typeurl/v2" "github.com/containerd/typeurl/v2"
) )

View File

@ -27,8 +27,8 @@ import (
"time" "time"
transferapi "github.com/containerd/containerd/api/types/transfer" transferapi "github.com/containerd/containerd/api/types/transfer"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/pkg/streaming" "github.com/containerd/containerd/pkg/streaming"
"github.com/containerd/log"
"github.com/containerd/typeurl/v2" "github.com/containerd/typeurl/v2"
) )

View File

@ -23,8 +23,8 @@ import (
"sync/atomic" "sync/atomic"
transferapi "github.com/containerd/containerd/api/types/transfer" transferapi "github.com/containerd/containerd/api/types/transfer"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/pkg/streaming" "github.com/containerd/containerd/pkg/streaming"
"github.com/containerd/log"
"github.com/containerd/typeurl/v2" "github.com/containerd/typeurl/v2"
) )

View File

@ -30,16 +30,16 @@ import (
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/diff" "github.com/containerd/containerd/diff"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/labels" "github.com/containerd/containerd/labels"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/mount" "github.com/containerd/containerd/mount"
"github.com/containerd/containerd/pkg/cleanup" "github.com/containerd/containerd/pkg/cleanup"
"github.com/containerd/containerd/pkg/kmutex" "github.com/containerd/containerd/pkg/kmutex"
"github.com/containerd/containerd/platforms" "github.com/containerd/containerd/platforms"
"github.com/containerd/containerd/snapshots" "github.com/containerd/containerd/snapshots"
"github.com/containerd/containerd/tracing" "github.com/containerd/containerd/tracing"
"github.com/containerd/errdefs"
"github.com/containerd/log"
"github.com/opencontainers/go-digest" "github.com/opencontainers/go-digest"
"github.com/opencontainers/image-spec/identity" "github.com/opencontainers/image-spec/identity"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"

View File

@ -20,7 +20,7 @@ import (
"runtime" "runtime"
"sync" "sync"
"github.com/containerd/containerd/log" "github.com/containerd/log"
) )
// Present the ARM instruction set architecture, eg: v7, v8 // Present the ARM instruction set architecture, eg: v7, v8

View File

@ -24,7 +24,7 @@ import (
"runtime" "runtime"
"strings" "strings"
"github.com/containerd/containerd/errdefs" "github.com/containerd/errdefs"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
) )

View File

@ -22,7 +22,7 @@ import (
"fmt" "fmt"
"runtime" "runtime"
"github.com/containerd/containerd/errdefs" "github.com/containerd/errdefs"
) )
func getCPUVariant() (string, error) { func getCPUVariant() (string, error) {

View File

@ -116,7 +116,7 @@ import (
specs "github.com/opencontainers/image-spec/specs-go/v1" specs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/containerd/containerd/errdefs" "github.com/containerd/errdefs"
) )
var ( var (

View File

@ -23,8 +23,8 @@ import (
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/events/exchange" "github.com/containerd/containerd/events/exchange"
"github.com/containerd/errdefs"
) )
// InitContext is used for plugin initialization // InitContext is used for plugin initialization

View File

@ -25,8 +25,8 @@ import (
"github.com/containerd/containerd/api/services/tasks/v1" "github.com/containerd/containerd/api/services/tasks/v1"
"github.com/containerd/containerd/cio" "github.com/containerd/containerd/cio"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/protobuf" "github.com/containerd/containerd/protobuf"
"github.com/containerd/errdefs"
) )
// Process represents a system process // Process represents a system process

View File

@ -24,7 +24,6 @@ import (
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"golang.org/x/sync/semaphore" "golang.org/x/sync/semaphore"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/pkg/unpack" "github.com/containerd/containerd/pkg/unpack"
"github.com/containerd/containerd/platforms" "github.com/containerd/containerd/platforms"
@ -32,6 +31,7 @@ import (
"github.com/containerd/containerd/remotes/docker" "github.com/containerd/containerd/remotes/docker"
"github.com/containerd/containerd/remotes/docker/schema1" //nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility. "github.com/containerd/containerd/remotes/docker/schema1" //nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
"github.com/containerd/containerd/tracing" "github.com/containerd/containerd/tracing"
"github.com/containerd/errdefs"
) )
const ( const (

View File

@ -26,9 +26,9 @@ import (
"strings" "strings"
"time" "time"
"github.com/containerd/containerd/log"
remoteserrors "github.com/containerd/containerd/remotes/errors" remoteserrors "github.com/containerd/containerd/remotes/errors"
"github.com/containerd/containerd/version" "github.com/containerd/containerd/version"
"github.com/containerd/log"
) )
var ( var (

View File

@ -25,10 +25,10 @@ import (
"strings" "strings"
"sync" "sync"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/remotes/docker/auth" "github.com/containerd/containerd/remotes/docker/auth"
remoteerrors "github.com/containerd/containerd/remotes/errors" remoteerrors "github.com/containerd/containerd/remotes/errors"
"github.com/containerd/errdefs"
"github.com/containerd/log"
) )
type dockerAuthorizer struct { type dockerAuthorizer struct {

View File

@ -24,8 +24,8 @@ import (
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/remotes" "github.com/containerd/containerd/remotes"
"github.com/containerd/log"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
) )

View File

@ -24,7 +24,7 @@ import (
fuzz "github.com/AdaLogics/go-fuzz-headers" fuzz "github.com/AdaLogics/go-fuzz-headers"
"github.com/containerd/containerd/content/local" "github.com/containerd/containerd/content/local"
"github.com/containerd/containerd/log" "github.com/containerd/log"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )

View File

@ -26,9 +26,9 @@ import (
"net/url" "net/url"
"strings" "strings"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/log" "github.com/containerd/errdefs"
"github.com/containerd/log"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
) )

View File

@ -25,8 +25,8 @@ import (
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/labels" "github.com/containerd/containerd/labels"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/reference" "github.com/containerd/containerd/reference"
"github.com/containerd/log"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
) )

View File

@ -21,8 +21,8 @@ import (
"fmt" "fmt"
"io" "io"
"github.com/containerd/containerd/errdefs" "github.com/containerd/errdefs"
"github.com/containerd/containerd/log" "github.com/containerd/log"
) )
const maxRetry = 3 const maxRetry = 3

Some files were not shown because too many files have changed in this diff Show More