Merge pull request #9662 from dmcgowan/replace-platform-package
Use github.com/containerd/platforms package
This commit is contained in:
commit
f2765617c5
@ -56,10 +56,10 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/pkg/events"
|
"github.com/containerd/containerd/v2/pkg/events"
|
||||||
"github.com/containerd/containerd/v2/pkg/namespaces"
|
"github.com/containerd/containerd/v2/pkg/namespaces"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/containerd/v2/plugins"
|
"github.com/containerd/containerd/v2/plugins"
|
||||||
"github.com/containerd/containerd/v2/plugins/services/introspection"
|
"github.com/containerd/containerd/v2/plugins/services/introspection"
|
||||||
ptypes "github.com/containerd/containerd/v2/protobuf/types"
|
ptypes "github.com/containerd/containerd/v2/protobuf/types"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/containerd/typeurl/v2"
|
"github.com/containerd/typeurl/v2"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
"github.com/opencontainers/runtime-spec/specs-go"
|
"github.com/opencontainers/runtime-spec/specs-go"
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/core/images"
|
"github.com/containerd/containerd/v2/core/images"
|
||||||
"github.com/containerd/containerd/v2/core/remotes"
|
"github.com/containerd/containerd/v2/core/remotes"
|
||||||
"github.com/containerd/containerd/v2/core/snapshots"
|
"github.com/containerd/containerd/v2/core/snapshots"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
@ -29,9 +29,9 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/core/images"
|
"github.com/containerd/containerd/v2/core/images"
|
||||||
"github.com/containerd/containerd/v2/core/runtime/v2/runc/options"
|
"github.com/containerd/containerd/v2/core/runtime/v2/runc/options"
|
||||||
"github.com/containerd/containerd/v2/pkg/rootfs"
|
"github.com/containerd/containerd/v2/pkg/rootfs"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/containerd/v2/protobuf"
|
"github.com/containerd/containerd/v2/protobuf"
|
||||||
"github.com/containerd/containerd/v2/protobuf/proto"
|
"github.com/containerd/containerd/v2/protobuf/proto"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
imagespec "github.com/opencontainers/image-spec/specs-go/v1"
|
imagespec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
)
|
)
|
||||||
|
@ -32,7 +32,7 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/pkg/labels"
|
"github.com/containerd/containerd/v2/pkg/labels"
|
||||||
"github.com/containerd/containerd/v2/pkg/rootfs"
|
"github.com/containerd/containerd/v2/pkg/rootfs"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
"github.com/opencontainers/image-spec/identity"
|
"github.com/opencontainers/image-spec/identity"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/core/images"
|
"github.com/containerd/containerd/v2/core/images"
|
||||||
"github.com/containerd/containerd/v2/core/images/archive"
|
"github.com/containerd/containerd/v2/core/images/archive"
|
||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
digest "github.com/opencontainers/go-digest"
|
digest "github.com/opencontainers/go-digest"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
)
|
)
|
||||||
|
@ -31,7 +31,7 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/pkg/tracing"
|
"github.com/containerd/containerd/v2/pkg/tracing"
|
||||||
"github.com/containerd/containerd/v2/pkg/unpack"
|
"github.com/containerd/containerd/v2/pkg/unpack"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -61,10 +61,10 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/pkg/dialer"
|
"github.com/containerd/containerd/v2/pkg/dialer"
|
||||||
"github.com/containerd/containerd/v2/pkg/sys"
|
"github.com/containerd/containerd/v2/pkg/sys"
|
||||||
"github.com/containerd/containerd/v2/pkg/timeout"
|
"github.com/containerd/containerd/v2/pkg/timeout"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/containerd/v2/plugins"
|
"github.com/containerd/containerd/v2/plugins"
|
||||||
"github.com/containerd/containerd/v2/plugins/content/local"
|
"github.com/containerd/containerd/v2/plugins/content/local"
|
||||||
"github.com/containerd/containerd/v2/plugins/services/warning"
|
"github.com/containerd/containerd/v2/plugins/services/warning"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/containerd/plugin"
|
"github.com/containerd/plugin"
|
||||||
"github.com/containerd/plugin/dynamic"
|
"github.com/containerd/plugin/dynamic"
|
||||||
"github.com/containerd/plugin/registry"
|
"github.com/containerd/plugin/registry"
|
||||||
|
@ -33,8 +33,8 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/core/remotes"
|
"github.com/containerd/containerd/v2/core/remotes"
|
||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/pkg/progress"
|
"github.com/containerd/containerd/v2/pkg/progress"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/cmd/ctr/commands"
|
"github.com/containerd/containerd/v2/cmd/ctr/commands"
|
||||||
"github.com/containerd/containerd/v2/core/images/converter"
|
"github.com/containerd/containerd/v2/core/images/converter"
|
||||||
"github.com/containerd/containerd/v2/core/images/converter/uncompress"
|
"github.com/containerd/containerd/v2/core/images/converter/uncompress"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/pkg/transfer"
|
"github.com/containerd/containerd/v2/pkg/transfer"
|
||||||
tarchive "github.com/containerd/containerd/v2/pkg/transfer/archive"
|
tarchive "github.com/containerd/containerd/v2/pkg/transfer/archive"
|
||||||
"github.com/containerd/containerd/v2/pkg/transfer/image"
|
"github.com/containerd/containerd/v2/pkg/transfer/image"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
)
|
)
|
||||||
|
|
||||||
var exportCommand = cli.Command{
|
var exportCommand = cli.Command{
|
||||||
|
@ -28,8 +28,8 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/core/images"
|
"github.com/containerd/containerd/v2/core/images"
|
||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/pkg/progress"
|
"github.com/containerd/containerd/v2/pkg/progress"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -31,8 +31,8 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/pkg/transfer"
|
"github.com/containerd/containerd/v2/pkg/transfer"
|
||||||
tarchive "github.com/containerd/containerd/v2/pkg/transfer/archive"
|
tarchive "github.com/containerd/containerd/v2/pkg/transfer/archive"
|
||||||
"github.com/containerd/containerd/v2/pkg/transfer/image"
|
"github.com/containerd/containerd/v2/pkg/transfer/image"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
)
|
)
|
||||||
|
|
||||||
var importCommand = cli.Command{
|
var importCommand = cli.Command{
|
||||||
|
@ -26,7 +26,7 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/core/mount"
|
"github.com/containerd/containerd/v2/core/mount"
|
||||||
"github.com/containerd/containerd/v2/defaults"
|
"github.com/containerd/containerd/v2/defaults"
|
||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
"github.com/opencontainers/image-spec/identity"
|
"github.com/opencontainers/image-spec/identity"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
@ -32,8 +32,8 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/pkg/transfer"
|
"github.com/containerd/containerd/v2/pkg/transfer"
|
||||||
"github.com/containerd/containerd/v2/pkg/transfer/image"
|
"github.com/containerd/containerd/v2/pkg/transfer/image"
|
||||||
"github.com/containerd/containerd/v2/pkg/transfer/registry"
|
"github.com/containerd/containerd/v2/pkg/transfer/registry"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/opencontainers/image-spec/identity"
|
"github.com/opencontainers/image-spec/identity"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
|
@ -36,8 +36,8 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/pkg/transfer"
|
"github.com/containerd/containerd/v2/pkg/transfer"
|
||||||
"github.com/containerd/containerd/v2/pkg/transfer/image"
|
"github.com/containerd/containerd/v2/pkg/transfer/image"
|
||||||
"github.com/containerd/containerd/v2/pkg/transfer/registry"
|
"github.com/containerd/containerd/v2/pkg/transfer/registry"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
digest "github.com/opencontainers/go-digest"
|
digest "github.com/opencontainers/go-digest"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
|
@ -24,7 +24,7 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/cmd/ctr/commands"
|
"github.com/containerd/containerd/v2/cmd/ctr/commands"
|
||||||
"github.com/containerd/containerd/v2/core/containers"
|
"github.com/containerd/containerd/v2/core/containers"
|
||||||
"github.com/containerd/containerd/v2/pkg/oci"
|
"github.com/containerd/containerd/v2/pkg/oci"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Command is the parent for all OCI related tools under 'oci'
|
// Command is the parent for all OCI related tools under 'oci'
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
|
|
||||||
"github.com/containerd/containerd/v2/api/types"
|
"github.com/containerd/containerd/v2/api/types"
|
||||||
"github.com/containerd/containerd/v2/cmd/ctr/commands"
|
"github.com/containerd/containerd/v2/cmd/ctr/commands"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
pluginutils "github.com/containerd/plugin"
|
pluginutils "github.com/containerd/plugin"
|
||||||
v1 "github.com/opencontainers/image-spec/specs-go/v1"
|
v1 "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
|
@ -38,8 +38,8 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/core/snapshots"
|
"github.com/containerd/containerd/v2/core/snapshots"
|
||||||
"github.com/containerd/containerd/v2/pkg/oci"
|
"github.com/containerd/containerd/v2/pkg/oci"
|
||||||
runtimeoptions "github.com/containerd/containerd/v2/pkg/runtimeoptions/v1"
|
runtimeoptions "github.com/containerd/containerd/v2/pkg/runtimeoptions/v1"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/intel/goresctrl/pkg/blockio"
|
"github.com/intel/goresctrl/pkg/blockio"
|
||||||
"github.com/opencontainers/runtime-spec/specs-go"
|
"github.com/opencontainers/runtime-spec/specs-go"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
|
@ -21,8 +21,8 @@ import (
|
|||||||
|
|
||||||
fuzz "github.com/AdaLogics/go-fuzz-headers"
|
fuzz "github.com/AdaLogics/go-fuzz-headers"
|
||||||
"github.com/containerd/containerd/v2/core/images"
|
"github.com/containerd/containerd/v2/core/images"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/containerd/v2/plugins/content/local"
|
"github.com/containerd/containerd/v2/plugins/content/local"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -30,8 +30,8 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/core/images"
|
"github.com/containerd/containerd/v2/core/images"
|
||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/pkg/labels"
|
"github.com/containerd/containerd/v2/pkg/labels"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
digest "github.com/opencontainers/go-digest"
|
digest "github.com/opencontainers/go-digest"
|
||||||
ocispecs "github.com/opencontainers/image-spec/specs-go"
|
ocispecs "github.com/opencontainers/image-spec/specs-go"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
|
@ -32,8 +32,8 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/pkg/archive/compression"
|
"github.com/containerd/containerd/v2/pkg/archive/compression"
|
||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/pkg/labels"
|
"github.com/containerd/containerd/v2/pkg/labels"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
digest "github.com/opencontainers/go-digest"
|
digest "github.com/opencontainers/go-digest"
|
||||||
specs "github.com/opencontainers/image-spec/specs-go"
|
specs "github.com/opencontainers/image-spec/specs-go"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/core/content"
|
"github.com/containerd/containerd/v2/core/content"
|
||||||
"github.com/containerd/containerd/v2/core/images"
|
"github.com/containerd/containerd/v2/core/images"
|
||||||
"github.com/containerd/containerd/v2/core/leases"
|
"github.com/containerd/containerd/v2/core/leases"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
)
|
)
|
||||||
|
|
||||||
type convertOpts struct {
|
type convertOpts struct {
|
||||||
|
@ -26,8 +26,8 @@ import (
|
|||||||
|
|
||||||
"github.com/containerd/containerd/v2/core/content"
|
"github.com/containerd/containerd/v2/core/content"
|
||||||
"github.com/containerd/containerd/v2/core/images"
|
"github.com/containerd/containerd/v2/core/images"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
|
@ -24,7 +24,7 @@ import (
|
|||||||
|
|
||||||
"github.com/containerd/containerd/v2/core/content"
|
"github.com/containerd/containerd/v2/core/content"
|
||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
"golang.org/x/sync/semaphore"
|
"golang.org/x/sync/semaphore"
|
||||||
|
@ -25,8 +25,8 @@ import (
|
|||||||
|
|
||||||
"github.com/containerd/containerd/v2/core/content"
|
"github.com/containerd/containerd/v2/core/content"
|
||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
digest "github.com/opencontainers/go-digest"
|
digest "github.com/opencontainers/go-digest"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
)
|
)
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/core/images"
|
"github.com/containerd/containerd/v2/core/images"
|
||||||
"github.com/containerd/containerd/v2/core/snapshots"
|
"github.com/containerd/containerd/v2/core/snapshots"
|
||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
|
|
||||||
"golang.org/x/sync/semaphore"
|
"golang.org/x/sync/semaphore"
|
||||||
|
@ -22,8 +22,8 @@ import (
|
|||||||
|
|
||||||
"github.com/containerd/containerd/v2/core/images"
|
"github.com/containerd/containerd/v2/core/images"
|
||||||
"github.com/containerd/containerd/v2/core/images/imagetest"
|
"github.com/containerd/containerd/v2/core/images/imagetest"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/log/logtest"
|
"github.com/containerd/log/logtest"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@ import (
|
|||||||
v2 "github.com/containerd/containerd/v2/core/metrics/cgroups/v2"
|
v2 "github.com/containerd/containerd/v2/core/metrics/cgroups/v2"
|
||||||
"github.com/containerd/containerd/v2/core/runtime"
|
"github.com/containerd/containerd/v2/core/runtime"
|
||||||
"github.com/containerd/containerd/v2/pkg/events"
|
"github.com/containerd/containerd/v2/pkg/events"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/containerd/v2/plugins"
|
"github.com/containerd/containerd/v2/plugins"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/containerd/plugin"
|
"github.com/containerd/plugin"
|
||||||
"github.com/containerd/plugin/registry"
|
"github.com/containerd/plugin/registry"
|
||||||
metrics "github.com/docker/go-metrics"
|
metrics "github.com/docker/go-metrics"
|
||||||
|
@ -29,8 +29,8 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/core/images"
|
"github.com/containerd/containerd/v2/core/images"
|
||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/pkg/labels"
|
"github.com/containerd/containerd/v2/pkg/labels"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
"golang.org/x/sync/semaphore"
|
"golang.org/x/sync/semaphore"
|
||||||
)
|
)
|
||||||
|
@ -36,10 +36,10 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/pkg/events/exchange"
|
"github.com/containerd/containerd/v2/pkg/events/exchange"
|
||||||
"github.com/containerd/containerd/v2/pkg/namespaces"
|
"github.com/containerd/containerd/v2/pkg/namespaces"
|
||||||
"github.com/containerd/containerd/v2/pkg/timeout"
|
"github.com/containerd/containerd/v2/pkg/timeout"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/containerd/v2/plugins"
|
"github.com/containerd/containerd/v2/plugins"
|
||||||
"github.com/containerd/containerd/v2/protobuf"
|
"github.com/containerd/containerd/v2/protobuf"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/containerd/plugin"
|
"github.com/containerd/plugin"
|
||||||
"github.com/containerd/plugin/registry"
|
"github.com/containerd/plugin/registry"
|
||||||
)
|
)
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
package v2
|
package v2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
)
|
)
|
||||||
|
|
||||||
func defaultPlatforms() []string {
|
func defaultPlatforms() []string {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package v2
|
package v2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
)
|
)
|
||||||
|
|
||||||
func defaultPlatforms() []string {
|
func defaultPlatforms() []string {
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
|
|
||||||
"github.com/containerd/containerd/v2/api/types"
|
"github.com/containerd/containerd/v2/api/types"
|
||||||
"github.com/containerd/containerd/v2/core/mount"
|
"github.com/containerd/containerd/v2/core/mount"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
"github.com/containerd/typeurl/v2"
|
"github.com/containerd/typeurl/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/core/mount"
|
"github.com/containerd/containerd/v2/core/mount"
|
||||||
"github.com/containerd/containerd/v2/core/sandbox"
|
"github.com/containerd/containerd/v2/core/sandbox"
|
||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
"google.golang.org/protobuf/types/known/anypb"
|
"google.golang.org/protobuf/types/known/anypb"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
1
go.mod
1
go.mod
@ -17,6 +17,7 @@ require (
|
|||||||
github.com/containerd/go-runc v1.1.0
|
github.com/containerd/go-runc v1.1.0
|
||||||
github.com/containerd/log v0.1.0
|
github.com/containerd/log v0.1.0
|
||||||
github.com/containerd/nri v0.5.0
|
github.com/containerd/nri v0.5.0
|
||||||
|
github.com/containerd/platforms v0.1.1
|
||||||
github.com/containerd/plugin v0.0.0-20231101173250-7ec69893e1e7
|
github.com/containerd/plugin v0.0.0-20231101173250-7ec69893e1e7
|
||||||
github.com/containerd/ttrpc v1.2.2
|
github.com/containerd/ttrpc v1.2.2
|
||||||
github.com/containerd/typeurl/v2 v2.1.1
|
github.com/containerd/typeurl/v2 v2.1.1
|
||||||
|
2
go.sum
2
go.sum
@ -58,6 +58,8 @@ github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I=
|
|||||||
github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo=
|
github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo=
|
||||||
github.com/containerd/nri v0.5.0 h1:bwCtKpi8i5FCA8g8WjIZNod91CEfIloYpV0+TH2prnQ=
|
github.com/containerd/nri v0.5.0 h1:bwCtKpi8i5FCA8g8WjIZNod91CEfIloYpV0+TH2prnQ=
|
||||||
github.com/containerd/nri v0.5.0/go.mod h1:qIu2NlP3r/qK4YGnNuQf0De4VPqQWP2i2CVBfAZbGzg=
|
github.com/containerd/nri v0.5.0/go.mod h1:qIu2NlP3r/qK4YGnNuQf0De4VPqQWP2i2CVBfAZbGzg=
|
||||||
|
github.com/containerd/platforms v0.1.1 h1:gp0xXBoY+1CjH54gJDon0kBjIbK2C4XSX1BGwP5ptG0=
|
||||||
|
github.com/containerd/platforms v0.1.1/go.mod h1:XOM2BS6kN6gXafPLg80V6y/QUib+xoLyC3qVmHzibko=
|
||||||
github.com/containerd/plugin v0.0.0-20231101173250-7ec69893e1e7 h1:MUbtIMHEcMzj+8mPgHd5ett0WVbY/KYHa5tMvFs5Ejs=
|
github.com/containerd/plugin v0.0.0-20231101173250-7ec69893e1e7 h1:MUbtIMHEcMzj+8mPgHd5ett0WVbY/KYHa5tMvFs5Ejs=
|
||||||
github.com/containerd/plugin v0.0.0-20231101173250-7ec69893e1e7/go.mod h1:j6HlpMtkiZMgT4UsfVNxPBUkwdw9KQGU6nCLfRxnq+w=
|
github.com/containerd/plugin v0.0.0-20231101173250-7ec69893e1e7/go.mod h1:j6HlpMtkiZMgT4UsfVNxPBUkwdw9KQGU6nCLfRxnq+w=
|
||||||
github.com/containerd/ttrpc v1.2.2 h1:9vqZr0pxwOF5koz6N0N3kJ0zDHokrcPxIR/ZR2YFtOs=
|
github.com/containerd/ttrpc v1.2.2 h1:9vqZr0pxwOF5koz6N0N3kJ0zDHokrcPxIR/ZR2YFtOs=
|
||||||
|
@ -28,9 +28,9 @@ import (
|
|||||||
srvconfig "github.com/containerd/containerd/v2/cmd/containerd/server/config"
|
srvconfig "github.com/containerd/containerd/v2/cmd/containerd/server/config"
|
||||||
"github.com/containerd/containerd/v2/core/content"
|
"github.com/containerd/containerd/v2/core/content"
|
||||||
"github.com/containerd/containerd/v2/pkg/cri/constants"
|
"github.com/containerd/containerd/v2/pkg/cri/constants"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/containerd/v2/plugins"
|
"github.com/containerd/containerd/v2/plugins"
|
||||||
"github.com/containerd/log/logtest"
|
"github.com/containerd/log/logtest"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/containerd/plugin"
|
"github.com/containerd/plugin"
|
||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
|
|
||||||
|
@ -40,8 +40,8 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/internal/testutil"
|
"github.com/containerd/containerd/v2/internal/testutil"
|
||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/pkg/namespaces"
|
"github.com/containerd/containerd/v2/pkg/namespaces"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
|
|
||||||
. "github.com/containerd/containerd/v2/client"
|
. "github.com/containerd/containerd/v2/client"
|
||||||
"github.com/containerd/containerd/v2/integration/images"
|
"github.com/containerd/containerd/v2/integration/images"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -41,12 +41,12 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/pkg/namespaces"
|
"github.com/containerd/containerd/v2/pkg/namespaces"
|
||||||
"github.com/containerd/containerd/v2/pkg/oci"
|
"github.com/containerd/containerd/v2/pkg/oci"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/containerd/v2/plugins"
|
"github.com/containerd/containerd/v2/plugins"
|
||||||
gogotypes "github.com/containerd/containerd/v2/protobuf/types"
|
gogotypes "github.com/containerd/containerd/v2/protobuf/types"
|
||||||
"github.com/containerd/continuity/fs"
|
"github.com/containerd/continuity/fs"
|
||||||
"github.com/containerd/go-runc"
|
"github.com/containerd/go-runc"
|
||||||
"github.com/containerd/log/logtest"
|
"github.com/containerd/log/logtest"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/containerd/typeurl/v2"
|
"github.com/containerd/typeurl/v2"
|
||||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/core/images"
|
"github.com/containerd/containerd/v2/core/images"
|
||||||
"github.com/containerd/containerd/v2/core/images/converter"
|
"github.com/containerd/containerd/v2/core/images/converter"
|
||||||
"github.com/containerd/containerd/v2/core/images/converter/uncompress"
|
"github.com/containerd/containerd/v2/core/images/converter/uncompress"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
@ -31,7 +31,7 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/core/images/archive"
|
"github.com/containerd/containerd/v2/core/images/archive"
|
||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/pkg/namespaces"
|
"github.com/containerd/containerd/v2/pkg/namespaces"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
)
|
)
|
||||||
|
@ -29,7 +29,7 @@ import (
|
|||||||
imagelist "github.com/containerd/containerd/v2/integration/images"
|
imagelist "github.com/containerd/containerd/v2/integration/images"
|
||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/pkg/labels"
|
"github.com/containerd/containerd/v2/pkg/labels"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/pkg/transfer"
|
"github.com/containerd/containerd/v2/pkg/transfer"
|
||||||
tarchive "github.com/containerd/containerd/v2/pkg/transfer/archive"
|
tarchive "github.com/containerd/containerd/v2/pkg/transfer/archive"
|
||||||
"github.com/containerd/containerd/v2/pkg/transfer/image"
|
"github.com/containerd/containerd/v2/pkg/transfer/image"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
|
|
||||||
digest "github.com/opencontainers/go-digest"
|
digest "github.com/opencontainers/go-digest"
|
||||||
|
@ -33,8 +33,8 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/pkg/cri/server"
|
"github.com/containerd/containerd/v2/pkg/cri/server"
|
||||||
"github.com/containerd/containerd/v2/pkg/cri/server/base"
|
"github.com/containerd/containerd/v2/pkg/cri/server/base"
|
||||||
nriservice "github.com/containerd/containerd/v2/pkg/nri"
|
nriservice "github.com/containerd/containerd/v2/pkg/nri"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/containerd/v2/plugins"
|
"github.com/containerd/containerd/v2/plugins"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
|
||||||
|
@ -34,9 +34,9 @@ import (
|
|||||||
criconfig "github.com/containerd/containerd/v2/pkg/cri/config"
|
criconfig "github.com/containerd/containerd/v2/pkg/cri/config"
|
||||||
"github.com/containerd/containerd/v2/pkg/cri/constants"
|
"github.com/containerd/containerd/v2/pkg/cri/constants"
|
||||||
"github.com/containerd/containerd/v2/pkg/oci"
|
"github.com/containerd/containerd/v2/pkg/oci"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/containerd/v2/plugins"
|
"github.com/containerd/containerd/v2/plugins"
|
||||||
"github.com/containerd/containerd/v2/plugins/services/warning"
|
"github.com/containerd/containerd/v2/plugins/services/warning"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CRIBase contains common dependencies for CRI's runtime, image, and podsandbox services.
|
// CRIBase contains common dependencies for CRI's runtime, image, and podsandbox services.
|
||||||
|
@ -45,7 +45,7 @@ import (
|
|||||||
containerstore "github.com/containerd/containerd/v2/pkg/cri/store/container"
|
containerstore "github.com/containerd/containerd/v2/pkg/cri/store/container"
|
||||||
"github.com/containerd/containerd/v2/pkg/cri/util"
|
"github.com/containerd/containerd/v2/pkg/cri/util"
|
||||||
"github.com/containerd/containerd/v2/pkg/oci"
|
"github.com/containerd/containerd/v2/pkg/oci"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -30,7 +30,7 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/core/containers"
|
"github.com/containerd/containerd/v2/core/containers"
|
||||||
"github.com/containerd/containerd/v2/core/mount"
|
"github.com/containerd/containerd/v2/core/mount"
|
||||||
"github.com/containerd/containerd/v2/pkg/oci"
|
"github.com/containerd/containerd/v2/pkg/oci"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
imagespec "github.com/opencontainers/image-spec/specs-go/v1"
|
imagespec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
runtimespec "github.com/opencontainers/runtime-spec/specs-go"
|
runtimespec "github.com/opencontainers/runtime-spec/specs-go"
|
||||||
"github.com/opencontainers/selinux/go-selinux"
|
"github.com/opencontainers/selinux/go-selinux"
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
ostesting "github.com/containerd/containerd/v2/pkg/os/testing"
|
ostesting "github.com/containerd/containerd/v2/pkg/os/testing"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
|
|
||||||
imagespec "github.com/opencontainers/image-spec/specs-go/v1"
|
imagespec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
runtimespec "github.com/opencontainers/runtime-spec/specs-go"
|
runtimespec "github.com/opencontainers/runtime-spec/specs-go"
|
||||||
|
@ -22,8 +22,8 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/containerd/containerd/v2/core/images"
|
"github.com/containerd/containerd/v2/core/images"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LoadImages checks all existing images to ensure they are ready to
|
// LoadImages checks all existing images to ensure they are ready to
|
||||||
|
@ -29,7 +29,7 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/pkg/cri/annotations"
|
"github.com/containerd/containerd/v2/pkg/cri/annotations"
|
||||||
criconfig "github.com/containerd/containerd/v2/pkg/cri/config"
|
criconfig "github.com/containerd/containerd/v2/pkg/cri/config"
|
||||||
"github.com/containerd/containerd/v2/pkg/cri/labels"
|
"github.com/containerd/containerd/v2/pkg/cri/labels"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestParseAuth(t *testing.T) {
|
func TestParseAuth(t *testing.T) {
|
||||||
|
@ -29,8 +29,8 @@ import (
|
|||||||
imagestore "github.com/containerd/containerd/v2/pkg/cri/store/image"
|
imagestore "github.com/containerd/containerd/v2/pkg/cri/store/image"
|
||||||
snapshotstore "github.com/containerd/containerd/v2/pkg/cri/store/snapshot"
|
snapshotstore "github.com/containerd/containerd/v2/pkg/cri/store/snapshot"
|
||||||
"github.com/containerd/containerd/v2/pkg/events"
|
"github.com/containerd/containerd/v2/pkg/events"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
docker "github.com/distribution/reference"
|
docker "github.com/distribution/reference"
|
||||||
imagedigest "github.com/opencontainers/go-digest"
|
imagedigest "github.com/opencontainers/go-digest"
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ import (
|
|||||||
imagestore "github.com/containerd/containerd/v2/pkg/cri/store/image"
|
imagestore "github.com/containerd/containerd/v2/pkg/cri/store/image"
|
||||||
snapshotstore "github.com/containerd/containerd/v2/pkg/cri/store/snapshot"
|
snapshotstore "github.com/containerd/containerd/v2/pkg/cri/store/snapshot"
|
||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -38,9 +38,9 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/pkg/oci"
|
"github.com/containerd/containerd/v2/pkg/oci"
|
||||||
osinterface "github.com/containerd/containerd/v2/pkg/os"
|
osinterface "github.com/containerd/containerd/v2/pkg/os"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/containerd/v2/plugins"
|
"github.com/containerd/containerd/v2/plugins"
|
||||||
"github.com/containerd/containerd/v2/protobuf"
|
"github.com/containerd/containerd/v2/protobuf"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -31,7 +31,7 @@ import (
|
|||||||
servertesting "github.com/containerd/containerd/v2/pkg/cri/testing"
|
servertesting "github.com/containerd/containerd/v2/pkg/cri/testing"
|
||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
ostesting "github.com/containerd/containerd/v2/pkg/os/testing"
|
ostesting "github.com/containerd/containerd/v2/pkg/os/testing"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
)
|
)
|
||||||
|
|
||||||
type fakeSandboxService struct{}
|
type fakeSandboxService struct{}
|
||||||
|
@ -19,7 +19,7 @@ package image
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewFakeStore returns an image store with predefined images.
|
// NewFakeStore returns an image store with predefined images.
|
||||||
|
@ -28,7 +28,7 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/pkg/cri/labels"
|
"github.com/containerd/containerd/v2/pkg/cri/labels"
|
||||||
"github.com/containerd/containerd/v2/pkg/cri/util"
|
"github.com/containerd/containerd/v2/pkg/cri/util"
|
||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
docker "github.com/distribution/reference"
|
docker "github.com/distribution/reference"
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/api/types"
|
"github.com/containerd/containerd/v2/api/types"
|
||||||
"github.com/containerd/containerd/v2/core/containers"
|
"github.com/containerd/containerd/v2/core/containers"
|
||||||
"github.com/containerd/containerd/v2/pkg/namespaces"
|
"github.com/containerd/containerd/v2/pkg/namespaces"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -33,9 +33,9 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/core/images"
|
"github.com/containerd/containerd/v2/core/images"
|
||||||
"github.com/containerd/containerd/v2/core/mount"
|
"github.com/containerd/containerd/v2/core/mount"
|
||||||
"github.com/containerd/containerd/v2/pkg/namespaces"
|
"github.com/containerd/containerd/v2/pkg/namespaces"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/continuity/fs"
|
"github.com/containerd/continuity/fs"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/moby/sys/user"
|
"github.com/moby/sys/user"
|
||||||
v1 "github.com/opencontainers/image-spec/specs-go/v1"
|
v1 "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
"github.com/opencontainers/runtime-spec/specs-go"
|
"github.com/opencontainers/runtime-spec/specs-go"
|
||||||
|
@ -31,8 +31,8 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/pkg/streaming"
|
"github.com/containerd/containerd/v2/pkg/streaming"
|
||||||
"github.com/containerd/containerd/v2/pkg/transfer/plugins"
|
"github.com/containerd/containerd/v2/pkg/transfer/plugins"
|
||||||
tstreaming "github.com/containerd/containerd/v2/pkg/transfer/streaming"
|
tstreaming "github.com/containerd/containerd/v2/pkg/transfer/streaming"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -33,7 +33,7 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/pkg/streaming"
|
"github.com/containerd/containerd/v2/pkg/streaming"
|
||||||
"github.com/containerd/containerd/v2/pkg/transfer"
|
"github.com/containerd/containerd/v2/pkg/transfer"
|
||||||
"github.com/containerd/containerd/v2/pkg/transfer/plugins"
|
"github.com/containerd/containerd/v2/pkg/transfer/plugins"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/defaults"
|
"github.com/containerd/containerd/v2/defaults"
|
||||||
"github.com/containerd/containerd/v2/pkg/transfer"
|
"github.com/containerd/containerd/v2/pkg/transfer"
|
||||||
"github.com/containerd/containerd/v2/pkg/unpack"
|
"github.com/containerd/containerd/v2/pkg/unpack"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetSupportedPlatform(t *testing.T) {
|
func TestGetSupportedPlatform(t *testing.T) {
|
||||||
|
@ -27,7 +27,7 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/core/remotes"
|
"github.com/containerd/containerd/v2/core/remotes"
|
||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/pkg/transfer"
|
"github.com/containerd/containerd/v2/pkg/transfer"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
"github.com/containerd/platforms"
|
||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
)
|
)
|
||||||
|
@ -38,8 +38,8 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/pkg/labels"
|
"github.com/containerd/containerd/v2/pkg/labels"
|
||||||
"github.com/containerd/containerd/v2/pkg/tracing"
|
"github.com/containerd/containerd/v2/pkg/tracing"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
"github.com/opencontainers/image-spec/identity"
|
"github.com/opencontainers/image-spec/identity"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
|
@ -1,415 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright The containerd Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package platforms
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestOnly(t *testing.T) {
|
|
||||||
for _, tc := range []struct {
|
|
||||||
platform string
|
|
||||||
matches map[bool][]string
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
platform: "linux/amd64",
|
|
||||||
matches: map[bool][]string{
|
|
||||||
true: {
|
|
||||||
"linux/amd64",
|
|
||||||
"linux/386",
|
|
||||||
},
|
|
||||||
false: {
|
|
||||||
"linux/amd64/v2",
|
|
||||||
"linux/arm/v7",
|
|
||||||
"linux/arm64",
|
|
||||||
"windows/amd64",
|
|
||||||
"windows/arm",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: "linux/amd64/v2",
|
|
||||||
matches: map[bool][]string{
|
|
||||||
true: {
|
|
||||||
"linux/amd64",
|
|
||||||
"linux/amd64/v1",
|
|
||||||
"linux/amd64/v2",
|
|
||||||
"linux/386",
|
|
||||||
},
|
|
||||||
false: {
|
|
||||||
"linux/amd64/v3",
|
|
||||||
"linux/amd64/v4",
|
|
||||||
"linux/arm/v7",
|
|
||||||
"linux/arm64",
|
|
||||||
"windows/amd64",
|
|
||||||
"windows/arm",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: "linux/386",
|
|
||||||
matches: map[bool][]string{
|
|
||||||
true: {
|
|
||||||
"linux/386",
|
|
||||||
},
|
|
||||||
false: {
|
|
||||||
"linux/amd64",
|
|
||||||
"linux/arm/v7",
|
|
||||||
"linux/arm64",
|
|
||||||
"windows/amd64",
|
|
||||||
"windows/arm",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: "windows/amd64",
|
|
||||||
matches: map[bool][]string{
|
|
||||||
true: {"windows/amd64"},
|
|
||||||
false: {
|
|
||||||
"linux/amd64",
|
|
||||||
"linux/arm/v7",
|
|
||||||
"linux/arm64",
|
|
||||||
"windows/arm",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: "linux/arm/v8",
|
|
||||||
matches: map[bool][]string{
|
|
||||||
true: {
|
|
||||||
"linux/arm",
|
|
||||||
"linux/arm/v5",
|
|
||||||
"linux/arm/v6",
|
|
||||||
"linux/arm/v7",
|
|
||||||
"linux/arm/v8",
|
|
||||||
},
|
|
||||||
false: {
|
|
||||||
"linux/amd64",
|
|
||||||
"linux/arm/v4",
|
|
||||||
"linux/arm64",
|
|
||||||
"windows/amd64",
|
|
||||||
"windows/arm",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: "linux/arm/v7",
|
|
||||||
matches: map[bool][]string{
|
|
||||||
true: {
|
|
||||||
"linux/arm",
|
|
||||||
"linux/arm/v5",
|
|
||||||
"linux/arm/v6",
|
|
||||||
"linux/arm/v7",
|
|
||||||
},
|
|
||||||
false: {
|
|
||||||
"linux/amd64",
|
|
||||||
"linux/arm/v4",
|
|
||||||
"linux/arm/v8",
|
|
||||||
"linux/arm64",
|
|
||||||
"windows/amd64",
|
|
||||||
"windows/arm",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: "linux/arm/v6",
|
|
||||||
matches: map[bool][]string{
|
|
||||||
true: {
|
|
||||||
"linux/arm/v5",
|
|
||||||
"linux/arm/v6",
|
|
||||||
},
|
|
||||||
false: {
|
|
||||||
"linux/amd64",
|
|
||||||
"linux/arm",
|
|
||||||
"linux/arm/v4",
|
|
||||||
"linux/arm/v7",
|
|
||||||
"linux/arm/v8",
|
|
||||||
"linux/arm64",
|
|
||||||
"windows/amd64",
|
|
||||||
"windows/arm",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: "linux/arm/v5",
|
|
||||||
matches: map[bool][]string{
|
|
||||||
true: {
|
|
||||||
"linux/arm/v5",
|
|
||||||
},
|
|
||||||
false: {
|
|
||||||
"linux/amd64",
|
|
||||||
"linux/arm",
|
|
||||||
"linux/arm/v4",
|
|
||||||
"linux/arm/v6",
|
|
||||||
"linux/arm/v7",
|
|
||||||
"linux/arm/v8",
|
|
||||||
"linux/arm64",
|
|
||||||
"windows/amd64",
|
|
||||||
"windows/arm",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: "linux/arm/v4",
|
|
||||||
matches: map[bool][]string{
|
|
||||||
true: {
|
|
||||||
"linux/arm/v4",
|
|
||||||
},
|
|
||||||
false: {
|
|
||||||
"linux/amd64",
|
|
||||||
"linux/arm",
|
|
||||||
"linux/arm/v5",
|
|
||||||
"linux/arm/v6",
|
|
||||||
"linux/arm/v7",
|
|
||||||
"linux/arm/v8",
|
|
||||||
"linux/arm64",
|
|
||||||
"windows/amd64",
|
|
||||||
"windows/arm",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: "linux/arm64",
|
|
||||||
matches: map[bool][]string{
|
|
||||||
true: {
|
|
||||||
"linux/arm",
|
|
||||||
"linux/arm/v5",
|
|
||||||
"linux/arm/v6",
|
|
||||||
"linux/arm/v7",
|
|
||||||
"linux/arm/v8",
|
|
||||||
"linux/arm64",
|
|
||||||
"linux/arm64/v8",
|
|
||||||
},
|
|
||||||
false: {
|
|
||||||
"linux/amd64",
|
|
||||||
"linux/arm/v4",
|
|
||||||
"linux/arm/v9",
|
|
||||||
"linux/arm64/v9",
|
|
||||||
"windows/amd64",
|
|
||||||
"windows/arm",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} {
|
|
||||||
testcase := tc
|
|
||||||
t.Run(testcase.platform, func(t *testing.T) {
|
|
||||||
p, err := Parse(testcase.platform)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
m := Only(p)
|
|
||||||
for shouldMatch, platforms := range testcase.matches {
|
|
||||||
for _, matchPlatform := range platforms {
|
|
||||||
mp, err := Parse(matchPlatform)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
if match := m.Match(mp); shouldMatch != match {
|
|
||||||
t.Errorf("Only(%q).Match(%q) should return %v, but returns %v", testcase.platform, matchPlatform, shouldMatch, match)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestOnlyStrict(t *testing.T) {
|
|
||||||
for _, tc := range []struct {
|
|
||||||
platform string
|
|
||||||
matches map[bool][]string
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
platform: "linux/amd64",
|
|
||||||
matches: map[bool][]string{
|
|
||||||
true: {
|
|
||||||
"linux/amd64",
|
|
||||||
},
|
|
||||||
false: {
|
|
||||||
"linux/386",
|
|
||||||
"linux/arm/v7",
|
|
||||||
"linux/arm64",
|
|
||||||
"windows/amd64",
|
|
||||||
"windows/arm",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: "linux/386",
|
|
||||||
matches: map[bool][]string{
|
|
||||||
true: {
|
|
||||||
"linux/386",
|
|
||||||
},
|
|
||||||
false: {
|
|
||||||
"linux/amd64",
|
|
||||||
"linux/arm/v7",
|
|
||||||
"linux/arm64",
|
|
||||||
"windows/amd64",
|
|
||||||
"windows/arm",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: "windows/amd64",
|
|
||||||
matches: map[bool][]string{
|
|
||||||
true: {"windows/amd64"},
|
|
||||||
false: {
|
|
||||||
"linux/amd64",
|
|
||||||
"linux/arm/v7",
|
|
||||||
"linux/arm64",
|
|
||||||
"windows/arm",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: "linux/arm/v8",
|
|
||||||
matches: map[bool][]string{
|
|
||||||
true: {
|
|
||||||
"linux/arm/v8",
|
|
||||||
},
|
|
||||||
false: {
|
|
||||||
"linux/arm",
|
|
||||||
"linux/arm/v5",
|
|
||||||
"linux/arm/v6",
|
|
||||||
"linux/arm/v7",
|
|
||||||
"linux/amd64",
|
|
||||||
"linux/arm/v4",
|
|
||||||
"linux/arm64",
|
|
||||||
"windows/amd64",
|
|
||||||
"windows/arm",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: "linux/arm/v7",
|
|
||||||
matches: map[bool][]string{
|
|
||||||
true: {
|
|
||||||
"linux/arm",
|
|
||||||
"linux/arm/v7",
|
|
||||||
},
|
|
||||||
false: {
|
|
||||||
"linux/arm/v5",
|
|
||||||
"linux/arm/v6",
|
|
||||||
"linux/amd64",
|
|
||||||
"linux/arm/v4",
|
|
||||||
"linux/arm/v8",
|
|
||||||
"linux/arm64",
|
|
||||||
"windows/amd64",
|
|
||||||
"windows/arm",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: "linux/arm/v6",
|
|
||||||
matches: map[bool][]string{
|
|
||||||
true: {
|
|
||||||
"linux/arm/v6",
|
|
||||||
},
|
|
||||||
false: {
|
|
||||||
"linux/arm/v5",
|
|
||||||
"linux/amd64",
|
|
||||||
"linux/arm",
|
|
||||||
"linux/arm/v4",
|
|
||||||
"linux/arm/v7",
|
|
||||||
"linux/arm/v8",
|
|
||||||
"linux/arm64",
|
|
||||||
"windows/amd64",
|
|
||||||
"windows/arm",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: "linux/arm/v5",
|
|
||||||
matches: map[bool][]string{
|
|
||||||
true: {
|
|
||||||
"linux/arm/v5",
|
|
||||||
},
|
|
||||||
false: {
|
|
||||||
"linux/amd64",
|
|
||||||
"linux/arm",
|
|
||||||
"linux/arm/v4",
|
|
||||||
"linux/arm/v6",
|
|
||||||
"linux/arm/v7",
|
|
||||||
"linux/arm/v8",
|
|
||||||
"linux/arm64",
|
|
||||||
"windows/amd64",
|
|
||||||
"windows/arm",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: "linux/arm/v4",
|
|
||||||
matches: map[bool][]string{
|
|
||||||
true: {
|
|
||||||
"linux/arm/v4",
|
|
||||||
},
|
|
||||||
false: {
|
|
||||||
"linux/amd64",
|
|
||||||
"linux/arm",
|
|
||||||
"linux/arm/v5",
|
|
||||||
"linux/arm/v6",
|
|
||||||
"linux/arm/v7",
|
|
||||||
"linux/arm/v8",
|
|
||||||
"linux/arm64",
|
|
||||||
"windows/amd64",
|
|
||||||
"windows/arm",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: "linux/arm64",
|
|
||||||
matches: map[bool][]string{
|
|
||||||
true: {
|
|
||||||
"linux/arm64",
|
|
||||||
"linux/arm64/v8",
|
|
||||||
},
|
|
||||||
false: {
|
|
||||||
"linux/arm",
|
|
||||||
"linux/arm/v5",
|
|
||||||
"linux/arm/v6",
|
|
||||||
"linux/arm/v7",
|
|
||||||
"linux/arm/v8",
|
|
||||||
"linux/amd64",
|
|
||||||
"linux/arm/v4",
|
|
||||||
"linux/arm/v9",
|
|
||||||
"linux/arm64/v9",
|
|
||||||
"windows/amd64",
|
|
||||||
"windows/arm",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} {
|
|
||||||
testcase := tc
|
|
||||||
t.Run(testcase.platform, func(t *testing.T) {
|
|
||||||
p, err := Parse(testcase.platform)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
m := OnlyStrict(p)
|
|
||||||
for shouldMatch, platforms := range testcase.matches {
|
|
||||||
for _, matchPlatform := range platforms {
|
|
||||||
mp, err := Parse(matchPlatform)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
if match := m.Match(mp); shouldMatch != match {
|
|
||||||
t.Errorf("OnlyStrict(%q).Match(%q) should return %v, but returns %v", testcase.platform, matchPlatform, shouldMatch, match)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,139 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright The containerd Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package platforms
|
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
"runtime"
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestCPUVariant(t *testing.T) {
|
|
||||||
if !isArmArch(runtime.GOARCH) {
|
|
||||||
t.Skip("only relevant on linux/arm")
|
|
||||||
}
|
|
||||||
|
|
||||||
variants := []string{"v8", "v7", "v6", "v5", "v4", "v3"}
|
|
||||||
|
|
||||||
p, err := getCPUVariant()
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("Error getting CPU variant: %v", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, variant := range variants {
|
|
||||||
if p == variant {
|
|
||||||
t.Logf("got valid variant as expected: %#v = %#v", p, variant)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
t.Fatalf("could not get valid variant as expected: %v", variants)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestGetCPUVariantFromArch(t *testing.T) {
|
|
||||||
|
|
||||||
for _, testcase := range []struct {
|
|
||||||
name string
|
|
||||||
input string
|
|
||||||
output string
|
|
||||||
expectedErr error
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
name: "Test aarch64",
|
|
||||||
input: "aarch64",
|
|
||||||
output: "8",
|
|
||||||
expectedErr: nil,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Test Armv8 with capital",
|
|
||||||
input: "Armv8",
|
|
||||||
output: "8",
|
|
||||||
expectedErr: nil,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Test armv7",
|
|
||||||
input: "armv7",
|
|
||||||
output: "7",
|
|
||||||
expectedErr: nil,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Test armv6",
|
|
||||||
input: "armv6",
|
|
||||||
output: "6",
|
|
||||||
expectedErr: nil,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Test armv5",
|
|
||||||
input: "armv5",
|
|
||||||
output: "5",
|
|
||||||
expectedErr: nil,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Test armv4",
|
|
||||||
input: "armv4",
|
|
||||||
output: "4",
|
|
||||||
expectedErr: nil,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Test armv3",
|
|
||||||
input: "armv3",
|
|
||||||
output: "3",
|
|
||||||
expectedErr: nil,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Test unknown input",
|
|
||||||
input: "armv9",
|
|
||||||
output: "unknown",
|
|
||||||
expectedErr: nil,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Test invalid input which doesn't start with armv",
|
|
||||||
input: "armxxxx",
|
|
||||||
output: "",
|
|
||||||
expectedErr: errInvalidArgument,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Test invalid input whose length is less than 5",
|
|
||||||
input: "armv",
|
|
||||||
output: "",
|
|
||||||
expectedErr: errInvalidArgument,
|
|
||||||
},
|
|
||||||
} {
|
|
||||||
t.Run(testcase.name, func(t *testing.T) {
|
|
||||||
t.Logf("input: %v", testcase.input)
|
|
||||||
|
|
||||||
variant, err := getCPUVariantFromArch(testcase.input)
|
|
||||||
|
|
||||||
if err == nil {
|
|
||||||
if testcase.expectedErr != nil {
|
|
||||||
t.Fatalf("Expect to get error: %v, however no error got", testcase.expectedErr)
|
|
||||||
} else {
|
|
||||||
if variant != testcase.output {
|
|
||||||
t.Fatalf("Expect to get variant: %v, however %v returned", testcase.output, variant)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if !errors.Is(err, testcase.expectedErr) {
|
|
||||||
t.Fatalf("Expect to get error: %v, however error %v returned", testcase.expectedErr, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
//go:build !windows
|
|
||||||
|
|
||||||
/*
|
|
||||||
Copyright The containerd Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package platforms
|
|
||||||
|
|
||||||
import (
|
|
||||||
"reflect"
|
|
||||||
"runtime"
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestDefault(t *testing.T) {
|
|
||||||
expected := specs.Platform{
|
|
||||||
OS: runtime.GOOS,
|
|
||||||
Architecture: runtime.GOARCH,
|
|
||||||
Variant: cpuVariant(),
|
|
||||||
}
|
|
||||||
p := DefaultSpec()
|
|
||||||
if !reflect.DeepEqual(p, expected) {
|
|
||||||
t.Fatalf("default platform not as expected: %#v != %#v", p, expected)
|
|
||||||
}
|
|
||||||
|
|
||||||
s := DefaultString()
|
|
||||||
if s != Format(p) {
|
|
||||||
t.Fatalf("default specifier should match formatted default spec: %v != %v", s, p)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,374 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright The containerd Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package platforms
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"reflect"
|
|
||||||
"runtime"
|
|
||||||
"sort"
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
imagespec "github.com/opencontainers/image-spec/specs-go/v1"
|
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
"golang.org/x/sys/windows"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestDefault(t *testing.T) {
|
|
||||||
major, minor, build := windows.RtlGetNtVersionNumbers()
|
|
||||||
expected := imagespec.Platform{
|
|
||||||
OS: runtime.GOOS,
|
|
||||||
Architecture: runtime.GOARCH,
|
|
||||||
OSVersion: fmt.Sprintf("%d.%d.%d", major, minor, build),
|
|
||||||
Variant: cpuVariant(),
|
|
||||||
}
|
|
||||||
p := DefaultSpec()
|
|
||||||
if !reflect.DeepEqual(p, expected) {
|
|
||||||
t.Fatalf("default platform not as expected: %#v != %#v", p, expected)
|
|
||||||
}
|
|
||||||
|
|
||||||
s := DefaultString()
|
|
||||||
if s != Format(p) {
|
|
||||||
t.Fatalf("default specifier should match formatted default spec: %v != %v", s, p)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestDefaultMatchComparer(t *testing.T) {
|
|
||||||
defaultMatcher := Default()
|
|
||||||
|
|
||||||
for _, test := range []struct {
|
|
||||||
platform imagespec.Platform
|
|
||||||
match bool
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
platform: DefaultSpec(),
|
|
||||||
match: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: imagespec.Platform{
|
|
||||||
OS: "linux",
|
|
||||||
Architecture: runtime.GOARCH,
|
|
||||||
},
|
|
||||||
match: false,
|
|
||||||
},
|
|
||||||
} {
|
|
||||||
assert.Equal(t, test.match, defaultMatcher.Match(test.platform))
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMatchComparerMatch_WCOW(t *testing.T) {
|
|
||||||
major, minor, build := windows.RtlGetNtVersionNumbers()
|
|
||||||
buildStr := fmt.Sprintf("%d.%d.%d", major, minor, build)
|
|
||||||
m := windowsmatcher{
|
|
||||||
Platform: DefaultSpec(),
|
|
||||||
osVersionPrefix: buildStr,
|
|
||||||
defaultMatcher: &matcher{
|
|
||||||
Platform: Normalize(DefaultSpec()),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
for _, test := range []struct {
|
|
||||||
platform imagespec.Platform
|
|
||||||
match bool
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
platform: DefaultSpec(),
|
|
||||||
match: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: imagespec.Platform{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
OSVersion: buildStr + ".1",
|
|
||||||
},
|
|
||||||
match: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: imagespec.Platform{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
OSVersion: buildStr + ".2",
|
|
||||||
},
|
|
||||||
match: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: imagespec.Platform{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
// Use an nonexistent Windows build so we don't get a match. Ws2019's build is 17763/
|
|
||||||
OSVersion: "10.0.17762.1",
|
|
||||||
},
|
|
||||||
match: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: imagespec.Platform{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
// Use an nonexistent Windows build so we don't get a match. Ws2019's build is 17763/
|
|
||||||
OSVersion: "10.0.17764.1",
|
|
||||||
},
|
|
||||||
match: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: imagespec.Platform{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
},
|
|
||||||
match: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: imagespec.Platform{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "linux",
|
|
||||||
},
|
|
||||||
match: false,
|
|
||||||
},
|
|
||||||
} {
|
|
||||||
assert.Equal(t, test.match, m.Match(test.platform), "should match: %t, %s to %s", test.match, m.Platform, test.platform)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TestMatchComparerMatch_ABICheckWCOW checks windows platform matcher
|
|
||||||
// behavior for stable ABI and non-stable ABI compliant versions
|
|
||||||
func TestMatchComparerMatch_ABICheckWCOW(t *testing.T) {
|
|
||||||
platformWS2019 := imagespec.Platform{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
OSVersion: "10.0.17763",
|
|
||||||
}
|
|
||||||
platformWS2022 := imagespec.Platform{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
OSVersion: "10.0.20348",
|
|
||||||
}
|
|
||||||
platformWindows11 := imagespec.Platform{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
OSVersion: "10.0.22621",
|
|
||||||
}
|
|
||||||
matcherWS2019 := windowsmatcher{
|
|
||||||
Platform: platformWS2019,
|
|
||||||
osVersionPrefix: platformWS2019.OSVersion,
|
|
||||||
defaultMatcher: &matcher{
|
|
||||||
Platform: Normalize(platformWS2019),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
matcherWS2022 := windowsmatcher{
|
|
||||||
Platform: platformWS2022,
|
|
||||||
osVersionPrefix: platformWS2022.OSVersion,
|
|
||||||
defaultMatcher: &matcher{
|
|
||||||
Platform: Normalize(platformWS2022),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
matcherWindows11 := windowsmatcher{
|
|
||||||
Platform: platformWindows11,
|
|
||||||
osVersionPrefix: platformWindows11.OSVersion,
|
|
||||||
defaultMatcher: &matcher{
|
|
||||||
Platform: Normalize(platformWindows11),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, test := range []struct {
|
|
||||||
hostPlatformMatcher windowsmatcher
|
|
||||||
testPlatform imagespec.Platform
|
|
||||||
match bool
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
hostPlatformMatcher: matcherWS2019,
|
|
||||||
testPlatform: imagespec.Platform{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
OSVersion: "10.0.17763",
|
|
||||||
},
|
|
||||||
match: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
hostPlatformMatcher: matcherWS2019,
|
|
||||||
testPlatform: imagespec.Platform{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
OSVersion: "10.0.20348",
|
|
||||||
},
|
|
||||||
match: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
hostPlatformMatcher: matcherWS2022,
|
|
||||||
testPlatform: imagespec.Platform{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
OSVersion: "10.0.17763",
|
|
||||||
},
|
|
||||||
match: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
hostPlatformMatcher: matcherWS2022,
|
|
||||||
testPlatform: imagespec.Platform{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
OSVersion: "10.0.20348",
|
|
||||||
},
|
|
||||||
match: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
hostPlatformMatcher: matcherWindows11,
|
|
||||||
testPlatform: imagespec.Platform{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
OSVersion: "10.0.17763",
|
|
||||||
},
|
|
||||||
match: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
hostPlatformMatcher: matcherWindows11,
|
|
||||||
testPlatform: imagespec.Platform{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
OSVersion: "10.0.20348",
|
|
||||||
},
|
|
||||||
match: true,
|
|
||||||
},
|
|
||||||
} {
|
|
||||||
assert.Equal(t, test.match, test.hostPlatformMatcher.Match(test.testPlatform), "should match: %t, %s to %s", test.match, test.hostPlatformMatcher.Platform, test.testPlatform)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMatchComparerMatch_LCOW(t *testing.T) {
|
|
||||||
major, minor, build := windows.RtlGetNtVersionNumbers()
|
|
||||||
buildStr := fmt.Sprintf("%d.%d.%d", major, minor, build)
|
|
||||||
m := windowsmatcher{
|
|
||||||
Platform: imagespec.Platform{
|
|
||||||
OS: "linux",
|
|
||||||
Architecture: "amd64",
|
|
||||||
},
|
|
||||||
osVersionPrefix: "",
|
|
||||||
defaultMatcher: &matcher{
|
|
||||||
Platform: Normalize(imagespec.Platform{
|
|
||||||
OS: "linux",
|
|
||||||
Architecture: "amd64",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
for _, test := range []struct {
|
|
||||||
platform imagespec.Platform
|
|
||||||
match bool
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
platform: DefaultSpec(),
|
|
||||||
match: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: imagespec.Platform{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
},
|
|
||||||
match: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: imagespec.Platform{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
OSVersion: buildStr + ".2",
|
|
||||||
},
|
|
||||||
match: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: imagespec.Platform{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
// Use an nonexistent Windows build so we don't get a match. Ws2019's build is 17763/
|
|
||||||
OSVersion: "10.0.17762.1",
|
|
||||||
},
|
|
||||||
match: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
platform: imagespec.Platform{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "linux",
|
|
||||||
},
|
|
||||||
match: true,
|
|
||||||
},
|
|
||||||
} {
|
|
||||||
assert.Equal(t, test.match, m.Match(test.platform), "should match %b, %s to %s", test.match, m.Platform, test.platform)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMatchComparerLess(t *testing.T) {
|
|
||||||
m := windowsmatcher{
|
|
||||||
Platform: DefaultSpec(),
|
|
||||||
osVersionPrefix: "10.0.17763",
|
|
||||||
defaultMatcher: &matcher{
|
|
||||||
Platform: Normalize(DefaultSpec()),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
platforms := []imagespec.Platform{
|
|
||||||
{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
OSVersion: "10.0.17764.1",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
OSVersion: "10.0.17763.1",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
OSVersion: "10.0.17763.2",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
OSVersion: "10.0.17762.1",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
expected := []imagespec.Platform{
|
|
||||||
{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
OSVersion: "10.0.17763.2",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
OSVersion: "10.0.17763.1",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
OSVersion: "10.0.17764.1",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Architecture: "amd64",
|
|
||||||
OS: "windows",
|
|
||||||
OSVersion: "10.0.17762.1",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
sort.SliceStable(platforms, func(i, j int) bool {
|
|
||||||
return m.Less(platforms[i], platforms[j])
|
|
||||||
})
|
|
||||||
assert.Equal(t, expected, platforms)
|
|
||||||
}
|
|
@ -1,376 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright The containerd Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package platforms
|
|
||||||
|
|
||||||
import (
|
|
||||||
"path"
|
|
||||||
"reflect"
|
|
||||||
"runtime"
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestParseSelector(t *testing.T) {
|
|
||||||
var (
|
|
||||||
defaultOS = runtime.GOOS
|
|
||||||
defaultArch = runtime.GOARCH
|
|
||||||
defaultVariant = ""
|
|
||||||
)
|
|
||||||
|
|
||||||
if defaultArch == "arm" && cpuVariant() != "v7" {
|
|
||||||
defaultVariant = cpuVariant()
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, testcase := range []struct {
|
|
||||||
skip bool
|
|
||||||
input string
|
|
||||||
expected specs.Platform
|
|
||||||
matches []specs.Platform
|
|
||||||
formatted string
|
|
||||||
}{
|
|
||||||
// While wildcards are a valid use case for platform selection,
|
|
||||||
// addressing these cases is outside the initial scope for this
|
|
||||||
// package. When we do add platform wildcards, we should add in these
|
|
||||||
// testcases to ensure that they are correctly represented.
|
|
||||||
{
|
|
||||||
skip: true,
|
|
||||||
input: "*",
|
|
||||||
expected: specs.Platform{
|
|
||||||
OS: "*",
|
|
||||||
Architecture: "*",
|
|
||||||
},
|
|
||||||
formatted: "*/*",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
skip: true,
|
|
||||||
input: "linux/*",
|
|
||||||
expected: specs.Platform{
|
|
||||||
OS: "linux",
|
|
||||||
Architecture: "*",
|
|
||||||
},
|
|
||||||
formatted: "linux/*",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
skip: true,
|
|
||||||
input: "*/arm64",
|
|
||||||
expected: specs.Platform{
|
|
||||||
OS: "*",
|
|
||||||
Architecture: "arm64",
|
|
||||||
},
|
|
||||||
matches: []specs.Platform{
|
|
||||||
{
|
|
||||||
OS: "*",
|
|
||||||
Architecture: "aarch64",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
OS: "*",
|
|
||||||
Architecture: "aarch64",
|
|
||||||
Variant: "v8",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
OS: "*",
|
|
||||||
Architecture: "arm64",
|
|
||||||
Variant: "v8",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
formatted: "*/arm64",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input: "linux/arm64",
|
|
||||||
expected: specs.Platform{
|
|
||||||
OS: "linux",
|
|
||||||
Architecture: "arm64",
|
|
||||||
},
|
|
||||||
matches: []specs.Platform{
|
|
||||||
{
|
|
||||||
OS: "linux",
|
|
||||||
Architecture: "aarch64",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
OS: "linux",
|
|
||||||
Architecture: "aarch64",
|
|
||||||
Variant: "v8",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
OS: "linux",
|
|
||||||
Architecture: "arm64",
|
|
||||||
Variant: "v8",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
formatted: "linux/arm64",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input: "linux/arm64/v8",
|
|
||||||
expected: specs.Platform{
|
|
||||||
OS: "linux",
|
|
||||||
Architecture: "arm64",
|
|
||||||
Variant: "v8",
|
|
||||||
},
|
|
||||||
matches: []specs.Platform{
|
|
||||||
{
|
|
||||||
OS: "linux",
|
|
||||||
Architecture: "aarch64",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
OS: "linux",
|
|
||||||
Architecture: "aarch64",
|
|
||||||
Variant: "v8",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
OS: "linux",
|
|
||||||
Architecture: "arm64",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
formatted: "linux/arm64/v8",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
// NOTE(stevvooe): In this case, the consumer can assume this is v7
|
|
||||||
// but we leave the variant blank. This will represent the vast
|
|
||||||
// majority of arm images.
|
|
||||||
input: "linux/arm",
|
|
||||||
expected: specs.Platform{
|
|
||||||
OS: "linux",
|
|
||||||
Architecture: "arm",
|
|
||||||
},
|
|
||||||
matches: []specs.Platform{
|
|
||||||
{
|
|
||||||
OS: "linux",
|
|
||||||
Architecture: "arm",
|
|
||||||
Variant: "v7",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
OS: "linux",
|
|
||||||
Architecture: "armhf",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
OS: "linux",
|
|
||||||
Architecture: "arm",
|
|
||||||
Variant: "7",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
formatted: "linux/arm",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input: "linux/arm/v6",
|
|
||||||
expected: specs.Platform{
|
|
||||||
OS: "linux",
|
|
||||||
Architecture: "arm",
|
|
||||||
Variant: "v6",
|
|
||||||
},
|
|
||||||
matches: []specs.Platform{
|
|
||||||
{
|
|
||||||
OS: "linux",
|
|
||||||
Architecture: "armel",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
formatted: "linux/arm/v6",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input: "linux/arm/v7",
|
|
||||||
expected: specs.Platform{
|
|
||||||
OS: "linux",
|
|
||||||
Architecture: "arm",
|
|
||||||
Variant: "v7",
|
|
||||||
},
|
|
||||||
matches: []specs.Platform{
|
|
||||||
{
|
|
||||||
OS: "linux",
|
|
||||||
Architecture: "arm",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
OS: "linux",
|
|
||||||
Architecture: "armhf",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
formatted: "linux/arm/v7",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input: "arm",
|
|
||||||
expected: specs.Platform{
|
|
||||||
OS: defaultOS,
|
|
||||||
Architecture: "arm",
|
|
||||||
},
|
|
||||||
formatted: path.Join(defaultOS, "arm"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input: "armel",
|
|
||||||
expected: specs.Platform{
|
|
||||||
OS: defaultOS,
|
|
||||||
Architecture: "arm",
|
|
||||||
Variant: "v6",
|
|
||||||
},
|
|
||||||
formatted: path.Join(defaultOS, "arm/v6"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input: "armhf",
|
|
||||||
expected: specs.Platform{
|
|
||||||
OS: defaultOS,
|
|
||||||
Architecture: "arm",
|
|
||||||
},
|
|
||||||
formatted: path.Join(defaultOS, "arm"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input: "Aarch64",
|
|
||||||
expected: specs.Platform{
|
|
||||||
OS: defaultOS,
|
|
||||||
Architecture: "arm64",
|
|
||||||
},
|
|
||||||
formatted: path.Join(defaultOS, "arm64"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input: "x86_64",
|
|
||||||
expected: specs.Platform{
|
|
||||||
OS: defaultOS,
|
|
||||||
Architecture: "amd64",
|
|
||||||
},
|
|
||||||
formatted: path.Join(defaultOS, "amd64"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input: "Linux/x86_64",
|
|
||||||
expected: specs.Platform{
|
|
||||||
OS: "linux",
|
|
||||||
Architecture: "amd64",
|
|
||||||
},
|
|
||||||
formatted: "linux/amd64",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input: "i386",
|
|
||||||
expected: specs.Platform{
|
|
||||||
OS: defaultOS,
|
|
||||||
Architecture: "386",
|
|
||||||
},
|
|
||||||
formatted: path.Join(defaultOS, "386"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input: "linux",
|
|
||||||
expected: specs.Platform{
|
|
||||||
OS: "linux",
|
|
||||||
Architecture: defaultArch,
|
|
||||||
Variant: defaultVariant,
|
|
||||||
},
|
|
||||||
formatted: path.Join("linux", defaultArch, defaultVariant),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input: "s390x",
|
|
||||||
expected: specs.Platform{
|
|
||||||
OS: defaultOS,
|
|
||||||
Architecture: "s390x",
|
|
||||||
},
|
|
||||||
formatted: path.Join(defaultOS, "s390x"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input: "linux/s390x",
|
|
||||||
expected: specs.Platform{
|
|
||||||
OS: "linux",
|
|
||||||
Architecture: "s390x",
|
|
||||||
},
|
|
||||||
formatted: "linux/s390x",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input: "macOS",
|
|
||||||
expected: specs.Platform{
|
|
||||||
OS: "darwin",
|
|
||||||
Architecture: defaultArch,
|
|
||||||
Variant: defaultVariant,
|
|
||||||
},
|
|
||||||
formatted: path.Join("darwin", defaultArch, defaultVariant),
|
|
||||||
},
|
|
||||||
} {
|
|
||||||
t.Run(testcase.input, func(t *testing.T) {
|
|
||||||
if testcase.skip {
|
|
||||||
t.Skip("this case is not yet supported")
|
|
||||||
}
|
|
||||||
p, err := Parse(testcase.input)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(p, testcase.expected) {
|
|
||||||
t.Fatalf("platform did not match expected: %#v != %#v", p, testcase.expected)
|
|
||||||
}
|
|
||||||
|
|
||||||
m := NewMatcher(p)
|
|
||||||
|
|
||||||
// ensure that match works on the input to the output.
|
|
||||||
if ok := m.Match(testcase.expected); !ok {
|
|
||||||
t.Fatalf("expected specifier %q matches %#v", testcase.input, testcase.expected)
|
|
||||||
}
|
|
||||||
for _, mc := range testcase.matches {
|
|
||||||
if ok := m.Match(mc); !ok {
|
|
||||||
t.Fatalf("expected specifier %q matches %#v", testcase.input, mc)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
formatted := Format(p)
|
|
||||||
if formatted != testcase.formatted {
|
|
||||||
t.Fatalf("unexpected format: %q != %q", formatted, testcase.formatted)
|
|
||||||
}
|
|
||||||
|
|
||||||
// re-parse the formatted output and ensure we are stable
|
|
||||||
reparsed, err := Parse(formatted)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("error parsing formatted output: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if Format(reparsed) != formatted {
|
|
||||||
t.Fatalf("normalized output did not survive the round trip: %v != %v", Format(reparsed), formatted)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestParseSelectorInvalid(t *testing.T) {
|
|
||||||
for _, testcase := range []struct {
|
|
||||||
input string
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
input: "", // empty
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input: "/linux/arm", // leading slash
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input: "linux/arm/", // trailing slash
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input: "linux /arm", // spaces
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input: "linux/&arm", // invalid character
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input: "linux/arm/foo/bar", // too many components
|
|
||||||
},
|
|
||||||
} {
|
|
||||||
t.Run(testcase.input, func(t *testing.T) {
|
|
||||||
if _, err := Parse(testcase.input); err == nil {
|
|
||||||
t.Fatalf("should have received an error")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func FuzzPlatformsParse(f *testing.F) {
|
|
||||||
f.Add("linux/amd64")
|
|
||||||
f.Fuzz(func(t *testing.T, s string) {
|
|
||||||
pf, err := Parse(s)
|
|
||||||
if err != nil && (pf.OS != "" || pf.Architecture != "") {
|
|
||||||
t.Errorf("either %+v or %+v must be nil", err, pf)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright The containerd Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package platforms
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestNormalize(t *testing.T) {
|
|
||||||
require.Equal(t, DefaultSpec(), Normalize(DefaultSpec()))
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestFallbackOnOSVersion(t *testing.T) {
|
|
||||||
p := specs.Platform{
|
|
||||||
OS: "windows",
|
|
||||||
Architecture: "amd64",
|
|
||||||
OSVersion: "99.99.99.99",
|
|
||||||
}
|
|
||||||
|
|
||||||
other := specs.Platform{OS: p.OS, Architecture: p.Architecture}
|
|
||||||
|
|
||||||
m := NewMatcher(p)
|
|
||||||
require.True(t, m.Match(other))
|
|
||||||
}
|
|
@ -29,9 +29,9 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/pkg/cri/constants"
|
"github.com/containerd/containerd/v2/pkg/cri/constants"
|
||||||
"github.com/containerd/containerd/v2/pkg/cri/server/images"
|
"github.com/containerd/containerd/v2/pkg/cri/server/images"
|
||||||
"github.com/containerd/containerd/v2/pkg/events"
|
"github.com/containerd/containerd/v2/pkg/events"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/containerd/v2/plugins"
|
"github.com/containerd/containerd/v2/plugins"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/containerd/plugin"
|
"github.com/containerd/plugin"
|
||||||
"github.com/containerd/plugin/registry"
|
"github.com/containerd/plugin/registry"
|
||||||
)
|
)
|
||||||
|
@ -20,9 +20,9 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/core/diff"
|
"github.com/containerd/containerd/v2/core/diff"
|
||||||
"github.com/containerd/containerd/v2/core/diff/apply"
|
"github.com/containerd/containerd/v2/core/diff/apply"
|
||||||
"github.com/containerd/containerd/v2/core/metadata"
|
"github.com/containerd/containerd/v2/core/metadata"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/containerd/v2/plugins"
|
"github.com/containerd/containerd/v2/plugins"
|
||||||
"github.com/containerd/containerd/v2/plugins/diff/walking"
|
"github.com/containerd/containerd/v2/plugins/diff/walking"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/containerd/plugin"
|
"github.com/containerd/plugin"
|
||||||
"github.com/containerd/plugin/registry"
|
"github.com/containerd/plugin/registry"
|
||||||
)
|
)
|
||||||
|
@ -30,8 +30,8 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/core/mount"
|
"github.com/containerd/containerd/v2/core/mount"
|
||||||
"github.com/containerd/containerd/v2/pkg/archive"
|
"github.com/containerd/containerd/v2/pkg/archive"
|
||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/containerd/v2/plugins"
|
"github.com/containerd/containerd/v2/plugins"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/containerd/plugin"
|
"github.com/containerd/plugin"
|
||||||
"github.com/containerd/plugin/registry"
|
"github.com/containerd/plugin/registry"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
|
@ -37,9 +37,9 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/pkg/epoch"
|
"github.com/containerd/containerd/v2/pkg/epoch"
|
||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/pkg/labels"
|
"github.com/containerd/containerd/v2/pkg/labels"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/containerd/v2/plugins"
|
"github.com/containerd/containerd/v2/plugins"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/containerd/plugin"
|
"github.com/containerd/plugin"
|
||||||
"github.com/containerd/plugin/registry"
|
"github.com/containerd/plugin/registry"
|
||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
|
@ -30,9 +30,9 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/pkg/events"
|
"github.com/containerd/containerd/v2/pkg/events"
|
||||||
"github.com/containerd/containerd/v2/pkg/events/exchange"
|
"github.com/containerd/containerd/v2/pkg/events/exchange"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/containerd/v2/plugins"
|
"github.com/containerd/containerd/v2/plugins"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/containerd/plugin"
|
"github.com/containerd/plugin"
|
||||||
"github.com/containerd/plugin/registry"
|
"github.com/containerd/plugin/registry"
|
||||||
|
|
||||||
|
@ -19,9 +19,9 @@ package plugin
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/containerd/v2/plugins"
|
"github.com/containerd/containerd/v2/plugins"
|
||||||
"github.com/containerd/containerd/v2/plugins/snapshots/blockfile"
|
"github.com/containerd/containerd/v2/plugins/snapshots/blockfile"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/containerd/plugin"
|
"github.com/containerd/plugin"
|
||||||
"github.com/containerd/plugin/registry"
|
"github.com/containerd/plugin/registry"
|
||||||
)
|
)
|
||||||
|
@ -23,9 +23,9 @@ import (
|
|||||||
|
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
|
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/containerd/v2/plugins"
|
"github.com/containerd/containerd/v2/plugins"
|
||||||
"github.com/containerd/containerd/v2/plugins/snapshots/btrfs"
|
"github.com/containerd/containerd/v2/plugins/snapshots/btrfs"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/containerd/plugin"
|
"github.com/containerd/plugin"
|
||||||
"github.com/containerd/plugin/registry"
|
"github.com/containerd/plugin/registry"
|
||||||
)
|
)
|
||||||
|
@ -22,9 +22,9 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/containerd/v2/plugins"
|
"github.com/containerd/containerd/v2/plugins"
|
||||||
"github.com/containerd/containerd/v2/plugins/snapshots/devmapper"
|
"github.com/containerd/containerd/v2/plugins/snapshots/devmapper"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/containerd/plugin"
|
"github.com/containerd/plugin"
|
||||||
"github.com/containerd/plugin/registry"
|
"github.com/containerd/plugin/registry"
|
||||||
)
|
)
|
||||||
|
@ -19,9 +19,9 @@ package plugin
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/containerd/v2/plugins"
|
"github.com/containerd/containerd/v2/plugins"
|
||||||
"github.com/containerd/containerd/v2/plugins/snapshots/native"
|
"github.com/containerd/containerd/v2/plugins/snapshots/native"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/containerd/plugin"
|
"github.com/containerd/plugin"
|
||||||
"github.com/containerd/plugin/registry"
|
"github.com/containerd/plugin/registry"
|
||||||
)
|
)
|
||||||
|
@ -21,10 +21,10 @@ package overlay
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/containerd/v2/plugins"
|
"github.com/containerd/containerd/v2/plugins"
|
||||||
"github.com/containerd/containerd/v2/plugins/snapshots/overlay"
|
"github.com/containerd/containerd/v2/plugins/snapshots/overlay"
|
||||||
"github.com/containerd/containerd/v2/plugins/snapshots/overlay/overlayutils"
|
"github.com/containerd/containerd/v2/plugins/snapshots/overlay/overlayutils"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/containerd/plugin"
|
"github.com/containerd/plugin"
|
||||||
"github.com/containerd/plugin/registry"
|
"github.com/containerd/plugin/registry"
|
||||||
)
|
)
|
||||||
|
@ -33,9 +33,9 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/core/snapshots"
|
"github.com/containerd/containerd/v2/core/snapshots"
|
||||||
"github.com/containerd/containerd/v2/core/snapshots/storage"
|
"github.com/containerd/containerd/v2/core/snapshots/storage"
|
||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/containerd/v2/plugins"
|
"github.com/containerd/containerd/v2/plugins"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/containerd/plugin"
|
"github.com/containerd/plugin"
|
||||||
"github.com/containerd/plugin/registry"
|
"github.com/containerd/plugin/registry"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
|
@ -33,10 +33,10 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/core/snapshots"
|
"github.com/containerd/containerd/v2/core/snapshots"
|
||||||
"github.com/containerd/containerd/v2/core/snapshots/storage"
|
"github.com/containerd/containerd/v2/core/snapshots/storage"
|
||||||
"github.com/containerd/containerd/v2/pkg/errdefs"
|
"github.com/containerd/containerd/v2/pkg/errdefs"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/containerd/v2/plugins"
|
"github.com/containerd/containerd/v2/plugins"
|
||||||
"github.com/containerd/continuity/fs"
|
"github.com/containerd/continuity/fs"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/containerd/plugin"
|
"github.com/containerd/plugin"
|
||||||
"github.com/containerd/plugin/registry"
|
"github.com/containerd/plugin/registry"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
|
@ -27,9 +27,9 @@ import (
|
|||||||
"github.com/containerd/containerd/v2/pkg/imageverifier"
|
"github.com/containerd/containerd/v2/pkg/imageverifier"
|
||||||
"github.com/containerd/containerd/v2/pkg/transfer/local"
|
"github.com/containerd/containerd/v2/pkg/transfer/local"
|
||||||
"github.com/containerd/containerd/v2/pkg/unpack"
|
"github.com/containerd/containerd/v2/pkg/unpack"
|
||||||
"github.com/containerd/containerd/v2/platforms"
|
|
||||||
"github.com/containerd/containerd/v2/plugins"
|
"github.com/containerd/containerd/v2/plugins"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
"github.com/containerd/platforms"
|
||||||
"github.com/containerd/plugin"
|
"github.com/containerd/plugin"
|
||||||
"github.com/containerd/plugin/registry"
|
"github.com/containerd/plugin/registry"
|
||||||
|
|
||||||
|
1
vendor/github.com/containerd/platforms/.gitattributes
generated
vendored
Normal file
1
vendor/github.com/containerd/platforms/.gitattributes
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*.go text eol=lf
|
30
vendor/github.com/containerd/platforms/.golangci.yml
generated
vendored
Normal file
30
vendor/github.com/containerd/platforms/.golangci.yml
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
linters:
|
||||||
|
enable:
|
||||||
|
- exportloopref # Checks for pointers to enclosing loop variables
|
||||||
|
- gofmt
|
||||||
|
- goimports
|
||||||
|
- gosec
|
||||||
|
- ineffassign
|
||||||
|
- misspell
|
||||||
|
- nolintlint
|
||||||
|
- revive
|
||||||
|
- staticcheck
|
||||||
|
- tenv # Detects using os.Setenv instead of t.Setenv since Go 1.17
|
||||||
|
- unconvert
|
||||||
|
- unused
|
||||||
|
- vet
|
||||||
|
- dupword # Checks for duplicate words in the source code
|
||||||
|
disable:
|
||||||
|
- errcheck
|
||||||
|
|
||||||
|
run:
|
||||||
|
timeout: 5m
|
||||||
|
skip-dirs:
|
||||||
|
- api
|
||||||
|
- cluster
|
||||||
|
- design
|
||||||
|
- docs
|
||||||
|
- docs/man
|
||||||
|
- releases
|
||||||
|
- reports
|
||||||
|
- test # e2e scripts
|
191
vendor/github.com/containerd/platforms/LICENSE
generated
vendored
Normal file
191
vendor/github.com/containerd/platforms/LICENSE
generated
vendored
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
https://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
Copyright The containerd Authors
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
32
vendor/github.com/containerd/platforms/README.md
generated
vendored
Normal file
32
vendor/github.com/containerd/platforms/README.md
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# platforms
|
||||||
|
|
||||||
|
A Go package for formatting, normalizing and matching container platforms.
|
||||||
|
|
||||||
|
This package is based on the Open Containers Image Spec definition of a [platform](https://github.com/opencontainers/image-spec/blob/main/specs-go/v1/descriptor.go#L52).
|
||||||
|
|
||||||
|
## Platform Specifier
|
||||||
|
|
||||||
|
While the OCI platform specifications provide a tool for components to
|
||||||
|
specify structured information, user input typically doesn't need the full
|
||||||
|
context and much can be inferred. To solve this problem, this package introduces
|
||||||
|
"specifiers". A specifier has the format
|
||||||
|
`<os>|<arch>|<os>/<arch>[/<variant>]`. The user can provide either the
|
||||||
|
operating system or the architecture or both.
|
||||||
|
|
||||||
|
An example of a common specifier is `linux/amd64`. If the host has a default
|
||||||
|
runtime that matches this, the user can simply provide the component that
|
||||||
|
matters. For example, if an image provides `amd64` and `arm64` support, the
|
||||||
|
operating system, `linux` can be inferred, so they only have to provide
|
||||||
|
`arm64` or `amd64`. Similar behavior is implemented for operating systems,
|
||||||
|
where the architecture may be known but a runtime may support images from
|
||||||
|
different operating systems.
|
||||||
|
|
||||||
|
## Project details
|
||||||
|
|
||||||
|
**platforms** is a containerd sub-project, licensed under the [Apache 2.0 license](./LICENSE).
|
||||||
|
As a containerd sub-project, you will find the:
|
||||||
|
* [Project governance](https://github.com/containerd/project/blob/main/GOVERNANCE.md),
|
||||||
|
* [Maintainers](https://github.com/containerd/project/blob/main/MAINTAINERS),
|
||||||
|
* and [Contributing guidelines](https://github.com/containerd/project/blob/main/CONTRIBUTING.md)
|
||||||
|
|
||||||
|
information in our [`containerd/project`](https://github.com/containerd/project) repository.
|
0
platforms/compare.go → vendor/github.com/containerd/platforms/compare.go
generated
vendored
0
platforms/compare.go → vendor/github.com/containerd/platforms/compare.go
generated
vendored
0
platforms/cpuinfo.go → vendor/github.com/containerd/platforms/cpuinfo.go
generated
vendored
0
platforms/cpuinfo.go → vendor/github.com/containerd/platforms/cpuinfo.go
generated
vendored
0
platforms/cpuinfo_linux.go → vendor/github.com/containerd/platforms/cpuinfo_linux.go
generated
vendored
0
platforms/cpuinfo_linux.go → vendor/github.com/containerd/platforms/cpuinfo_linux.go
generated
vendored
0
platforms/cpuinfo_other.go → vendor/github.com/containerd/platforms/cpuinfo_other.go
generated
vendored
0
platforms/cpuinfo_other.go → vendor/github.com/containerd/platforms/cpuinfo_other.go
generated
vendored
0
platforms/database.go → vendor/github.com/containerd/platforms/database.go
generated
vendored
0
platforms/database.go → vendor/github.com/containerd/platforms/database.go
generated
vendored
0
platforms/defaults.go → vendor/github.com/containerd/platforms/defaults.go
generated
vendored
0
platforms/defaults.go → vendor/github.com/containerd/platforms/defaults.go
generated
vendored
0
platforms/defaults_unix.go → vendor/github.com/containerd/platforms/defaults_unix.go
generated
vendored
0
platforms/defaults_unix.go → vendor/github.com/containerd/platforms/defaults_unix.go
generated
vendored
0
platforms/errors.go → vendor/github.com/containerd/platforms/errors.go
generated
vendored
0
platforms/errors.go → vendor/github.com/containerd/platforms/errors.go
generated
vendored
0
platforms/platforms.go → vendor/github.com/containerd/platforms/platforms.go
generated
vendored
0
platforms/platforms.go → vendor/github.com/containerd/platforms/platforms.go
generated
vendored
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user