Browse code

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 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>

Sebastiaan van Stijn authored on 2024/05/27 18:31:12
Showing 133 changed files
... ...
@@ -38,7 +38,7 @@ linters-settings:
38 38
     alias:
39 39
       # Enforce alias to prevent it accidentally being used instead of our
40 40
       # own errdefs package (or vice-versa).
41
-      - pkg: github.com/containerd/containerd/errdefs
41
+      - pkg: github.com/containerd/errdefs
42 42
         alias: cerrdefs
43 43
       - pkg: github.com/opencontainers/image-spec/specs-go/v1
44 44
         alias: ocispec
... ...
@@ -57,6 +57,10 @@ linters-settings:
57 57
             desc: Use "gotest.tools/v3/assert" instead
58 58
           - pkg: "github.com/stretchr/testify/suite"
59 59
             desc: Do not use
60
+          - pkg: github.com/containerd/containerd/errdefs
61
+            desc: The errdefs package has moved to a separate module, https://github.com/containerd/errdefs
62
+          - pkg: github.com/containerd/containerd/log
63
+            desc: The logs package has moved to a separate module, https://github.com/containerd/log
60 64
   revive:
61 65
     rules:
62 66
       # FIXME make sure all packages have a description. Currently, there's many packages without.
... ...
@@ -5,7 +5,7 @@ import (
5 5
 	"fmt"
6 6
 	"net/http"
7 7
 
8
-	cerrdefs "github.com/containerd/containerd/errdefs"
8
+	cerrdefs "github.com/containerd/errdefs"
9 9
 	"github.com/containerd/log"
10 10
 	"github.com/docker/distribution/registry/api/errcode"
11 11
 	"github.com/docker/docker/errdefs"
... ...
@@ -15,7 +15,6 @@ import (
15 15
 	"time"
16 16
 
17 17
 	"github.com/containerd/containerd/content"
18
-	cerrdefs "github.com/containerd/containerd/errdefs"
19 18
 	"github.com/containerd/containerd/gc"
20 19
 	"github.com/containerd/containerd/images"
21 20
 	"github.com/containerd/containerd/leases"
... ...
@@ -25,6 +24,7 @@ import (
25 25
 	"github.com/containerd/containerd/remotes"
26 26
 	"github.com/containerd/containerd/remotes/docker"
27 27
 	"github.com/containerd/containerd/remotes/docker/schema1" //nolint:staticcheck // Ignore SA1019: "github.com/containerd/containerd/remotes/docker/schema1" is deprecated: use images formatted in Docker Image Manifest v2, Schema 2, or OCI Image Spec v1.
28
+	cerrdefs "github.com/containerd/errdefs"
28 29
 	"github.com/containerd/log"
29 30
 	distreference "github.com/distribution/reference"
30 31
 	dimages "github.com/docker/docker/daemon/images"
... ...
@@ -7,10 +7,10 @@ import (
7 7
 	"strings"
8 8
 	"sync"
9 9
 
10
-	cerrdefs "github.com/containerd/containerd/errdefs"
11 10
 	"github.com/containerd/containerd/leases"
12 11
 	"github.com/containerd/containerd/mount"
13 12
 	"github.com/containerd/containerd/snapshots"
13
+	cerrdefs "github.com/containerd/errdefs"
14 14
 	"github.com/docker/docker/daemon/graphdriver"
15 15
 	"github.com/docker/docker/layer"
16 16
 	"github.com/docker/docker/pkg/idtools"
... ...
@@ -7,7 +7,7 @@ import (
7 7
 	"fmt"
8 8
 
9 9
 	"github.com/containerd/containerd/content"
10
-	cerrdefs "github.com/containerd/containerd/errdefs"
10
+	cerrdefs "github.com/containerd/errdefs"
11 11
 	"github.com/containerd/log"
12 12
 	"github.com/docker/docker/api/types/backend"
13 13
 	"github.com/docker/docker/api/types/container"
... ...
@@ -4,8 +4,8 @@ import (
4 4
 	"context"
5 5
 
6 6
 	"github.com/containerd/containerd/content"
7
-	cerrdefs "github.com/containerd/containerd/errdefs"
8 7
 	containerdimages "github.com/containerd/containerd/images"
8
+	cerrdefs "github.com/containerd/errdefs"
9 9
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
10 10
 )
11 11
 
... ...
@@ -10,9 +10,9 @@ import (
10 10
 	"sync/atomic"
11 11
 	"time"
12 12
 
13
-	cerrdefs "github.com/containerd/containerd/errdefs"
14 13
 	containerdimages "github.com/containerd/containerd/images"
15 14
 	"github.com/containerd/containerd/platforms"
15
+	cerrdefs "github.com/containerd/errdefs"
16 16
 	"github.com/containerd/log"
17 17
 	"github.com/distribution/reference"
18 18
 	"github.com/docker/docker/api/types/backend"
... ...
@@ -13,12 +13,12 @@ import (
13 13
 
14 14
 	"github.com/containerd/containerd"
15 15
 	"github.com/containerd/containerd/content"
16
-	cerrdefs "github.com/containerd/containerd/errdefs"
17 16
 	containerdimages "github.com/containerd/containerd/images"
18 17
 	"github.com/containerd/containerd/leases"
19 18
 	"github.com/containerd/containerd/mount"
20 19
 	"github.com/containerd/containerd/platforms"
21 20
 	"github.com/containerd/containerd/rootfs"
21
+	cerrdefs "github.com/containerd/errdefs"
22 22
 	"github.com/containerd/log"
23 23
 	"github.com/distribution/reference"
24 24
 	"github.com/docker/docker/api/types/backend"
... ...
@@ -12,11 +12,11 @@ import (
12 12
 
13 13
 	"github.com/containerd/containerd/content"
14 14
 	"github.com/containerd/containerd/diff"
15
-	cerrdefs "github.com/containerd/containerd/errdefs"
16 15
 	"github.com/containerd/containerd/leases"
17 16
 	"github.com/containerd/containerd/mount"
18 17
 	"github.com/containerd/containerd/pkg/cleanup"
19 18
 	"github.com/containerd/containerd/snapshots"
19
+	cerrdefs "github.com/containerd/errdefs"
20 20
 	"github.com/containerd/log"
21 21
 	"github.com/docker/docker/api/types/backend"
22 22
 	"github.com/docker/docker/image"
... ...
@@ -6,9 +6,9 @@ import (
6 6
 	"strings"
7 7
 	"time"
8 8
 
9
-	cerrdefs "github.com/containerd/containerd/errdefs"
10 9
 	"github.com/containerd/containerd/images"
11 10
 	containerdimages "github.com/containerd/containerd/images"
11
+	cerrdefs "github.com/containerd/errdefs"
12 12
 	"github.com/containerd/log"
13 13
 	"github.com/distribution/reference"
14 14
 	"github.com/docker/docker/api/types/events"
... ...
@@ -8,11 +8,11 @@ import (
8 8
 
9 9
 	"github.com/containerd/containerd"
10 10
 	"github.com/containerd/containerd/content"
11
-	cerrdefs "github.com/containerd/containerd/errdefs"
12 11
 	containerdimages "github.com/containerd/containerd/images"
13 12
 	"github.com/containerd/containerd/images/archive"
14 13
 	"github.com/containerd/containerd/leases"
15 14
 	"github.com/containerd/containerd/platforms"
15
+	cerrdefs "github.com/containerd/errdefs"
16 16
 	"github.com/containerd/log"
17 17
 	"github.com/distribution/reference"
18 18
 	"github.com/docker/docker/api/types/events"
... ...
@@ -10,9 +10,9 @@ import (
10 10
 	"time"
11 11
 
12 12
 	"github.com/containerd/containerd/content"
13
-	cerrdefs "github.com/containerd/containerd/errdefs"
14 13
 	"github.com/containerd/containerd/images"
15 14
 	"github.com/containerd/containerd/platforms"
15
+	cerrdefs "github.com/containerd/errdefs"
16 16
 	"github.com/containerd/log"
17 17
 	"github.com/distribution/reference"
18 18
 	"github.com/docker/docker/api/types/container"
... ...
@@ -10,12 +10,12 @@ import (
10 10
 	"time"
11 11
 
12 12
 	"github.com/containerd/containerd/content"
13
-	cerrdefs "github.com/containerd/containerd/errdefs"
14 13
 	"github.com/containerd/containerd/images"
15 14
 	"github.com/containerd/containerd/labels"
16 15
 	"github.com/containerd/containerd/platforms"
17 16
 	cplatforms "github.com/containerd/containerd/platforms"
18 17
 	"github.com/containerd/containerd/snapshots"
18
+	cerrdefs "github.com/containerd/errdefs"
19 19
 	"github.com/containerd/log"
20 20
 	"github.com/distribution/reference"
21 21
 	"github.com/docker/docker/api/types/backend"
... ...
@@ -4,8 +4,8 @@ import (
4 4
 	"context"
5 5
 	"strings"
6 6
 
7
-	cerrdefs "github.com/containerd/containerd/errdefs"
8 7
 	containerdimages "github.com/containerd/containerd/images"
8
+	cerrdefs "github.com/containerd/errdefs"
9 9
 	"github.com/containerd/log"
10 10
 	"github.com/distribution/reference"
11 11
 	"github.com/docker/docker/api/types"
... ...
@@ -9,11 +9,11 @@ import (
9 9
 	"time"
10 10
 
11 11
 	"github.com/containerd/containerd"
12
-	cerrdefs "github.com/containerd/containerd/errdefs"
13 12
 	"github.com/containerd/containerd/images"
14 13
 	"github.com/containerd/containerd/pkg/snapshotters"
15 14
 	"github.com/containerd/containerd/platforms"
16 15
 	"github.com/containerd/containerd/remotes/docker"
16
+	cerrdefs "github.com/containerd/errdefs"
17 17
 	"github.com/containerd/log"
18 18
 	"github.com/distribution/reference"
19 19
 	"github.com/docker/docker/api/types/events"
... ...
@@ -9,13 +9,13 @@ import (
9 9
 	"time"
10 10
 
11 11
 	"github.com/containerd/containerd/content"
12
-	cerrdefs "github.com/containerd/containerd/errdefs"
13 12
 	"github.com/containerd/containerd/images"
14 13
 	containerdimages "github.com/containerd/containerd/images"
15 14
 	containerdlabels "github.com/containerd/containerd/labels"
16 15
 	"github.com/containerd/containerd/platforms"
17 16
 	"github.com/containerd/containerd/remotes"
18 17
 	"github.com/containerd/containerd/remotes/docker"
18
+	cerrdefs "github.com/containerd/errdefs"
19 19
 	"github.com/containerd/log"
20 20
 	"github.com/distribution/reference"
21 21
 	"github.com/docker/docker/api/types/events"
... ...
@@ -5,12 +5,12 @@ import (
5 5
 	"fmt"
6 6
 
7 7
 	"github.com/containerd/containerd"
8
-	cerrdefs "github.com/containerd/containerd/errdefs"
9 8
 	containerdimages "github.com/containerd/containerd/images"
10 9
 	"github.com/containerd/containerd/leases"
11 10
 	"github.com/containerd/containerd/mount"
12 11
 	"github.com/containerd/containerd/platforms"
13 12
 	"github.com/containerd/containerd/snapshots"
13
+	cerrdefs "github.com/containerd/errdefs"
14 14
 	"github.com/docker/docker/errdefs"
15 15
 	"github.com/opencontainers/image-spec/identity"
16 16
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
... ...
@@ -4,8 +4,8 @@ import (
4 4
 	"context"
5 5
 	"fmt"
6 6
 
7
-	cerrdefs "github.com/containerd/containerd/errdefs"
8 7
 	containerdimages "github.com/containerd/containerd/images"
8
+	cerrdefs "github.com/containerd/errdefs"
9 9
 	"github.com/containerd/log"
10 10
 	"github.com/distribution/reference"
11 11
 	"github.com/docker/docker/api/types/events"
... ...
@@ -7,10 +7,10 @@ import (
7 7
 	"time"
8 8
 
9 9
 	"github.com/containerd/containerd/content"
10
-	cerrdefs "github.com/containerd/containerd/errdefs"
11 10
 	"github.com/containerd/containerd/images"
12 11
 	"github.com/containerd/containerd/remotes"
13 12
 	"github.com/containerd/containerd/remotes/docker"
13
+	cerrdefs "github.com/containerd/errdefs"
14 14
 	"github.com/containerd/log"
15 15
 	"github.com/distribution/reference"
16 16
 	"github.com/docker/docker/internal/compatcontext"
... ...
@@ -6,10 +6,10 @@ import (
6 6
 	"errors"
7 7
 	"net/http"
8 8
 
9
-	cerrdefs "github.com/containerd/containerd/errdefs"
10 9
 	"github.com/containerd/containerd/remotes"
11 10
 	"github.com/containerd/containerd/remotes/docker"
12 11
 	"github.com/containerd/containerd/version"
12
+	cerrdefs "github.com/containerd/errdefs"
13 13
 	"github.com/containerd/log"
14 14
 	"github.com/distribution/reference"
15 15
 	registrytypes "github.com/docker/docker/api/types/registry"
... ...
@@ -7,11 +7,11 @@ import (
7 7
 
8 8
 	"github.com/containerd/containerd"
9 9
 	"github.com/containerd/containerd/content"
10
-	cerrdefs "github.com/containerd/containerd/errdefs"
11 10
 	"github.com/containerd/containerd/images"
12 11
 	"github.com/containerd/containerd/plugin"
13 12
 	"github.com/containerd/containerd/remotes/docker"
14 13
 	"github.com/containerd/containerd/snapshots"
14
+	cerrdefs "github.com/containerd/errdefs"
15 15
 	"github.com/containerd/log"
16 16
 	"github.com/distribution/reference"
17 17
 	"github.com/docker/docker/container"
... ...
@@ -3,8 +3,8 @@ package containerd
3 3
 import (
4 4
 	"context"
5 5
 
6
-	cerrdefs "github.com/containerd/containerd/errdefs"
7 6
 	containerdimages "github.com/containerd/containerd/images"
7
+	cerrdefs "github.com/containerd/errdefs"
8 8
 	"github.com/docker/docker/errdefs"
9 9
 	"github.com/docker/docker/internal/compatcontext"
10 10
 	"github.com/opencontainers/go-digest"
... ...
@@ -4,8 +4,8 @@ import (
4 4
 	"context"
5 5
 
6 6
 	"github.com/containerd/containerd/content"
7
-	cerrdefs "github.com/containerd/containerd/errdefs"
8 7
 	containerdlabels "github.com/containerd/containerd/labels"
8
+	cerrdefs "github.com/containerd/errdefs"
9 9
 	"github.com/distribution/reference"
10 10
 	"github.com/opencontainers/go-digest"
11 11
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
... ...
@@ -8,8 +8,8 @@ import (
8 8
 	"strings"
9 9
 	"time"
10 10
 
11
-	cerrdefs "github.com/containerd/containerd/errdefs"
12 11
 	"github.com/containerd/containerd/leases"
12
+	cerrdefs "github.com/containerd/errdefs"
13 13
 	"github.com/containerd/log"
14 14
 	"github.com/docker/docker/api/types/backend"
15 15
 	containertypes "github.com/docker/docker/api/types/container"
... ...
@@ -7,10 +7,10 @@ import (
7 7
 	"io"
8 8
 
9 9
 	"github.com/containerd/containerd/content"
10
-	cerrdefs "github.com/containerd/containerd/errdefs"
11 10
 	"github.com/containerd/containerd/images"
12 11
 	"github.com/containerd/containerd/leases"
13 12
 	"github.com/containerd/containerd/platforms"
13
+	cerrdefs "github.com/containerd/errdefs"
14 14
 	"github.com/containerd/log"
15 15
 	"github.com/distribution/reference"
16 16
 	"github.com/docker/docker/api/types/backend"
... ...
@@ -5,9 +5,9 @@ import (
5 5
 	"sync"
6 6
 
7 7
 	"github.com/containerd/containerd/content"
8
-	cerrdefs "github.com/containerd/containerd/errdefs"
9 8
 	"github.com/containerd/containerd/leases"
10 9
 	"github.com/containerd/containerd/namespaces"
10
+	cerrdefs "github.com/containerd/errdefs"
11 11
 	"github.com/containerd/log"
12 12
 	"github.com/docker/docker/distribution"
13 13
 	"github.com/docker/docker/image"
... ...
@@ -8,10 +8,10 @@ import (
8 8
 
9 9
 	"github.com/containerd/containerd/content"
10 10
 	"github.com/containerd/containerd/content/local"
11
-	cerrdefs "github.com/containerd/containerd/errdefs"
12 11
 	"github.com/containerd/containerd/leases"
13 12
 	"github.com/containerd/containerd/metadata"
14 13
 	"github.com/containerd/containerd/namespaces"
14
+	cerrdefs "github.com/containerd/errdefs"
15 15
 	"github.com/docker/docker/image"
16 16
 	"github.com/opencontainers/go-digest"
17 17
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
... ...
@@ -9,8 +9,8 @@ import (
9 9
 	"strings"
10 10
 
11 11
 	"github.com/containerd/containerd/content"
12
-	cerrdefs "github.com/containerd/containerd/errdefs"
13 12
 	"github.com/containerd/containerd/remotes"
13
+	cerrdefs "github.com/containerd/errdefs"
14 14
 	"github.com/containerd/log"
15 15
 	"github.com/distribution/reference"
16 16
 	"github.com/docker/distribution"
... ...
@@ -10,8 +10,8 @@ import (
10 10
 
11 11
 	"github.com/containerd/containerd/content"
12 12
 	"github.com/containerd/containerd/content/local"
13
-	cerrdefs "github.com/containerd/containerd/errdefs"
14 13
 	"github.com/containerd/containerd/remotes"
14
+	cerrdefs "github.com/containerd/errdefs"
15 15
 	"github.com/distribution/reference"
16 16
 	"github.com/docker/distribution"
17 17
 	"github.com/docker/distribution/manifest/manifestlist"
... ...
@@ -5,7 +5,7 @@ import (
5 5
 	"testing"
6 6
 	"time"
7 7
 
8
-	cerrdefs "github.com/containerd/containerd/errdefs"
8
+	cerrdefs "github.com/containerd/errdefs"
9 9
 	"github.com/docker/docker/api/types"
10 10
 	containertypes "github.com/docker/docker/api/types/container"
11 11
 	"github.com/docker/docker/api/types/events"
... ...
@@ -18,7 +18,7 @@ import (
18 18
 	"github.com/Microsoft/hcsshim"
19 19
 	"github.com/containerd/containerd"
20 20
 	"github.com/containerd/containerd/cio"
21
-	cerrdefs "github.com/containerd/containerd/errdefs"
21
+	cerrdefs "github.com/containerd/errdefs"
22 22
 	"github.com/containerd/log"
23 23
 	"github.com/docker/docker/errdefs"
24 24
 	"github.com/docker/docker/libcontainerd/queue"
... ...
@@ -19,10 +19,10 @@ import (
19 19
 	"github.com/containerd/containerd/archive"
20 20
 	"github.com/containerd/containerd/cio"
21 21
 	"github.com/containerd/containerd/content"
22
-	cerrdefs "github.com/containerd/containerd/errdefs"
23 22
 	"github.com/containerd/containerd/images"
24 23
 	"github.com/containerd/containerd/protobuf"
25 24
 	v2runcoptions "github.com/containerd/containerd/runtime/v2/runc/options"
25
+	cerrdefs "github.com/containerd/errdefs"
26 26
 	"github.com/containerd/log"
27 27
 	"github.com/containerd/typeurl/v2"
28 28
 	"github.com/docker/docker/errdefs"
... ...
@@ -7,10 +7,10 @@ import (
7 7
 	"time"
8 8
 
9 9
 	"github.com/containerd/containerd/content"
10
-	cerrdefs "github.com/containerd/containerd/errdefs"
11 10
 	"github.com/containerd/containerd/images"
12 11
 	"github.com/containerd/containerd/remotes"
13 12
 	"github.com/containerd/containerd/remotes/docker"
13
+	cerrdefs "github.com/containerd/errdefs"
14 14
 	"github.com/containerd/log"
15 15
 	"github.com/distribution/reference"
16 16
 	"github.com/docker/docker/api/types/registry"
... ...
@@ -25,8 +25,9 @@ require (
25 25
 	github.com/aws/smithy-go v1.19.0
26 26
 	github.com/cloudflare/cfssl v1.6.4
27 27
 	github.com/containerd/cgroups/v3 v3.0.3
28
-	github.com/containerd/containerd v1.7.17
28
+	github.com/containerd/containerd v1.7.18
29 29
 	github.com/containerd/continuity v0.4.3
30
+	github.com/containerd/errdefs v0.1.0
30 31
 	github.com/containerd/fifo v1.1.0
31 32
 	github.com/containerd/log v0.1.0
32 33
 	github.com/containerd/typeurl/v2 v2.1.1
... ...
@@ -156,10 +156,12 @@ github.com/containerd/cgroups/v3 v3.0.3 h1:S5ByHZ/h9PMe5IOQoN7E+nMc2UcLEM/V48DGD
156 156
 github.com/containerd/cgroups/v3 v3.0.3/go.mod h1:8HBe7V3aWGLFPd/k03swSIsGjZhHI2WzJmticMgVuz0=
157 157
 github.com/containerd/console v1.0.4 h1:F2g4+oChYvBTsASRTz8NP6iIAi97J3TtSAsLbIFn4ro=
158 158
 github.com/containerd/console v1.0.4/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk=
159
-github.com/containerd/containerd v1.7.17 h1:KjNnn0+tAVQHAoaWRjmdak9WlvnFR/8rU1CHHy8Rm2A=
160
-github.com/containerd/containerd v1.7.17/go.mod h1:vK+hhT4TIv2uejlcDlbVIc8+h/BqtKLIyNrtCZol8lI=
159
+github.com/containerd/containerd v1.7.18 h1:jqjZTQNfXGoEaZdW1WwPU0RqSn1Bm2Ay/KJPUuO8nao=
160
+github.com/containerd/containerd v1.7.18/go.mod h1:IYEk9/IO6wAPUz2bCMVUbsfXjzw5UNP5fLz4PsUygQ4=
161 161
 github.com/containerd/continuity v0.4.3 h1:6HVkalIp+2u1ZLH1J/pYX2oBVXlJZvh1X1A7bEZ9Su8=
162 162
 github.com/containerd/continuity v0.4.3/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ=
163
+github.com/containerd/errdefs v0.1.0 h1:m0wCRBiu1WJT/Fr+iOoQHMQS/eP5myQ8lCv4Dz5ZURM=
164
+github.com/containerd/errdefs v0.1.0/go.mod h1:YgWiiHtLmSeBrvpw+UfPijzbLaB77mEG1WwJTDETIV0=
163 165
 github.com/containerd/fifo v1.1.0 h1:4I2mbh5stb1u6ycIABlBw9zgtlK8viPI9QkQNRQEEmY=
164 166
 github.com/containerd/fifo v1.1.0/go.mod h1:bmC4NWMbXlt2EZ0Hc7Fx7QzTFxgPID13eH0Qu+MAb2o=
165 167
 github.com/containerd/go-cni v1.1.9 h1:ORi7P1dYzCwVM6XPN4n3CbkuOx/NZ2DOqy+SHRdo9rU=
... ...
@@ -102,7 +102,7 @@ EOF
102 102
   config.vm.provision "install-golang", type: "shell", run: "once" do |sh|
103 103
     sh.upload_path = "/tmp/vagrant-install-golang"
104 104
     sh.env = {
105
-        'GO_VERSION': ENV['GO_VERSION'] || "1.21.10",
105
+        'GO_VERSION': ENV['GO_VERSION'] || "1.21.11",
106 106
     }
107 107
     sh.inline = <<~SHELL
108 108
         #!/usr/bin/env bash
... ...
@@ -29,7 +29,7 @@ import (
29 29
 	"strconv"
30 30
 	"sync"
31 31
 
32
-	"github.com/containerd/containerd/log"
32
+	"github.com/containerd/log"
33 33
 	"github.com/klauspost/compress/zstd"
34 34
 )
35 35
 
... ...
@@ -30,10 +30,10 @@ import (
30 30
 	"time"
31 31
 
32 32
 	"github.com/containerd/containerd/archive/tarheader"
33
-	"github.com/containerd/containerd/log"
34 33
 	"github.com/containerd/containerd/pkg/epoch"
35 34
 	"github.com/containerd/containerd/pkg/userns"
36 35
 	"github.com/containerd/continuity/fs"
36
+	"github.com/containerd/log"
37 37
 )
38 38
 
39 39
 var bufPool = &sync.Pool{
... ...
@@ -22,7 +22,7 @@ import (
22 22
 	"io"
23 23
 
24 24
 	winio "github.com/Microsoft/go-winio"
25
-	"github.com/containerd/containerd/log"
25
+	"github.com/containerd/log"
26 26
 )
27 27
 
28 28
 const pipeRoot = `\\.\pipe`
... ...
@@ -44,7 +44,6 @@ import (
44 44
 	"github.com/containerd/containerd/content"
45 45
 	contentproxy "github.com/containerd/containerd/content/proxy"
46 46
 	"github.com/containerd/containerd/defaults"
47
-	"github.com/containerd/containerd/errdefs"
48 47
 	"github.com/containerd/containerd/events"
49 48
 	"github.com/containerd/containerd/images"
50 49
 	"github.com/containerd/containerd/leases"
... ...
@@ -61,6 +60,7 @@ import (
61 61
 	"github.com/containerd/containerd/services/introspection"
62 62
 	"github.com/containerd/containerd/snapshots"
63 63
 	snproxy "github.com/containerd/containerd/snapshots/proxy"
64
+	"github.com/containerd/errdefs"
64 65
 	"github.com/containerd/typeurl/v2"
65 66
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
66 67
 	"github.com/opencontainers/runtime-spec/specs-go"
... ...
@@ -29,11 +29,11 @@ import (
29 29
 	tasktypes "github.com/containerd/containerd/api/types/task"
30 30
 	"github.com/containerd/containerd/cio"
31 31
 	"github.com/containerd/containerd/containers"
32
-	"github.com/containerd/containerd/errdefs"
33 32
 	"github.com/containerd/containerd/images"
34 33
 	"github.com/containerd/containerd/oci"
35 34
 	"github.com/containerd/containerd/protobuf"
36 35
 	"github.com/containerd/containerd/runtime/v2/runc/options"
36
+	"github.com/containerd/errdefs"
37 37
 	"github.com/containerd/fifo"
38 38
 	"github.com/containerd/typeurl/v2"
39 39
 	ver "github.com/opencontainers/image-spec/specs-go"
... ...
@@ -24,12 +24,12 @@ import (
24 24
 
25 25
 	"github.com/containerd/containerd/containers"
26 26
 	"github.com/containerd/containerd/content"
27
-	"github.com/containerd/containerd/errdefs"
28 27
 	"github.com/containerd/containerd/images"
29 28
 	"github.com/containerd/containerd/namespaces"
30 29
 	"github.com/containerd/containerd/oci"
31 30
 	"github.com/containerd/containerd/protobuf"
32 31
 	"github.com/containerd/containerd/snapshots"
32
+	"github.com/containerd/errdefs"
33 33
 	"github.com/containerd/typeurl/v2"
34 34
 	"github.com/opencontainers/image-spec/identity"
35 35
 	v1 "github.com/opencontainers/image-spec/specs-go/v1"
... ...
@@ -26,8 +26,8 @@ import (
26 26
 	"syscall"
27 27
 
28 28
 	"github.com/containerd/containerd/containers"
29
-	"github.com/containerd/containerd/errdefs"
30 29
 	"github.com/containerd/containerd/mount"
30
+	"github.com/containerd/errdefs"
31 31
 	"github.com/opencontainers/image-spec/identity"
32 32
 )
33 33
 
... ...
@@ -23,9 +23,9 @@ import (
23 23
 
24 24
 	containersapi "github.com/containerd/containerd/api/services/containers/v1"
25 25
 	"github.com/containerd/containerd/containers"
26
-	"github.com/containerd/containerd/errdefs"
27 26
 	"github.com/containerd/containerd/protobuf"
28 27
 	ptypes "github.com/containerd/containerd/protobuf/types"
28
+	"github.com/containerd/errdefs"
29 29
 	"github.com/containerd/typeurl/v2"
30 30
 	"google.golang.org/grpc/codes"
31 31
 	"google.golang.org/grpc/status"
... ...
@@ -24,9 +24,9 @@ import (
24 24
 	"sync"
25 25
 	"time"
26 26
 
27
-	"github.com/containerd/containerd/errdefs"
28
-	"github.com/containerd/containerd/log"
29 27
 	"github.com/containerd/containerd/pkg/randutil"
28
+	"github.com/containerd/errdefs"
29
+	"github.com/containerd/log"
30 30
 	"github.com/opencontainers/go-digest"
31 31
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
32 32
 )
... ...
@@ -21,7 +21,7 @@ import (
21 21
 	"sync"
22 22
 	"time"
23 23
 
24
-	"github.com/containerd/containerd/errdefs"
24
+	"github.com/containerd/errdefs"
25 25
 )
26 26
 
27 27
 // Handles locking references
... ...
@@ -22,7 +22,7 @@ import (
22 22
 	"os"
23 23
 
24 24
 	"github.com/containerd/containerd/content"
25
-	"github.com/containerd/containerd/errdefs"
25
+	"github.com/containerd/errdefs"
26 26
 )
27 27
 
28 28
 // readerat implements io.ReaderAt in a completely stateless manner by opening
... ...
@@ -28,10 +28,10 @@ import (
28 28
 	"time"
29 29
 
30 30
 	"github.com/containerd/containerd/content"
31
-	"github.com/containerd/containerd/errdefs"
32 31
 	"github.com/containerd/containerd/filters"
33
-	"github.com/containerd/containerd/log"
34 32
 	"github.com/containerd/containerd/pkg/randutil"
33
+	"github.com/containerd/errdefs"
34
+	"github.com/containerd/log"
35 35
 	"github.com/sirupsen/logrus"
36 36
 
37 37
 	"github.com/opencontainers/go-digest"
... ...
@@ -27,8 +27,8 @@ import (
27 27
 	"time"
28 28
 
29 29
 	"github.com/containerd/containerd/content"
30
-	"github.com/containerd/containerd/errdefs"
31
-	"github.com/containerd/containerd/log"
30
+	"github.com/containerd/errdefs"
31
+	"github.com/containerd/log"
32 32
 	"github.com/opencontainers/go-digest"
33 33
 )
34 34
 
... ...
@@ -22,9 +22,9 @@ import (
22 22
 
23 23
 	contentapi "github.com/containerd/containerd/api/services/content/v1"
24 24
 	"github.com/containerd/containerd/content"
25
-	"github.com/containerd/containerd/errdefs"
26 25
 	"github.com/containerd/containerd/protobuf"
27 26
 	protobuftypes "github.com/containerd/containerd/protobuf/types"
27
+	"github.com/containerd/errdefs"
28 28
 	digest "github.com/opencontainers/go-digest"
29 29
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
30 30
 )
... ...
@@ -23,8 +23,8 @@ import (
23 23
 
24 24
 	contentapi "github.com/containerd/containerd/api/services/content/v1"
25 25
 	"github.com/containerd/containerd/content"
26
-	"github.com/containerd/containerd/errdefs"
27 26
 	"github.com/containerd/containerd/protobuf"
27
+	"github.com/containerd/errdefs"
28 28
 	digest "github.com/opencontainers/go-digest"
29 29
 )
30 30
 
... ...
@@ -22,11 +22,11 @@ import (
22 22
 	diffapi "github.com/containerd/containerd/api/services/diff/v1"
23 23
 	"github.com/containerd/containerd/api/types"
24 24
 	"github.com/containerd/containerd/diff"
25
-	"github.com/containerd/containerd/errdefs"
26 25
 	"github.com/containerd/containerd/mount"
27 26
 	"github.com/containerd/containerd/pkg/epoch"
28 27
 	"github.com/containerd/containerd/protobuf"
29 28
 	ptypes "github.com/containerd/containerd/protobuf/types"
29
+	"github.com/containerd/errdefs"
30 30
 	"github.com/opencontainers/go-digest"
31 31
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
32 32
 
... ...
@@ -29,11 +29,11 @@ import (
29 29
 	"github.com/containerd/containerd/archive/compression"
30 30
 	"github.com/containerd/containerd/content"
31 31
 	"github.com/containerd/containerd/diff"
32
-	"github.com/containerd/containerd/errdefs"
33 32
 	"github.com/containerd/containerd/labels"
34
-	"github.com/containerd/containerd/log"
35 33
 	"github.com/containerd/containerd/mount"
36 34
 	"github.com/containerd/containerd/pkg/epoch"
35
+	"github.com/containerd/errdefs"
36
+	"github.com/containerd/log"
37 37
 	digest "github.com/opencontainers/go-digest"
38 38
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
39 39
 )
40 40
new file mode 100644
... ...
@@ -0,0 +1,116 @@
0
+/*
1
+   Copyright The containerd Authors.
2
+
3
+   Licensed under the Apache License, Version 2.0 (the "License");
4
+   you may not use this file except in compliance with the License.
5
+   You may obtain a copy of the License at
6
+
7
+       http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+   Unless required by applicable law or agreed to in writing, software
10
+   distributed under the License is distributed on an "AS IS" BASIS,
11
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+   See the License for the specific language governing permissions and
13
+   limitations under the License.
14
+*/
15
+
16
+// Package errdefs defines the common errors used throughout containerd
17
+// packages.
18
+//
19
+// Use with fmt.Errorf to add context to an error.
20
+//
21
+// To detect an error class, use the IsXXX functions to tell whether an error
22
+// is of a certain type.
23
+//
24
+// The functions ToGRPC and FromGRPC can be used to map server-side and
25
+// client-side errors to the correct types.
26
+package errdefs
27
+
28
+import (
29
+	"github.com/containerd/errdefs"
30
+)
31
+
32
+// Definitions of common error types used throughout containerd. All containerd
33
+// errors returned by most packages will map into one of these errors classes.
34
+// Packages should return errors of these types when they want to instruct a
35
+// client to take a particular action.
36
+//
37
+// For the most part, we just try to provide local grpc errors. Most conditions
38
+// map very well to those defined by grpc.
39
+var (
40
+	ErrUnknown            = errdefs.ErrUnknown
41
+	ErrInvalidArgument    = errdefs.ErrInvalidArgument
42
+	ErrNotFound           = errdefs.ErrNotFound
43
+	ErrAlreadyExists      = errdefs.ErrAlreadyExists
44
+	ErrFailedPrecondition = errdefs.ErrFailedPrecondition
45
+	ErrUnavailable        = errdefs.ErrUnavailable
46
+	ErrNotImplemented     = errdefs.ErrNotImplemented
47
+)
48
+
49
+// IsInvalidArgument returns true if the error is due to an invalid argument
50
+func IsInvalidArgument(err error) bool {
51
+	return errdefs.IsInvalidArgument(err)
52
+}
53
+
54
+// IsNotFound returns true if the error is due to a missing object
55
+func IsNotFound(err error) bool {
56
+	return errdefs.IsNotFound(err)
57
+}
58
+
59
+// IsAlreadyExists returns true if the error is due to an already existing
60
+// metadata item
61
+func IsAlreadyExists(err error) bool {
62
+	return errdefs.IsAlreadyExists(err)
63
+}
64
+
65
+// IsFailedPrecondition returns true if an operation could not proceed to the
66
+// lack of a particular condition
67
+func IsFailedPrecondition(err error) bool {
68
+	return errdefs.IsFailedPrecondition(err)
69
+}
70
+
71
+// IsUnavailable returns true if the error is due to a resource being unavailable
72
+func IsUnavailable(err error) bool {
73
+	return errdefs.IsUnavailable(err)
74
+}
75
+
76
+// IsNotImplemented returns true if the error is due to not being implemented
77
+func IsNotImplemented(err error) bool {
78
+	return errdefs.IsNotImplemented(err)
79
+}
80
+
81
+// IsCanceled returns true if the error is due to `context.Canceled`.
82
+func IsCanceled(err error) bool {
83
+	return errdefs.IsCanceled(err)
84
+}
85
+
86
+// IsDeadlineExceeded returns true if the error is due to
87
+// `context.DeadlineExceeded`.
88
+func IsDeadlineExceeded(err error) bool {
89
+	return errdefs.IsDeadlineExceeded(err)
90
+}
91
+
92
+// ToGRPC will attempt to map the backend containerd error into a grpc error,
93
+// using the original error message as a description.
94
+//
95
+// Further information may be extracted from certain errors depending on their
96
+// type.
97
+//
98
+// If the error is unmapped, the original error will be returned to be handled
99
+// by the regular grpc error handling stack.
100
+func ToGRPC(err error) error {
101
+	return errdefs.ToGRPC(err)
102
+}
103
+
104
+// ToGRPCf maps the error to grpc error codes, assembling the formatting string
105
+// and combining it with the target error string.
106
+//
107
+// This is equivalent to errdefs.ToGRPC(fmt.Errorf("%s: %w", fmt.Sprintf(format, args...), err))
108
+func ToGRPCf(err error, format string, args ...interface{}) error {
109
+	return errdefs.ToGRPCf(err, format, args...)
110
+}
111
+
112
+// FromGRPC returns the underlying error from a grpc service based on the grpc error code
113
+func FromGRPC(err error) error {
114
+	return errdefs.FromGRPC(err)
115
+}
0 116
deleted file mode 100644
... ...
@@ -1,92 +0,0 @@
1
-/*
2
-   Copyright The containerd Authors.
3
-
4
-   Licensed under the Apache License, Version 2.0 (the "License");
5
-   you may not use this file except in compliance with the License.
6
-   You may obtain a copy of the License at
7
-
8
-       http://www.apache.org/licenses/LICENSE-2.0
9
-
10
-   Unless required by applicable law or agreed to in writing, software
11
-   distributed under the License is distributed on an "AS IS" BASIS,
12
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-   See the License for the specific language governing permissions and
14
-   limitations under the License.
15
-*/
16
-
17
-// Package errdefs defines the common errors used throughout containerd
18
-// packages.
19
-//
20
-// Use with fmt.Errorf to add context to an error.
21
-//
22
-// To detect an error class, use the IsXXX functions to tell whether an error
23
-// is of a certain type.
24
-//
25
-// The functions ToGRPC and FromGRPC can be used to map server-side and
26
-// client-side errors to the correct types.
27
-package errdefs
28
-
29
-import (
30
-	"context"
31
-	"errors"
32
-)
33
-
34
-// Definitions of common error types used throughout containerd. All containerd
35
-// errors returned by most packages will map into one of these errors classes.
36
-// Packages should return errors of these types when they want to instruct a
37
-// client to take a particular action.
38
-//
39
-// For the most part, we just try to provide local grpc errors. Most conditions
40
-// map very well to those defined by grpc.
41
-var (
42
-	ErrUnknown            = errors.New("unknown") // used internally to represent a missed mapping.
43
-	ErrInvalidArgument    = errors.New("invalid argument")
44
-	ErrNotFound           = errors.New("not found")
45
-	ErrAlreadyExists      = errors.New("already exists")
46
-	ErrFailedPrecondition = errors.New("failed precondition")
47
-	ErrUnavailable        = errors.New("unavailable")
48
-	ErrNotImplemented     = errors.New("not implemented") // represents not supported and unimplemented
49
-)
50
-
51
-// IsInvalidArgument returns true if the error is due to an invalid argument
52
-func IsInvalidArgument(err error) bool {
53
-	return errors.Is(err, ErrInvalidArgument)
54
-}
55
-
56
-// IsNotFound returns true if the error is due to a missing object
57
-func IsNotFound(err error) bool {
58
-	return errors.Is(err, ErrNotFound)
59
-}
60
-
61
-// IsAlreadyExists returns true if the error is due to an already existing
62
-// metadata item
63
-func IsAlreadyExists(err error) bool {
64
-	return errors.Is(err, ErrAlreadyExists)
65
-}
66
-
67
-// IsFailedPrecondition returns true if an operation could not proceed to the
68
-// lack of a particular condition
69
-func IsFailedPrecondition(err error) bool {
70
-	return errors.Is(err, ErrFailedPrecondition)
71
-}
72
-
73
-// IsUnavailable returns true if the error is due to a resource being unavailable
74
-func IsUnavailable(err error) bool {
75
-	return errors.Is(err, ErrUnavailable)
76
-}
77
-
78
-// IsNotImplemented returns true if the error is due to not being implemented
79
-func IsNotImplemented(err error) bool {
80
-	return errors.Is(err, ErrNotImplemented)
81
-}
82
-
83
-// IsCanceled returns true if the error is due to `context.Canceled`.
84
-func IsCanceled(err error) bool {
85
-	return errors.Is(err, context.Canceled)
86
-}
87
-
88
-// IsDeadlineExceeded returns true if the error is due to
89
-// `context.DeadlineExceeded`.
90
-func IsDeadlineExceeded(err error) bool {
91
-	return errors.Is(err, context.DeadlineExceeded)
92
-}
93 1
deleted file mode 100644
... ...
@@ -1,147 +0,0 @@
1
-/*
2
-   Copyright The containerd Authors.
3
-
4
-   Licensed under the Apache License, Version 2.0 (the "License");
5
-   you may not use this file except in compliance with the License.
6
-   You may obtain a copy of the License at
7
-
8
-       http://www.apache.org/licenses/LICENSE-2.0
9
-
10
-   Unless required by applicable law or agreed to in writing, software
11
-   distributed under the License is distributed on an "AS IS" BASIS,
12
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-   See the License for the specific language governing permissions and
14
-   limitations under the License.
15
-*/
16
-
17
-package errdefs
18
-
19
-import (
20
-	"context"
21
-	"fmt"
22
-	"strings"
23
-
24
-	"google.golang.org/grpc/codes"
25
-	"google.golang.org/grpc/status"
26
-)
27
-
28
-// ToGRPC will attempt to map the backend containerd error into a grpc error,
29
-// using the original error message as a description.
30
-//
31
-// Further information may be extracted from certain errors depending on their
32
-// type.
33
-//
34
-// If the error is unmapped, the original error will be returned to be handled
35
-// by the regular grpc error handling stack.
36
-func ToGRPC(err error) error {
37
-	if err == nil {
38
-		return nil
39
-	}
40
-
41
-	if isGRPCError(err) {
42
-		// error has already been mapped to grpc
43
-		return err
44
-	}
45
-
46
-	switch {
47
-	case IsInvalidArgument(err):
48
-		return status.Errorf(codes.InvalidArgument, err.Error())
49
-	case IsNotFound(err):
50
-		return status.Errorf(codes.NotFound, err.Error())
51
-	case IsAlreadyExists(err):
52
-		return status.Errorf(codes.AlreadyExists, err.Error())
53
-	case IsFailedPrecondition(err):
54
-		return status.Errorf(codes.FailedPrecondition, err.Error())
55
-	case IsUnavailable(err):
56
-		return status.Errorf(codes.Unavailable, err.Error())
57
-	case IsNotImplemented(err):
58
-		return status.Errorf(codes.Unimplemented, err.Error())
59
-	case IsCanceled(err):
60
-		return status.Errorf(codes.Canceled, err.Error())
61
-	case IsDeadlineExceeded(err):
62
-		return status.Errorf(codes.DeadlineExceeded, err.Error())
63
-	}
64
-
65
-	return err
66
-}
67
-
68
-// ToGRPCf maps the error to grpc error codes, assembling the formatting string
69
-// and combining it with the target error string.
70
-//
71
-// This is equivalent to errdefs.ToGRPC(fmt.Errorf("%s: %w", fmt.Sprintf(format, args...), err))
72
-func ToGRPCf(err error, format string, args ...interface{}) error {
73
-	return ToGRPC(fmt.Errorf("%s: %w", fmt.Sprintf(format, args...), err))
74
-}
75
-
76
-// FromGRPC returns the underlying error from a grpc service based on the grpc error code
77
-func FromGRPC(err error) error {
78
-	if err == nil {
79
-		return nil
80
-	}
81
-
82
-	var cls error // divide these into error classes, becomes the cause
83
-
84
-	switch code(err) {
85
-	case codes.InvalidArgument:
86
-		cls = ErrInvalidArgument
87
-	case codes.AlreadyExists:
88
-		cls = ErrAlreadyExists
89
-	case codes.NotFound:
90
-		cls = ErrNotFound
91
-	case codes.Unavailable:
92
-		cls = ErrUnavailable
93
-	case codes.FailedPrecondition:
94
-		cls = ErrFailedPrecondition
95
-	case codes.Unimplemented:
96
-		cls = ErrNotImplemented
97
-	case codes.Canceled:
98
-		cls = context.Canceled
99
-	case codes.DeadlineExceeded:
100
-		cls = context.DeadlineExceeded
101
-	default:
102
-		cls = ErrUnknown
103
-	}
104
-
105
-	msg := rebaseMessage(cls, err)
106
-	if msg != "" {
107
-		err = fmt.Errorf("%s: %w", msg, cls)
108
-	} else {
109
-		err = cls
110
-	}
111
-
112
-	return err
113
-}
114
-
115
-// rebaseMessage removes the repeats for an error at the end of an error
116
-// string. This will happen when taking an error over grpc then remapping it.
117
-//
118
-// Effectively, we just remove the string of cls from the end of err if it
119
-// appears there.
120
-func rebaseMessage(cls error, err error) string {
121
-	desc := errDesc(err)
122
-	clss := cls.Error()
123
-	if desc == clss {
124
-		return ""
125
-	}
126
-
127
-	return strings.TrimSuffix(desc, ": "+clss)
128
-}
129
-
130
-func isGRPCError(err error) bool {
131
-	_, ok := status.FromError(err)
132
-	return ok
133
-}
134
-
135
-func code(err error) codes.Code {
136
-	if s, ok := status.FromError(err); ok {
137
-		return s.Code()
138
-	}
139
-	return codes.Unknown
140
-}
141
-
142
-func errDesc(err error) string {
143
-	if s, ok := status.FromError(err); ok {
144
-		return s.Message()
145
-	}
146
-	return err.Error()
147
-}
... ...
@@ -20,9 +20,9 @@ import (
20 20
 	"context"
21 21
 
22 22
 	eventsapi "github.com/containerd/containerd/api/services/events/v1"
23
-	"github.com/containerd/containerd/errdefs"
24 23
 	"github.com/containerd/containerd/events"
25 24
 	"github.com/containerd/containerd/protobuf"
25
+	"github.com/containerd/errdefs"
26 26
 	"github.com/containerd/typeurl/v2"
27 27
 )
28 28
 
... ...
@@ -22,12 +22,12 @@ import (
22 22
 	"strings"
23 23
 	"time"
24 24
 
25
-	"github.com/containerd/containerd/errdefs"
26 25
 	"github.com/containerd/containerd/events"
27 26
 	"github.com/containerd/containerd/filters"
28 27
 	"github.com/containerd/containerd/identifiers"
29
-	"github.com/containerd/containerd/log"
30 28
 	"github.com/containerd/containerd/namespaces"
29
+	"github.com/containerd/errdefs"
30
+	"github.com/containerd/log"
31 31
 	"github.com/containerd/typeurl/v2"
32 32
 	goevents "github.com/docker/go-events"
33 33
 )
... ...
@@ -70,7 +70,7 @@ package filters
70 70
 import (
71 71
 	"regexp"
72 72
 
73
-	"github.com/containerd/containerd/log"
73
+	"github.com/containerd/log"
74 74
 )
75 75
 
76 76
 // Filter matches specific resources based the provided filter
... ...
@@ -20,7 +20,7 @@ import (
20 20
 	"fmt"
21 21
 	"io"
22 22
 
23
-	"github.com/containerd/containerd/errdefs"
23
+	"github.com/containerd/errdefs"
24 24
 )
25 25
 
26 26
 /*
... ...
@@ -28,7 +28,7 @@ import (
28 28
 	"fmt"
29 29
 	"regexp"
30 30
 
31
-	"github.com/containerd/containerd/errdefs"
31
+	"github.com/containerd/errdefs"
32 32
 )
33 33
 
34 34
 const (
... ...
@@ -26,13 +26,13 @@ import (
26 26
 
27 27
 	"github.com/containerd/containerd/content"
28 28
 	"github.com/containerd/containerd/diff"
29
-	"github.com/containerd/containerd/errdefs"
30 29
 	"github.com/containerd/containerd/images"
31 30
 	"github.com/containerd/containerd/labels"
32 31
 	"github.com/containerd/containerd/pkg/kmutex"
33 32
 	"github.com/containerd/containerd/platforms"
34 33
 	"github.com/containerd/containerd/rootfs"
35 34
 	"github.com/containerd/containerd/snapshots"
35
+	"github.com/containerd/errdefs"
36 36
 	"github.com/opencontainers/go-digest"
37 37
 	"github.com/opencontainers/image-spec/identity"
38 38
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
... ...
@@ -21,11 +21,11 @@ import (
21 21
 
22 22
 	imagesapi "github.com/containerd/containerd/api/services/images/v1"
23 23
 	"github.com/containerd/containerd/api/types"
24
-	"github.com/containerd/containerd/errdefs"
25 24
 	"github.com/containerd/containerd/images"
26 25
 	"github.com/containerd/containerd/pkg/epoch"
27 26
 	"github.com/containerd/containerd/protobuf"
28 27
 	ptypes "github.com/containerd/containerd/protobuf/types"
28
+	"github.com/containerd/errdefs"
29 29
 	"github.com/opencontainers/go-digest"
30 30
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
31 31
 	"google.golang.org/protobuf/types/known/timestamppb"
... ...
@@ -27,10 +27,10 @@ import (
27 27
 	"strings"
28 28
 
29 29
 	"github.com/containerd/containerd/content"
30
-	"github.com/containerd/containerd/errdefs"
31 30
 	"github.com/containerd/containerd/images"
32 31
 	"github.com/containerd/containerd/labels"
33 32
 	"github.com/containerd/containerd/platforms"
33
+	"github.com/containerd/errdefs"
34 34
 	"github.com/containerd/log"
35 35
 	digest "github.com/opencontainers/go-digest"
36 36
 	ocispecs "github.com/opencontainers/image-spec/specs-go"
... ...
@@ -29,11 +29,11 @@ import (
29 29
 
30 30
 	"github.com/containerd/containerd/archive/compression"
31 31
 	"github.com/containerd/containerd/content"
32
-	"github.com/containerd/containerd/errdefs"
33 32
 	"github.com/containerd/containerd/images"
34 33
 	"github.com/containerd/containerd/labels"
35
-	"github.com/containerd/containerd/log"
36 34
 	"github.com/containerd/containerd/platforms"
35
+	"github.com/containerd/errdefs"
36
+	"github.com/containerd/log"
37 37
 	digest "github.com/opencontainers/go-digest"
38 38
 	specs "github.com/opencontainers/image-spec/specs-go"
39 39
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
... ...
@@ -23,8 +23,8 @@ import (
23 23
 	"sort"
24 24
 
25 25
 	"github.com/containerd/containerd/content"
26
-	"github.com/containerd/containerd/errdefs"
27 26
 	"github.com/containerd/containerd/platforms"
27
+	"github.com/containerd/errdefs"
28 28
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
29 29
 	"golang.org/x/sync/errgroup"
30 30
 	"golang.org/x/sync/semaphore"
... ...
@@ -24,9 +24,9 @@ import (
24 24
 	"time"
25 25
 
26 26
 	"github.com/containerd/containerd/content"
27
-	"github.com/containerd/containerd/errdefs"
28
-	"github.com/containerd/containerd/log"
29 27
 	"github.com/containerd/containerd/platforms"
28
+	"github.com/containerd/errdefs"
29
+	"github.com/containerd/log"
30 30
 	digest "github.com/opencontainers/go-digest"
31 31
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
32 32
 )
... ...
@@ -268,6 +268,9 @@ func Platforms(ctx context.Context, provider content.Provider, image ocispec.Des
268 268
 	var platformSpecs []ocispec.Platform
269 269
 	return platformSpecs, Walk(ctx, Handlers(HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
270 270
 		if desc.Platform != nil {
271
+			if desc.Platform.OS == "unknown" || desc.Platform.Architecture == "unknown" {
272
+				return nil, ErrSkipDesc
273
+			}
271 274
 			platformSpecs = append(platformSpecs, *desc.Platform)
272 275
 			return nil, ErrSkipDesc
273 276
 		}
... ...
@@ -22,7 +22,7 @@ import (
22 22
 	"sort"
23 23
 	"strings"
24 24
 
25
-	"github.com/containerd/containerd/errdefs"
25
+	"github.com/containerd/errdefs"
26 26
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
27 27
 )
28 28
 
... ...
@@ -22,10 +22,10 @@ import (
22 22
 	"io"
23 23
 
24 24
 	"github.com/containerd/containerd/content"
25
-	"github.com/containerd/containerd/errdefs"
26 25
 	"github.com/containerd/containerd/images"
27 26
 	"github.com/containerd/containerd/images/archive"
28 27
 	"github.com/containerd/containerd/platforms"
28
+	"github.com/containerd/errdefs"
29 29
 	digest "github.com/opencontainers/go-digest"
30 30
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
31 31
 )
... ...
@@ -19,7 +19,7 @@ package labels
19 19
 import (
20 20
 	"fmt"
21 21
 
22
-	"github.com/containerd/containerd/errdefs"
22
+	"github.com/containerd/errdefs"
23 23
 )
24 24
 
25 25
 const (
... ...
@@ -20,9 +20,9 @@ import (
20 20
 	"context"
21 21
 
22 22
 	leasesapi "github.com/containerd/containerd/api/services/leases/v1"
23
-	"github.com/containerd/containerd/errdefs"
24 23
 	"github.com/containerd/containerd/leases"
25 24
 	"github.com/containerd/containerd/protobuf"
25
+	"github.com/containerd/errdefs"
26 26
 )
27 27
 
28 28
 type proxyManager struct {
29 29
deleted file mode 100644
... ...
@@ -1,149 +0,0 @@
1
-/*
2
-   Copyright The containerd Authors.
3
-
4
-   Licensed under the Apache License, Version 2.0 (the "License");
5
-   you may not use this file except in compliance with the License.
6
-   You may obtain a copy of the License at
7
-
8
-       http://www.apache.org/licenses/LICENSE-2.0
9
-
10
-   Unless required by applicable law or agreed to in writing, software
11
-   distributed under the License is distributed on an "AS IS" BASIS,
12
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-   See the License for the specific language governing permissions and
14
-   limitations under the License.
15
-*/
16
-
17
-package log
18
-
19
-import (
20
-	"context"
21
-
22
-	"github.com/containerd/log"
23
-)
24
-
25
-// G is a shorthand for [GetLogger].
26
-//
27
-// Deprecated: use [log.G].
28
-var G = log.G
29
-
30
-// L is an alias for the standard logger.
31
-//
32
-// Deprecated: use [log.L].
33
-var L = log.L
34
-
35
-// Fields type to pass to "WithFields".
36
-//
37
-// Deprecated: use [log.Fields].
38
-type Fields = log.Fields
39
-
40
-// Entry is a logging entry.
41
-//
42
-// Deprecated: use [log.Entry].
43
-type Entry = log.Entry
44
-
45
-// RFC3339NanoFixed is [time.RFC3339Nano] with nanoseconds padded using
46
-// zeros to ensure the formatted time is always the same number of
47
-// characters.
48
-//
49
-// Deprecated: use [log.RFC3339NanoFixed].
50
-const RFC3339NanoFixed = log.RFC3339NanoFixed
51
-
52
-// Level is a logging level.
53
-//
54
-// Deprecated: use [log.Level].
55
-type Level = log.Level
56
-
57
-// Supported log levels.
58
-const (
59
-	// TraceLevel level.
60
-	//
61
-	// Deprecated: use [log.TraceLevel].
62
-	TraceLevel Level = log.TraceLevel
63
-
64
-	// DebugLevel level.
65
-	//
66
-	// Deprecated: use [log.DebugLevel].
67
-	DebugLevel Level = log.DebugLevel
68
-
69
-	// InfoLevel level.
70
-	//
71
-	// Deprecated: use [log.InfoLevel].
72
-	InfoLevel Level = log.InfoLevel
73
-
74
-	// WarnLevel level.
75
-	//
76
-	// Deprecated: use [log.WarnLevel].
77
-	WarnLevel Level = log.WarnLevel
78
-
79
-	// ErrorLevel level
80
-	//
81
-	// Deprecated: use [log.ErrorLevel].
82
-	ErrorLevel Level = log.ErrorLevel
83
-
84
-	// FatalLevel level.
85
-	//
86
-	// Deprecated: use [log.FatalLevel].
87
-	FatalLevel Level = log.FatalLevel
88
-
89
-	// PanicLevel level.
90
-	//
91
-	// Deprecated: use [log.PanicLevel].
92
-	PanicLevel Level = log.PanicLevel
93
-)
94
-
95
-// SetLevel sets log level globally. It returns an error if the given
96
-// level is not supported.
97
-//
98
-// Deprecated: use [log.SetLevel].
99
-func SetLevel(level string) error {
100
-	return log.SetLevel(level)
101
-}
102
-
103
-// GetLevel returns the current log level.
104
-//
105
-// Deprecated: use [log.GetLevel].
106
-func GetLevel() log.Level {
107
-	return log.GetLevel()
108
-}
109
-
110
-// OutputFormat specifies a log output format.
111
-//
112
-// Deprecated: use [log.OutputFormat].
113
-type OutputFormat = log.OutputFormat
114
-
115
-// Supported log output formats.
116
-const (
117
-	// TextFormat represents the text logging format.
118
-	//
119
-	// Deprecated: use [log.TextFormat].
120
-	TextFormat log.OutputFormat = "text"
121
-
122
-	// JSONFormat represents the JSON logging format.
123
-	//
124
-	// Deprecated: use [log.JSONFormat].
125
-	JSONFormat log.OutputFormat = "json"
126
-)
127
-
128
-// SetFormat sets the log output format.
129
-//
130
-// Deprecated: use [log.SetFormat].
131
-func SetFormat(format OutputFormat) error {
132
-	return log.SetFormat(format)
133
-}
134
-
135
-// WithLogger returns a new context with the provided logger. Use in
136
-// combination with logger.WithField(s) for great effect.
137
-//
138
-// Deprecated: use [log.WithLogger].
139
-func WithLogger(ctx context.Context, logger *log.Entry) context.Context {
140
-	return log.WithLogger(ctx, logger)
141
-}
142
-
143
-// GetLogger retrieves the current logger from the context. If no logger is
144
-// available, the default logger is returned.
145
-//
146
-// Deprecated: use [log.GetLogger].
147
-func GetLogger(ctx context.Context) *log.Entry {
148
-	return log.GetLogger(ctx)
149
-}
... ...
@@ -24,7 +24,6 @@ import (
24 24
 	"time"
25 25
 
26 26
 	"github.com/containerd/containerd/containers"
27
-	"github.com/containerd/containerd/errdefs"
28 27
 	"github.com/containerd/containerd/filters"
29 28
 	"github.com/containerd/containerd/identifiers"
30 29
 	"github.com/containerd/containerd/labels"
... ...
@@ -32,6 +31,7 @@ import (
32 32
 	"github.com/containerd/containerd/namespaces"
33 33
 	"github.com/containerd/containerd/protobuf/proto"
34 34
 	"github.com/containerd/containerd/protobuf/types"
35
+	"github.com/containerd/errdefs"
35 36
 	"github.com/containerd/typeurl/v2"
36 37
 	bolt "go.etcd.io/bbolt"
37 38
 )
... ...
@@ -26,12 +26,12 @@ import (
26 26
 	"time"
27 27
 
28 28
 	"github.com/containerd/containerd/content"
29
-	"github.com/containerd/containerd/errdefs"
30 29
 	"github.com/containerd/containerd/filters"
31 30
 	"github.com/containerd/containerd/labels"
32
-	"github.com/containerd/containerd/log"
33 31
 	"github.com/containerd/containerd/metadata/boltutil"
34 32
 	"github.com/containerd/containerd/namespaces"
33
+	"github.com/containerd/errdefs"
34
+	"github.com/containerd/log"
35 35
 	digest "github.com/opencontainers/go-digest"
36 36
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
37 37
 	bolt "go.etcd.io/bbolt"
... ...
@@ -30,10 +30,10 @@ import (
30 30
 	"github.com/containerd/containerd/content"
31 31
 	"github.com/containerd/containerd/events"
32 32
 	"github.com/containerd/containerd/gc"
33
-	"github.com/containerd/containerd/log"
34 33
 	"github.com/containerd/containerd/namespaces"
35 34
 	"github.com/containerd/containerd/pkg/cleanup"
36 35
 	"github.com/containerd/containerd/snapshots"
36
+	"github.com/containerd/log"
37 37
 	bolt "go.etcd.io/bbolt"
38 38
 )
39 39
 
... ...
@@ -26,7 +26,7 @@ import (
26 26
 
27 27
 	eventstypes "github.com/containerd/containerd/api/events"
28 28
 	"github.com/containerd/containerd/gc"
29
-	"github.com/containerd/containerd/log"
29
+	"github.com/containerd/log"
30 30
 	bolt "go.etcd.io/bbolt"
31 31
 )
32 32
 
... ...
@@ -25,13 +25,13 @@ import (
25 25
 	"sync/atomic"
26 26
 	"time"
27 27
 
28
-	"github.com/containerd/containerd/errdefs"
29 28
 	"github.com/containerd/containerd/filters"
30 29
 	"github.com/containerd/containerd/images"
31 30
 	"github.com/containerd/containerd/labels"
32 31
 	"github.com/containerd/containerd/metadata/boltutil"
33 32
 	"github.com/containerd/containerd/namespaces"
34 33
 	"github.com/containerd/containerd/pkg/epoch"
34
+	"github.com/containerd/errdefs"
35 35
 	digest "github.com/opencontainers/go-digest"
36 36
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
37 37
 	bolt "go.etcd.io/bbolt"
... ...
@@ -24,11 +24,11 @@ import (
24 24
 	"sync/atomic"
25 25
 	"time"
26 26
 
27
-	"github.com/containerd/containerd/errdefs"
28 27
 	"github.com/containerd/containerd/filters"
29 28
 	"github.com/containerd/containerd/leases"
30 29
 	"github.com/containerd/containerd/metadata/boltutil"
31 30
 	"github.com/containerd/containerd/namespaces"
31
+	"github.com/containerd/errdefs"
32 32
 	digest "github.com/opencontainers/go-digest"
33 33
 	bolt "go.etcd.io/bbolt"
34 34
 )
... ...
@@ -21,10 +21,10 @@ import (
21 21
 	"fmt"
22 22
 	"strings"
23 23
 
24
-	"github.com/containerd/containerd/errdefs"
25 24
 	"github.com/containerd/containerd/identifiers"
26 25
 	l "github.com/containerd/containerd/labels"
27 26
 	"github.com/containerd/containerd/namespaces"
27
+	"github.com/containerd/errdefs"
28 28
 	bolt "go.etcd.io/bbolt"
29 29
 )
30 30
 
... ...
@@ -23,12 +23,12 @@ import (
23 23
 	"strings"
24 24
 	"time"
25 25
 
26
-	"github.com/containerd/containerd/errdefs"
27 26
 	"github.com/containerd/containerd/filters"
28 27
 	"github.com/containerd/containerd/identifiers"
29 28
 	"github.com/containerd/containerd/metadata/boltutil"
30 29
 	"github.com/containerd/containerd/namespaces"
31 30
 	api "github.com/containerd/containerd/sandbox"
31
+	"github.com/containerd/errdefs"
32 32
 	"github.com/containerd/typeurl/v2"
33 33
 	"go.etcd.io/bbolt"
34 34
 )
... ...
@@ -25,14 +25,14 @@ import (
25 25
 	"time"
26 26
 
27 27
 	eventstypes "github.com/containerd/containerd/api/events"
28
-	"github.com/containerd/containerd/errdefs"
29 28
 	"github.com/containerd/containerd/filters"
30 29
 	"github.com/containerd/containerd/labels"
31
-	"github.com/containerd/containerd/log"
32 30
 	"github.com/containerd/containerd/metadata/boltutil"
33 31
 	"github.com/containerd/containerd/mount"
34 32
 	"github.com/containerd/containerd/namespaces"
35 33
 	"github.com/containerd/containerd/snapshots"
34
+	"github.com/containerd/errdefs"
35
+	"github.com/containerd/log"
36 36
 	bolt "go.etcd.io/bbolt"
37 37
 )
38 38
 
... ...
@@ -27,7 +27,7 @@ import (
27 27
 
28 28
 	"github.com/Microsoft/go-winio/pkg/bindfilter"
29 29
 	"github.com/Microsoft/hcsshim"
30
-	"github.com/containerd/containerd/log"
30
+	"github.com/containerd/log"
31 31
 	"golang.org/x/sys/windows"
32 32
 )
33 33
 
... ...
@@ -21,7 +21,7 @@ import (
21 21
 	"fmt"
22 22
 	"os"
23 23
 
24
-	"github.com/containerd/containerd/log"
24
+	"github.com/containerd/log"
25 25
 )
26 26
 
27 27
 var tempMountLocation = getTempDir()
... ...
@@ -21,9 +21,9 @@ import (
21 21
 	"strings"
22 22
 
23 23
 	api "github.com/containerd/containerd/api/services/namespaces/v1"
24
-	"github.com/containerd/containerd/errdefs"
25 24
 	"github.com/containerd/containerd/namespaces"
26 25
 	"github.com/containerd/containerd/protobuf/types"
26
+	"github.com/containerd/errdefs"
27 27
 )
28 28
 
29 29
 // NewNamespaceStoreFromClient returns a new namespace store
... ...
@@ -21,8 +21,8 @@ import (
21 21
 	"fmt"
22 22
 	"os"
23 23
 
24
-	"github.com/containerd/containerd/errdefs"
25 24
 	"github.com/containerd/containerd/identifiers"
25
+	"github.com/containerd/errdefs"
26 26
 )
27 27
 
28 28
 const (
... ...
@@ -21,7 +21,7 @@ import (
21 21
 
22 22
 	"github.com/containerd/containerd/images"
23 23
 	"github.com/containerd/containerd/labels"
24
-	"github.com/containerd/containerd/log"
24
+	"github.com/containerd/log"
25 25
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
26 26
 )
27 27
 
... ...
@@ -25,10 +25,10 @@ import (
25 25
 
26 26
 	transferapi "github.com/containerd/containerd/api/services/transfer/v1"
27 27
 	transfertypes "github.com/containerd/containerd/api/types/transfer"
28
-	"github.com/containerd/containerd/log"
29 28
 	"github.com/containerd/containerd/pkg/streaming"
30 29
 	"github.com/containerd/containerd/pkg/transfer"
31 30
 	tstreaming "github.com/containerd/containerd/pkg/transfer/streaming"
31
+	"github.com/containerd/log"
32 32
 	"github.com/containerd/typeurl/v2"
33 33
 )
34 34
 
... ...
@@ -27,8 +27,8 @@ import (
27 27
 	"time"
28 28
 
29 29
 	transferapi "github.com/containerd/containerd/api/types/transfer"
30
-	"github.com/containerd/containerd/log"
31 30
 	"github.com/containerd/containerd/pkg/streaming"
31
+	"github.com/containerd/log"
32 32
 	"github.com/containerd/typeurl/v2"
33 33
 )
34 34
 
... ...
@@ -23,8 +23,8 @@ import (
23 23
 	"sync/atomic"
24 24
 
25 25
 	transferapi "github.com/containerd/containerd/api/types/transfer"
26
-	"github.com/containerd/containerd/log"
27 26
 	"github.com/containerd/containerd/pkg/streaming"
27
+	"github.com/containerd/log"
28 28
 	"github.com/containerd/typeurl/v2"
29 29
 )
30 30
 
... ...
@@ -30,16 +30,16 @@ import (
30 30
 
31 31
 	"github.com/containerd/containerd/content"
32 32
 	"github.com/containerd/containerd/diff"
33
-	"github.com/containerd/containerd/errdefs"
34 33
 	"github.com/containerd/containerd/images"
35 34
 	"github.com/containerd/containerd/labels"
36
-	"github.com/containerd/containerd/log"
37 35
 	"github.com/containerd/containerd/mount"
38 36
 	"github.com/containerd/containerd/pkg/cleanup"
39 37
 	"github.com/containerd/containerd/pkg/kmutex"
40 38
 	"github.com/containerd/containerd/platforms"
41 39
 	"github.com/containerd/containerd/snapshots"
42 40
 	"github.com/containerd/containerd/tracing"
41
+	"github.com/containerd/errdefs"
42
+	"github.com/containerd/log"
43 43
 	"github.com/opencontainers/go-digest"
44 44
 	"github.com/opencontainers/image-spec/identity"
45 45
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
... ...
@@ -20,7 +20,7 @@ import (
20 20
 	"runtime"
21 21
 	"sync"
22 22
 
23
-	"github.com/containerd/containerd/log"
23
+	"github.com/containerd/log"
24 24
 )
25 25
 
26 26
 // Present the ARM instruction set architecture, eg: v7, v8
... ...
@@ -24,7 +24,7 @@ import (
24 24
 	"runtime"
25 25
 	"strings"
26 26
 
27
-	"github.com/containerd/containerd/errdefs"
27
+	"github.com/containerd/errdefs"
28 28
 	"golang.org/x/sys/unix"
29 29
 )
30 30
 
... ...
@@ -22,7 +22,7 @@ import (
22 22
 	"fmt"
23 23
 	"runtime"
24 24
 
25
-	"github.com/containerd/containerd/errdefs"
25
+	"github.com/containerd/errdefs"
26 26
 )
27 27
 
28 28
 func getCPUVariant() (string, error) {
... ...
@@ -116,7 +116,7 @@ import (
116 116
 
117 117
 	specs "github.com/opencontainers/image-spec/specs-go/v1"
118 118
 
119
-	"github.com/containerd/containerd/errdefs"
119
+	"github.com/containerd/errdefs"
120 120
 )
121 121
 
122 122
 var (
... ...
@@ -23,8 +23,8 @@ import (
23 23
 
24 24
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
25 25
 
26
-	"github.com/containerd/containerd/errdefs"
27 26
 	"github.com/containerd/containerd/events/exchange"
27
+	"github.com/containerd/errdefs"
28 28
 )
29 29
 
30 30
 // InitContext is used for plugin initialization
... ...
@@ -25,8 +25,8 @@ import (
25 25
 
26 26
 	"github.com/containerd/containerd/api/services/tasks/v1"
27 27
 	"github.com/containerd/containerd/cio"
28
-	"github.com/containerd/containerd/errdefs"
29 28
 	"github.com/containerd/containerd/protobuf"
29
+	"github.com/containerd/errdefs"
30 30
 )
31 31
 
32 32
 // Process represents a system process
... ...
@@ -24,7 +24,6 @@ import (
24 24
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
25 25
 	"golang.org/x/sync/semaphore"
26 26
 
27
-	"github.com/containerd/containerd/errdefs"
28 27
 	"github.com/containerd/containerd/images"
29 28
 	"github.com/containerd/containerd/pkg/unpack"
30 29
 	"github.com/containerd/containerd/platforms"
... ...
@@ -32,6 +31,7 @@ import (
32 32
 	"github.com/containerd/containerd/remotes/docker"
33 33
 	"github.com/containerd/containerd/remotes/docker/schema1" //nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
34 34
 	"github.com/containerd/containerd/tracing"
35
+	"github.com/containerd/errdefs"
35 36
 )
36 37
 
37 38
 const (
... ...
@@ -26,9 +26,9 @@ import (
26 26
 	"strings"
27 27
 	"time"
28 28
 
29
-	"github.com/containerd/containerd/log"
30 29
 	remoteserrors "github.com/containerd/containerd/remotes/errors"
31 30
 	"github.com/containerd/containerd/version"
31
+	"github.com/containerd/log"
32 32
 )
33 33
 
34 34
 var (
... ...
@@ -25,10 +25,10 @@ import (
25 25
 	"strings"
26 26
 	"sync"
27 27
 
28
-	"github.com/containerd/containerd/errdefs"
29
-	"github.com/containerd/containerd/log"
30 28
 	"github.com/containerd/containerd/remotes/docker/auth"
31 29
 	remoteerrors "github.com/containerd/containerd/remotes/errors"
30
+	"github.com/containerd/errdefs"
31
+	"github.com/containerd/log"
32 32
 )
33 33
 
34 34
 type dockerAuthorizer struct {
... ...
@@ -24,8 +24,8 @@ import (
24 24
 
25 25
 	"github.com/containerd/containerd/content"
26 26
 	"github.com/containerd/containerd/images"
27
-	"github.com/containerd/containerd/log"
28 27
 	"github.com/containerd/containerd/remotes"
28
+	"github.com/containerd/log"
29 29
 	digest "github.com/opencontainers/go-digest"
30 30
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
31 31
 )
... ...
@@ -24,7 +24,7 @@ import (
24 24
 
25 25
 	fuzz "github.com/AdaLogics/go-fuzz-headers"
26 26
 	"github.com/containerd/containerd/content/local"
27
-	"github.com/containerd/containerd/log"
27
+	"github.com/containerd/log"
28 28
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
29 29
 	"github.com/sirupsen/logrus"
30 30
 )
... ...
@@ -26,9 +26,9 @@ import (
26 26
 	"net/url"
27 27
 	"strings"
28 28
 
29
-	"github.com/containerd/containerd/errdefs"
30 29
 	"github.com/containerd/containerd/images"
31
-	"github.com/containerd/containerd/log"
30
+	"github.com/containerd/errdefs"
31
+	"github.com/containerd/log"
32 32
 	digest "github.com/opencontainers/go-digest"
33 33
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
34 34
 )
... ...
@@ -25,8 +25,8 @@ import (
25 25
 	"github.com/containerd/containerd/content"
26 26
 	"github.com/containerd/containerd/images"
27 27
 	"github.com/containerd/containerd/labels"
28
-	"github.com/containerd/containerd/log"
29 28
 	"github.com/containerd/containerd/reference"
29
+	"github.com/containerd/log"
30 30
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
31 31
 )
32 32
 
... ...
@@ -21,8 +21,8 @@ import (
21 21
 	"fmt"
22 22
 	"io"
23 23
 
24
-	"github.com/containerd/containerd/errdefs"
25
-	"github.com/containerd/containerd/log"
24
+	"github.com/containerd/errdefs"
25
+	"github.com/containerd/log"
26 26
 )
27 27
 
28 28
 const maxRetry = 3
... ...
@@ -29,11 +29,11 @@ import (
29 29
 	"time"
30 30
 
31 31
 	"github.com/containerd/containerd/content"
32
-	"github.com/containerd/containerd/errdefs"
33 32
 	"github.com/containerd/containerd/images"
34
-	"github.com/containerd/containerd/log"
35 33
 	"github.com/containerd/containerd/remotes"
36 34
 	remoteserrors "github.com/containerd/containerd/remotes/errors"
35
+	"github.com/containerd/errdefs"
36
+	"github.com/containerd/log"
37 37
 	digest "github.com/opencontainers/go-digest"
38 38
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
39 39
 )
... ...
@@ -28,15 +28,15 @@ import (
28 28
 	"path"
29 29
 	"strings"
30 30
 
31
-	"github.com/containerd/containerd/errdefs"
32 31
 	"github.com/containerd/containerd/images"
33
-	"github.com/containerd/containerd/log"
34 32
 	"github.com/containerd/containerd/reference"
35 33
 	"github.com/containerd/containerd/remotes"
36 34
 	"github.com/containerd/containerd/remotes/docker/schema1" //nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
37 35
 	remoteerrors "github.com/containerd/containerd/remotes/errors"
38 36
 	"github.com/containerd/containerd/tracing"
39 37
 	"github.com/containerd/containerd/version"
38
+	"github.com/containerd/errdefs"
39
+	"github.com/containerd/log"
40 40
 	"github.com/opencontainers/go-digest"
41 41
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
42 42
 )
... ...
@@ -34,11 +34,11 @@ import (
34 34
 
35 35
 	"github.com/containerd/containerd/archive/compression"
36 36
 	"github.com/containerd/containerd/content"
37
-	"github.com/containerd/containerd/errdefs"
38 37
 	"github.com/containerd/containerd/images"
39 38
 	"github.com/containerd/containerd/labels"
40
-	"github.com/containerd/containerd/log"
41 39
 	"github.com/containerd/containerd/remotes"
40
+	"github.com/containerd/errdefs"
41
+	"github.com/containerd/log"
42 42
 	digest "github.com/opencontainers/go-digest"
43 43
 	specs "github.com/opencontainers/image-spec/specs-go"
44 44
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
... ...
@@ -21,7 +21,7 @@ import (
21 21
 	"sync"
22 22
 
23 23
 	"github.com/containerd/containerd/content"
24
-	"github.com/containerd/containerd/errdefs"
24
+	"github.com/containerd/errdefs"
25 25
 	"github.com/moby/locker"
26 26
 )
27 27
 
... ...
@@ -26,11 +26,11 @@ import (
26 26
 	"sync"
27 27
 
28 28
 	"github.com/containerd/containerd/content"
29
-	"github.com/containerd/containerd/errdefs"
30 29
 	"github.com/containerd/containerd/images"
31 30
 	"github.com/containerd/containerd/labels"
32
-	"github.com/containerd/containerd/log"
33 31
 	"github.com/containerd/containerd/platforms"
32
+	"github.com/containerd/errdefs"
33
+	"github.com/containerd/log"
34 34
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
35 35
 	"golang.org/x/sync/semaphore"
36 36
 )
... ...
@@ -24,10 +24,10 @@ import (
24 24
 	"time"
25 25
 
26 26
 	"github.com/containerd/containerd/diff"
27
-	"github.com/containerd/containerd/errdefs"
28
-	"github.com/containerd/containerd/log"
29 27
 	"github.com/containerd/containerd/mount"
30 28
 	"github.com/containerd/containerd/snapshots"
29
+	"github.com/containerd/errdefs"
30
+	"github.com/containerd/log"
31 31
 	"github.com/opencontainers/go-digest"
32 32
 	"github.com/opencontainers/image-spec/identity"
33 33
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
... ...
@@ -22,9 +22,9 @@ import (
22 22
 	"fmt"
23 23
 	"os"
24 24
 
25
-	"github.com/containerd/containerd/log"
26 25
 	"github.com/containerd/containerd/mount"
27 26
 	"github.com/containerd/containerd/snapshots"
27
+	"github.com/containerd/log"
28 28
 	digest "github.com/opencontainers/go-digest"
29 29
 )
30 30
 
... ...
@@ -31,13 +31,13 @@ import (
31 31
 
32 32
 	shimapi "github.com/containerd/containerd/api/runtime/task/v2"
33 33
 	"github.com/containerd/containerd/events"
34
-	"github.com/containerd/containerd/log"
35 34
 	"github.com/containerd/containerd/namespaces"
36 35
 	"github.com/containerd/containerd/pkg/shutdown"
37 36
 	"github.com/containerd/containerd/plugin"
38 37
 	"github.com/containerd/containerd/protobuf"
39 38
 	"github.com/containerd/containerd/protobuf/proto"
40 39
 	"github.com/containerd/containerd/version"
40
+	"github.com/containerd/log"
41 41
 	"github.com/containerd/ttrpc"
42 42
 	"github.com/sirupsen/logrus"
43 43
 )
... ...
@@ -22,7 +22,7 @@ import (
22 22
 	"net"
23 23
 	"os"
24 24
 
25
-	"github.com/containerd/containerd/errdefs"
25
+	"github.com/containerd/errdefs"
26 26
 	"github.com/containerd/ttrpc"
27 27
 	"github.com/sirupsen/logrus"
28 28
 )
... ...
@@ -32,11 +32,11 @@ import (
32 32
 	"github.com/containerd/ttrpc"
33 33
 	"github.com/containerd/typeurl/v2"
34 34
 
35
-	"github.com/containerd/containerd/errdefs"
36 35
 	"github.com/containerd/containerd/namespaces"
37 36
 	"github.com/containerd/containerd/pkg/atomicfile"
38 37
 	"github.com/containerd/containerd/protobuf/proto"
39 38
 	"github.com/containerd/containerd/protobuf/types"
39
+	"github.com/containerd/errdefs"
40 40
 )
41 41
 
42 42
 type CommandConfig struct {
... ...
@@ -22,8 +22,8 @@ import (
22 22
 	"time"
23 23
 
24 24
 	"github.com/containerd/containerd/api/types"
25
-	"github.com/containerd/containerd/platforms"
26 25
 	"github.com/containerd/typeurl/v2"
26
+	imagespec "github.com/opencontainers/image-spec/specs-go/v1"
27 27
 )
28 28
 
29 29
 type CreateOptions struct {
... ...
@@ -90,7 +90,7 @@ type Controller interface {
90 90
 	Start(ctx context.Context, sandboxID string) (ControllerInstance, error)
91 91
 	// Platform returns target sandbox OS that will be used by Controller.
92 92
 	// containerd will rely on this to generate proper OCI spec.
93
-	Platform(_ctx context.Context, _sandboxID string) (platforms.Platform, error)
93
+	Platform(_ctx context.Context, _sandboxID string) (imagespec.Platform, error)
94 94
 	// Stop will stop sandbox instance
95 95
 	Stop(ctx context.Context, sandboxID string, opts ...StopOpt) error
96 96
 	// Wait blocks until sandbox process exits.
... ...
@@ -20,9 +20,9 @@ import (
20 20
 	"context"
21 21
 
22 22
 	api "github.com/containerd/containerd/api/services/sandbox/v1"
23
-	"github.com/containerd/containerd/errdefs"
24
-	"github.com/containerd/containerd/platforms"
25 23
 	"github.com/containerd/containerd/sandbox"
24
+	"github.com/containerd/errdefs"
25
+	imagespec "github.com/opencontainers/image-spec/specs-go/v1"
26 26
 	"google.golang.org/protobuf/types/known/anypb"
27 27
 )
28 28
 
... ...
@@ -73,14 +73,14 @@ func (s *remoteSandboxController) Start(ctx context.Context, sandboxID string) (
73 73
 	}, nil
74 74
 }
75 75
 
76
-func (s *remoteSandboxController) Platform(ctx context.Context, sandboxID string) (platforms.Platform, error) {
76
+func (s *remoteSandboxController) Platform(ctx context.Context, sandboxID string) (imagespec.Platform, error) {
77 77
 	resp, err := s.client.Platform(ctx, &api.ControllerPlatformRequest{SandboxID: sandboxID})
78 78
 	if err != nil {
79
-		return platforms.Platform{}, errdefs.FromGRPC(err)
79
+		return imagespec.Platform{}, errdefs.FromGRPC(err)
80 80
 	}
81 81
 
82 82
 	platform := resp.GetPlatform()
83
-	return platforms.Platform{
83
+	return imagespec.Platform{
84 84
 		Architecture: platform.GetArchitecture(),
85 85
 		OS:           platform.GetOS(),
86 86
 		Variant:      platform.GetVariant(),
... ...
@@ -20,8 +20,8 @@ import (
20 20
 	"context"
21 21
 
22 22
 	api "github.com/containerd/containerd/api/services/sandbox/v1"
23
-	"github.com/containerd/containerd/errdefs"
24 23
 	sb "github.com/containerd/containerd/sandbox"
24
+	"github.com/containerd/errdefs"
25 25
 )
26 26
 
27 27
 // remoteSandboxStore is a low-level containerd client to manage sandbox environments metadata
... ...
@@ -21,7 +21,7 @@ import (
21 21
 	"fmt"
22 22
 	"time"
23 23
 
24
-	"github.com/containerd/containerd/errdefs"
24
+	"github.com/containerd/errdefs"
25 25
 	"github.com/containerd/typeurl/v2"
26 26
 )
27 27
 
... ...
@@ -24,10 +24,10 @@ import (
24 24
 
25 25
 	api "github.com/containerd/containerd/api/services/content/v1"
26 26
 	"github.com/containerd/containerd/content"
27
-	"github.com/containerd/containerd/errdefs"
28
-	"github.com/containerd/containerd/log"
29 27
 	"github.com/containerd/containerd/protobuf"
30 28
 	ptypes "github.com/containerd/containerd/protobuf/types"
29
+	"github.com/containerd/errdefs"
30
+	"github.com/containerd/log"
31 31
 	digest "github.com/opencontainers/go-digest"
32 32
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
33 33
 	"google.golang.org/grpc"
... ...
@@ -20,9 +20,9 @@ import (
20 20
 	context "context"
21 21
 
22 22
 	api "github.com/containerd/containerd/api/services/introspection/v1"
23
-	"github.com/containerd/containerd/errdefs"
24
-	"github.com/containerd/containerd/log"
25 23
 	ptypes "github.com/containerd/containerd/protobuf/types"
24
+	"github.com/containerd/errdefs"
25
+	"github.com/containerd/log"
26 26
 )
27 27
 
28 28
 // Service defines the introspection service interface
... ...
@@ -32,13 +32,13 @@ import (
32 32
 
33 33
 	api "github.com/containerd/containerd/api/services/introspection/v1"
34 34
 	"github.com/containerd/containerd/api/types"
35
-	"github.com/containerd/containerd/errdefs"
36 35
 	"github.com/containerd/containerd/filters"
37 36
 	"github.com/containerd/containerd/plugin"
38 37
 	"github.com/containerd/containerd/protobuf"
39 38
 	ptypes "github.com/containerd/containerd/protobuf/types"
40 39
 	"github.com/containerd/containerd/services"
41 40
 	"github.com/containerd/containerd/services/warning"
41
+	"github.com/containerd/errdefs"
42 42
 )
43 43
 
44 44
 func init() {
... ...
@@ -25,8 +25,8 @@ import (
25 25
 	"github.com/pelletier/go-toml"
26 26
 	"github.com/sirupsen/logrus"
27 27
 
28
-	"github.com/containerd/containerd/errdefs"
29 28
 	"github.com/containerd/containerd/plugin"
29
+	"github.com/containerd/errdefs"
30 30
 )
31 31
 
32 32
 // NOTE: Any new map fields added also need to be handled in mergeConfig.
... ...
@@ -25,10 +25,10 @@ import (
25 25
 	"syscall"
26 26
 
27 27
 	kernel "github.com/containerd/containerd/contrib/seccomp/kernelversion"
28
-	"github.com/containerd/containerd/log"
29 28
 	"github.com/containerd/containerd/mount"
30 29
 	"github.com/containerd/containerd/pkg/userns"
31 30
 	"github.com/containerd/continuity/fs"
31
+	"github.com/containerd/log"
32 32
 )
33 33
 
34 34
 const (
... ...
@@ -22,11 +22,11 @@ import (
22 22
 
23 23
 	snapshotsapi "github.com/containerd/containerd/api/services/snapshots/v1"
24 24
 	"github.com/containerd/containerd/api/types"
25
-	"github.com/containerd/containerd/errdefs"
26 25
 	"github.com/containerd/containerd/mount"
27 26
 	"github.com/containerd/containerd/protobuf"
28 27
 	protobuftypes "github.com/containerd/containerd/protobuf/types"
29 28
 	"github.com/containerd/containerd/snapshots"
29
+	"github.com/containerd/errdefs"
30 30
 )
31 31
 
32 32
 // NewSnapshotter returns a new Snapshotter which communicates over a GRPC
... ...
@@ -33,7 +33,6 @@ import (
33 33
 	"github.com/containerd/containerd/cio"
34 34
 	"github.com/containerd/containerd/content"
35 35
 	"github.com/containerd/containerd/diff"
36
-	"github.com/containerd/containerd/errdefs"
37 36
 	"github.com/containerd/containerd/images"
38 37
 	"github.com/containerd/containerd/mount"
39 38
 	"github.com/containerd/containerd/oci"
... ...
@@ -43,6 +42,7 @@ import (
43 43
 	"github.com/containerd/containerd/rootfs"
44 44
 	"github.com/containerd/containerd/runtime/linux/runctypes"
45 45
 	"github.com/containerd/containerd/runtime/v2/runc/options"
46
+	"github.com/containerd/errdefs"
46 47
 	"github.com/containerd/typeurl/v2"
47 48
 	digest "github.com/opencontainers/go-digest"
48 49
 	is "github.com/opencontainers/image-spec/specs-go"
... ...
@@ -25,11 +25,11 @@ import (
25 25
 
26 26
 	"github.com/containerd/containerd/api/types"
27 27
 	"github.com/containerd/containerd/content"
28
-	"github.com/containerd/containerd/errdefs"
29 28
 	"github.com/containerd/containerd/images"
30 29
 	"github.com/containerd/containerd/mount"
31 30
 	"github.com/containerd/containerd/runtime/linux/runctypes"
32 31
 	"github.com/containerd/containerd/runtime/v2/runc/options"
32
+	"github.com/containerd/errdefs"
33 33
 	imagespec "github.com/opencontainers/image-spec/specs-go/v1"
34 34
 	"github.com/opencontainers/runtime-spec/specs-go"
35 35
 )
... ...
@@ -23,11 +23,11 @@ import (
23 23
 
24 24
 	streamingapi "github.com/containerd/containerd/api/services/streaming/v1"
25 25
 	transferapi "github.com/containerd/containerd/api/services/transfer/v1"
26
-	"github.com/containerd/containerd/errdefs"
27 26
 	"github.com/containerd/containerd/pkg/streaming"
28 27
 	"github.com/containerd/containerd/pkg/transfer"
29 28
 	"github.com/containerd/containerd/pkg/transfer/proxy"
30 29
 	"github.com/containerd/containerd/protobuf"
30
+	"github.com/containerd/errdefs"
31 31
 	"github.com/containerd/typeurl/v2"
32 32
 )
33 33
 
... ...
@@ -23,7 +23,7 @@ var (
23 23
 	Package = "github.com/containerd/containerd"
24 24
 
25 25
 	// Version holds the complete version number. Filled in at linking time.
26
-	Version = "1.7.17+unknown"
26
+	Version = "1.7.18+unknown"
27 27
 
28 28
 	// Revision is filled with the VCS (e.g. git) revision being used to build
29 29
 	// the program at linking time.
30 30
new file mode 100644
... ...
@@ -0,0 +1,191 @@
0
+
1
+                                 Apache License
2
+                           Version 2.0, January 2004
3
+                        https://www.apache.org/licenses/
4
+
5
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+   1. Definitions.
8
+
9
+      "License" shall mean the terms and conditions for use, reproduction,
10
+      and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+      "Licensor" shall mean the copyright owner or entity authorized by
13
+      the copyright owner that is granting the License.
14
+
15
+      "Legal Entity" shall mean the union of the acting entity and all
16
+      other entities that control, are controlled by, or are under common
17
+      control with that entity. For the purposes of this definition,
18
+      "control" means (i) the power, direct or indirect, to cause the
19
+      direction or management of such entity, whether by contract or
20
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+      outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+      "You" (or "Your") shall mean an individual or Legal Entity
24
+      exercising permissions granted by this License.
25
+
26
+      "Source" form shall mean the preferred form for making modifications,
27
+      including but not limited to software source code, documentation
28
+      source, and configuration files.
29
+
30
+      "Object" form shall mean any form resulting from mechanical
31
+      transformation or translation of a Source form, including but
32
+      not limited to compiled object code, generated documentation,
33
+      and conversions to other media types.
34
+
35
+      "Work" shall mean the work of authorship, whether in Source or
36
+      Object form, made available under the License, as indicated by a
37
+      copyright notice that is included in or attached to the work
38
+      (an example is provided in the Appendix below).
39
+
40
+      "Derivative Works" shall mean any work, whether in Source or Object
41
+      form, that is based on (or derived from) the Work and for which the
42
+      editorial revisions, annotations, elaborations, or other modifications
43
+      represent, as a whole, an original work of authorship. For the purposes
44
+      of this License, Derivative Works shall not include works that remain
45
+      separable from, or merely link (or bind by name) to the interfaces of,
46
+      the Work and Derivative Works thereof.
47
+
48
+      "Contribution" shall mean any work of authorship, including
49
+      the original version of the Work and any modifications or additions
50
+      to that Work or Derivative Works thereof, that is intentionally
51
+      submitted to Licensor for inclusion in the Work by the copyright owner
52
+      or by an individual or Legal Entity authorized to submit on behalf of
53
+      the copyright owner. For the purposes of this definition, "submitted"
54
+      means any form of electronic, verbal, or written communication sent
55
+      to the Licensor or its representatives, including but not limited to
56
+      communication on electronic mailing lists, source code control systems,
57
+      and issue tracking systems that are managed by, or on behalf of, the
58
+      Licensor for the purpose of discussing and improving the Work, but
59
+      excluding communication that is conspicuously marked or otherwise
60
+      designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+      "Contributor" shall mean Licensor and any individual or Legal Entity
63
+      on behalf of whom a Contribution has been received by Licensor and
64
+      subsequently incorporated within the Work.
65
+
66
+   2. Grant of Copyright License. Subject to the terms and conditions of
67
+      this License, each Contributor hereby grants to You a perpetual,
68
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+      copyright license to reproduce, prepare Derivative Works of,
70
+      publicly display, publicly perform, sublicense, and distribute the
71
+      Work and such Derivative Works in Source or Object form.
72
+
73
+   3. Grant of Patent License. Subject to the terms and conditions of
74
+      this License, each Contributor hereby grants to You a perpetual,
75
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+      (except as stated in this section) patent license to make, have made,
77
+      use, offer to sell, sell, import, and otherwise transfer the Work,
78
+      where such license applies only to those patent claims licensable
79
+      by such Contributor that are necessarily infringed by their
80
+      Contribution(s) alone or by combination of their Contribution(s)
81
+      with the Work to which such Contribution(s) was submitted. If You
82
+      institute patent litigation against any entity (including a
83
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+      or a Contribution incorporated within the Work constitutes direct
85
+      or contributory patent infringement, then any patent licenses
86
+      granted to You under this License for that Work shall terminate
87
+      as of the date such litigation is filed.
88
+
89
+   4. Redistribution. You may reproduce and distribute copies of the
90
+      Work or Derivative Works thereof in any medium, with or without
91
+      modifications, and in Source or Object form, provided that You
92
+      meet the following conditions:
93
+
94
+      (a) You must give any other recipients of the Work or
95
+          Derivative Works a copy of this License; and
96
+
97
+      (b) You must cause any modified files to carry prominent notices
98
+          stating that You changed the files; and
99
+
100
+      (c) You must retain, in the Source form of any Derivative Works
101
+          that You distribute, all copyright, patent, trademark, and
102
+          attribution notices from the Source form of the Work,
103
+          excluding those notices that do not pertain to any part of
104
+          the Derivative Works; and
105
+
106
+      (d) If the Work includes a "NOTICE" text file as part of its
107
+          distribution, then any Derivative Works that You distribute must
108
+          include a readable copy of the attribution notices contained
109
+          within such NOTICE file, excluding those notices that do not
110
+          pertain to any part of the Derivative Works, in at least one
111
+          of the following places: within a NOTICE text file distributed
112
+          as part of the Derivative Works; within the Source form or
113
+          documentation, if provided along with the Derivative Works; or,
114
+          within a display generated by the Derivative Works, if and
115
+          wherever such third-party notices normally appear. The contents
116
+          of the NOTICE file are for informational purposes only and
117
+          do not modify the License. You may add Your own attribution
118
+          notices within Derivative Works that You distribute, alongside
119
+          or as an addendum to the NOTICE text from the Work, provided
120
+          that such additional attribution notices cannot be construed
121
+          as modifying the License.
122
+
123
+      You may add Your own copyright statement to Your modifications and
124
+      may provide additional or different license terms and conditions
125
+      for use, reproduction, or distribution of Your modifications, or
126
+      for any such Derivative Works as a whole, provided Your use,
127
+      reproduction, and distribution of the Work otherwise complies with
128
+      the conditions stated in this License.
129
+
130
+   5. Submission of Contributions. Unless You explicitly state otherwise,
131
+      any Contribution intentionally submitted for inclusion in the Work
132
+      by You to the Licensor shall be under the terms and conditions of
133
+      this License, without any additional terms or conditions.
134
+      Notwithstanding the above, nothing herein shall supersede or modify
135
+      the terms of any separate license agreement you may have executed
136
+      with Licensor regarding such Contributions.
137
+
138
+   6. Trademarks. This License does not grant permission to use the trade
139
+      names, trademarks, service marks, or product names of the Licensor,
140
+      except as required for reasonable and customary use in describing the
141
+      origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+   7. Disclaimer of Warranty. Unless required by applicable law or
144
+      agreed to in writing, Licensor provides the Work (and each
145
+      Contributor provides its Contributions) on an "AS IS" BASIS,
146
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+      implied, including, without limitation, any warranties or conditions
148
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+      PARTICULAR PURPOSE. You are solely responsible for determining the
150
+      appropriateness of using or redistributing the Work and assume any
151
+      risks associated with Your exercise of permissions under this License.
152
+
153
+   8. Limitation of Liability. In no event and under no legal theory,
154
+      whether in tort (including negligence), contract, or otherwise,
155
+      unless required by applicable law (such as deliberate and grossly
156
+      negligent acts) or agreed to in writing, shall any Contributor be
157
+      liable to You for damages, including any direct, indirect, special,
158
+      incidental, or consequential damages of any character arising as a
159
+      result of this License or out of the use or inability to use the
160
+      Work (including but not limited to damages for loss of goodwill,
161
+      work stoppage, computer failure or malfunction, or any and all
162
+      other commercial damages or losses), even if such Contributor
163
+      has been advised of the possibility of such damages.
164
+
165
+   9. Accepting Warranty or Additional Liability. While redistributing
166
+      the Work or Derivative Works thereof, You may choose to offer,
167
+      and charge a fee for, acceptance of support, warranty, indemnity,
168
+      or other liability obligations and/or rights consistent with this
169
+      License. However, in accepting such obligations, You may act only
170
+      on Your own behalf and on Your sole responsibility, not on behalf
171
+      of any other Contributor, and only if You agree to indemnify,
172
+      defend, and hold each Contributor harmless for any liability
173
+      incurred by, or claims asserted against, such Contributor by reason
174
+      of your accepting any such warranty or additional liability.
175
+
176
+   END OF TERMS AND CONDITIONS
177
+
178
+   Copyright The containerd Authors
179
+
180
+   Licensed under the Apache License, Version 2.0 (the "License");
181
+   you may not use this file except in compliance with the License.
182
+   You may obtain a copy of the License at
183
+
184
+       https://www.apache.org/licenses/LICENSE-2.0
185
+
186
+   Unless required by applicable law or agreed to in writing, software
187
+   distributed under the License is distributed on an "AS IS" BASIS,
188
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+   See the License for the specific language governing permissions and
190
+   limitations under the License.
0 191
new file mode 100644
... ...
@@ -0,0 +1,13 @@
0
+# errdefs
1
+
2
+A Go package for defining and checking common containerd errors.
3
+
4
+## Project details
5
+
6
+**errdefs** is a containerd sub-project, licensed under the [Apache 2.0 license](./LICENSE).
7
+As a containerd sub-project, you will find the:
8
+ * [Project governance](https://github.com/containerd/project/blob/main/GOVERNANCE.md),
9
+ * [Maintainers](https://github.com/containerd/project/blob/main/MAINTAINERS),
10
+ * and [Contributing guidelines](https://github.com/containerd/project/blob/main/CONTRIBUTING.md)
11
+
12
+information in our [`containerd/project`](https://github.com/containerd/project) repository.
0 13
new file mode 100644
... ...
@@ -0,0 +1,92 @@
0
+/*
1
+   Copyright The containerd Authors.
2
+
3
+   Licensed under the Apache License, Version 2.0 (the "License");
4
+   you may not use this file except in compliance with the License.
5
+   You may obtain a copy of the License at
6
+
7
+       http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+   Unless required by applicable law or agreed to in writing, software
10
+   distributed under the License is distributed on an "AS IS" BASIS,
11
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+   See the License for the specific language governing permissions and
13
+   limitations under the License.
14
+*/
15
+
16
+// Package errdefs defines the common errors used throughout containerd
17
+// packages.
18
+//
19
+// Use with fmt.Errorf to add context to an error.
20
+//
21
+// To detect an error class, use the IsXXX functions to tell whether an error
22
+// is of a certain type.
23
+//
24
+// The functions ToGRPC and FromGRPC can be used to map server-side and
25
+// client-side errors to the correct types.
26
+package errdefs
27
+
28
+import (
29
+	"context"
30
+	"errors"
31
+)
32
+
33
+// Definitions of common error types used throughout containerd. All containerd
34
+// errors returned by most packages will map into one of these errors classes.
35
+// Packages should return errors of these types when they want to instruct a
36
+// client to take a particular action.
37
+//
38
+// For the most part, we just try to provide local grpc errors. Most conditions
39
+// map very well to those defined by grpc.
40
+var (
41
+	ErrUnknown            = errors.New("unknown") // used internally to represent a missed mapping.
42
+	ErrInvalidArgument    = errors.New("invalid argument")
43
+	ErrNotFound           = errors.New("not found")
44
+	ErrAlreadyExists      = errors.New("already exists")
45
+	ErrFailedPrecondition = errors.New("failed precondition")
46
+	ErrUnavailable        = errors.New("unavailable")
47
+	ErrNotImplemented     = errors.New("not implemented") // represents not supported and unimplemented
48
+)
49
+
50
+// IsInvalidArgument returns true if the error is due to an invalid argument
51
+func IsInvalidArgument(err error) bool {
52
+	return errors.Is(err, ErrInvalidArgument)
53
+}
54
+
55
+// IsNotFound returns true if the error is due to a missing object
56
+func IsNotFound(err error) bool {
57
+	return errors.Is(err, ErrNotFound)
58
+}
59
+
60
+// IsAlreadyExists returns true if the error is due to an already existing
61
+// metadata item
62
+func IsAlreadyExists(err error) bool {
63
+	return errors.Is(err, ErrAlreadyExists)
64
+}
65
+
66
+// IsFailedPrecondition returns true if an operation could not proceed to the
67
+// lack of a particular condition
68
+func IsFailedPrecondition(err error) bool {
69
+	return errors.Is(err, ErrFailedPrecondition)
70
+}
71
+
72
+// IsUnavailable returns true if the error is due to a resource being unavailable
73
+func IsUnavailable(err error) bool {
74
+	return errors.Is(err, ErrUnavailable)
75
+}
76
+
77
+// IsNotImplemented returns true if the error is due to not being implemented
78
+func IsNotImplemented(err error) bool {
79
+	return errors.Is(err, ErrNotImplemented)
80
+}
81
+
82
+// IsCanceled returns true if the error is due to `context.Canceled`.
83
+func IsCanceled(err error) bool {
84
+	return errors.Is(err, context.Canceled)
85
+}
86
+
87
+// IsDeadlineExceeded returns true if the error is due to
88
+// `context.DeadlineExceeded`.
89
+func IsDeadlineExceeded(err error) bool {
90
+	return errors.Is(err, context.DeadlineExceeded)
91
+}
0 92
new file mode 100644
... ...
@@ -0,0 +1,147 @@
0
+/*
1
+   Copyright The containerd Authors.
2
+
3
+   Licensed under the Apache License, Version 2.0 (the "License");
4
+   you may not use this file except in compliance with the License.
5
+   You may obtain a copy of the License at
6
+
7
+       http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+   Unless required by applicable law or agreed to in writing, software
10
+   distributed under the License is distributed on an "AS IS" BASIS,
11
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+   See the License for the specific language governing permissions and
13
+   limitations under the License.
14
+*/
15
+
16
+package errdefs
17
+
18
+import (
19
+	"context"
20
+	"fmt"
21
+	"strings"
22
+
23
+	"google.golang.org/grpc/codes"
24
+	"google.golang.org/grpc/status"
25
+)
26
+
27
+// ToGRPC will attempt to map the backend containerd error into a grpc error,
28
+// using the original error message as a description.
29
+//
30
+// Further information may be extracted from certain errors depending on their
31
+// type.
32
+//
33
+// If the error is unmapped, the original error will be returned to be handled
34
+// by the regular grpc error handling stack.
35
+func ToGRPC(err error) error {
36
+	if err == nil {
37
+		return nil
38
+	}
39
+
40
+	if isGRPCError(err) {
41
+		// error has already been mapped to grpc
42
+		return err
43
+	}
44
+
45
+	switch {
46
+	case IsInvalidArgument(err):
47
+		return status.Errorf(codes.InvalidArgument, err.Error())
48
+	case IsNotFound(err):
49
+		return status.Errorf(codes.NotFound, err.Error())
50
+	case IsAlreadyExists(err):
51
+		return status.Errorf(codes.AlreadyExists, err.Error())
52
+	case IsFailedPrecondition(err):
53
+		return status.Errorf(codes.FailedPrecondition, err.Error())
54
+	case IsUnavailable(err):
55
+		return status.Errorf(codes.Unavailable, err.Error())
56
+	case IsNotImplemented(err):
57
+		return status.Errorf(codes.Unimplemented, err.Error())
58
+	case IsCanceled(err):
59
+		return status.Errorf(codes.Canceled, err.Error())
60
+	case IsDeadlineExceeded(err):
61
+		return status.Errorf(codes.DeadlineExceeded, err.Error())
62
+	}
63
+
64
+	return err
65
+}
66
+
67
+// ToGRPCf maps the error to grpc error codes, assembling the formatting string
68
+// and combining it with the target error string.
69
+//
70
+// This is equivalent to errdefs.ToGRPC(fmt.Errorf("%s: %w", fmt.Sprintf(format, args...), err))
71
+func ToGRPCf(err error, format string, args ...interface{}) error {
72
+	return ToGRPC(fmt.Errorf("%s: %w", fmt.Sprintf(format, args...), err))
73
+}
74
+
75
+// FromGRPC returns the underlying error from a grpc service based on the grpc error code
76
+func FromGRPC(err error) error {
77
+	if err == nil {
78
+		return nil
79
+	}
80
+
81
+	var cls error // divide these into error classes, becomes the cause
82
+
83
+	switch code(err) {
84
+	case codes.InvalidArgument:
85
+		cls = ErrInvalidArgument
86
+	case codes.AlreadyExists:
87
+		cls = ErrAlreadyExists
88
+	case codes.NotFound:
89
+		cls = ErrNotFound
90
+	case codes.Unavailable:
91
+		cls = ErrUnavailable
92
+	case codes.FailedPrecondition:
93
+		cls = ErrFailedPrecondition
94
+	case codes.Unimplemented:
95
+		cls = ErrNotImplemented
96
+	case codes.Canceled:
97
+		cls = context.Canceled
98
+	case codes.DeadlineExceeded:
99
+		cls = context.DeadlineExceeded
100
+	default:
101
+		cls = ErrUnknown
102
+	}
103
+
104
+	msg := rebaseMessage(cls, err)
105
+	if msg != "" {
106
+		err = fmt.Errorf("%s: %w", msg, cls)
107
+	} else {
108
+		err = cls
109
+	}
110
+
111
+	return err
112
+}
113
+
114
+// rebaseMessage removes the repeats for an error at the end of an error
115
+// string. This will happen when taking an error over grpc then remapping it.
116
+//
117
+// Effectively, we just remove the string of cls from the end of err if it
118
+// appears there.
119
+func rebaseMessage(cls error, err error) string {
120
+	desc := errDesc(err)
121
+	clss := cls.Error()
122
+	if desc == clss {
123
+		return ""
124
+	}
125
+
126
+	return strings.TrimSuffix(desc, ": "+clss)
127
+}
128
+
129
+func isGRPCError(err error) bool {
130
+	_, ok := status.FromError(err)
131
+	return ok
132
+}
133
+
134
+func code(err error) codes.Code {
135
+	if s, ok := status.FromError(err); ok {
136
+		return s.Code()
137
+	}
138
+	return codes.Unknown
139
+}
140
+
141
+func errDesc(err error) string {
142
+	if s, ok := status.FromError(err); ok {
143
+		return s.Message()
144
+	}
145
+	return err.Error()
146
+}
... ...
@@ -261,7 +261,7 @@ github.com/containerd/cgroups/v3/cgroup2/stats
261 261
 # github.com/containerd/console v1.0.4
262 262
 ## explicit; go 1.13
263 263
 github.com/containerd/console
264
-# github.com/containerd/containerd v1.7.17
264
+# github.com/containerd/containerd v1.7.18
265 265
 ## explicit; go 1.21
266 266
 github.com/containerd/containerd
267 267
 github.com/containerd/containerd/api/events
... ...
@@ -311,7 +311,6 @@ github.com/containerd/containerd/images/converter
311 311
 github.com/containerd/containerd/labels
312 312
 github.com/containerd/containerd/leases
313 313
 github.com/containerd/containerd/leases/proxy
314
-github.com/containerd/containerd/log
315 314
 github.com/containerd/containerd/metadata
316 315
 github.com/containerd/containerd/metadata/boltutil
317 316
 github.com/containerd/containerd/mount
... ...
@@ -374,6 +373,9 @@ github.com/containerd/continuity/devices
374 374
 github.com/containerd/continuity/driver
375 375
 github.com/containerd/continuity/fs
376 376
 github.com/containerd/continuity/sysx
377
+# github.com/containerd/errdefs v0.1.0
378
+## explicit; go 1.20
379
+github.com/containerd/errdefs
377 380
 # github.com/containerd/fifo v1.1.0
378 381
 ## explicit; go 1.18
379 382
 github.com/containerd/fifo