diff --git a/.github/workflows/test-e2e-create-module.yml b/.github/workflows/test-e2e-create-module.yml index ca49f0778..004f05e74 100644 --- a/.github/workflows/test-e2e-create-module.yml +++ b/.github/workflows/test-e2e-create-module.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest env: K3D_VERSION: v5.4.7 - MODULE_TEMPLATE_VERSION: 0.1.0 + MODULE_TEMPLATE_VERSION: 0.1.2 OCI_REPOSITORY_URL: http://k3d-oci.localhost:5001 steps: - name: Checkout Kyma CLI diff --git a/cmd/kyma/alpha/enable/enable.go b/cmd/kyma/alpha/add/add.go similarity index 63% rename from cmd/kyma/alpha/enable/enable.go rename to cmd/kyma/alpha/add/add.go index f70ecf153..5806cc403 100644 --- a/cmd/kyma/alpha/enable/enable.go +++ b/cmd/kyma/alpha/add/add.go @@ -1,15 +1,16 @@ -package enable +package add import ( - "github.com/kyma-project/cli/cmd/kyma/alpha/enable/module" + "github.com/kyma-project/cli/cmd/kyma/alpha/add/module" "github.com/kyma-project/cli/internal/cli" "github.com/spf13/cobra" ) func NewCmd(o *cli.Options) *cobra.Command { cmd := &cobra.Command{ - Use: "enable", - Short: "Enables a resource in the Kyma cluster.", + Use: "add", + Aliases: []string{"enable"}, + Short: "Adds a resource to the Kyma cluster.", Long: `Use this command to enable a resource in the Kyma cluster. `, } diff --git a/cmd/kyma/alpha/enable/module/mock/mock_interactor.go b/cmd/kyma/alpha/add/module/mock/mock_interactor.go similarity index 100% rename from cmd/kyma/alpha/enable/module/mock/mock_interactor.go rename to cmd/kyma/alpha/add/module/mock/mock_interactor.go diff --git a/cmd/kyma/alpha/enable/module/module.go b/cmd/kyma/alpha/add/module/module.go similarity index 95% rename from cmd/kyma/alpha/enable/module/module.go rename to cmd/kyma/alpha/add/module/module.go index 398e52321..022f0ad81 100644 --- a/cmd/kyma/alpha/enable/module/module.go +++ b/cmd/kyma/alpha/add/module/module.go @@ -31,8 +31,8 @@ func NewCmd(o *Options) *cobra.Command { cmd := &cobra.Command{ Use: "module [name] [flags]", - Short: "Enables a module in the cluster or in the given Kyma resource.", - Long: `Use this command to enable Kyma modules available in the cluster. + Short: "Adds a module in the cluster or in the given Kyma resource.", + Long: `Use this command to add Kyma modules available in the cluster. ### Detailed description @@ -43,8 +43,8 @@ A module is available when it is released with a ModuleTemplate. The ModuleTempl `, Example: ` -Enable "my-module" from "alpha" channel in "default-kyma" in "kyma-system" Namespace - kyma alpha enable module my-module -c alpha -n kyma-system -k default-kyma +Add "my-module" from "alpha" channel to "default-kyma" in "kyma-system" Namespace + kyma alpha add module my-module -c alpha -n kyma-system -k default-kyma `, RunE: func(cmd *cobra.Command, args []string) error { return c.Run(cmd.Context(), args) }, Aliases: []string{"mod", "mods", "modules"}, diff --git a/cmd/kyma/alpha/enable/module/module_test.go b/cmd/kyma/alpha/add/module/module_test.go similarity index 97% rename from cmd/kyma/alpha/enable/module/module_test.go rename to cmd/kyma/alpha/add/module/module_test.go index ff6d9ff50..102730563 100644 --- a/cmd/kyma/alpha/enable/module/module_test.go +++ b/cmd/kyma/alpha/add/module/module_test.go @@ -7,7 +7,7 @@ import ( "github.com/kyma-project/lifecycle-manager/api/v1beta2" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/kyma-project/cli/cmd/kyma/alpha/enable/module/mock" + "github.com/kyma-project/cli/cmd/kyma/alpha/add/module/mock" "github.com/kyma-project/cli/internal/cli/alpha/module" ) diff --git a/cmd/kyma/alpha/enable/module/opts.go b/cmd/kyma/alpha/add/module/opts.go similarity index 100% rename from cmd/kyma/alpha/enable/module/opts.go rename to cmd/kyma/alpha/add/module/opts.go diff --git a/cmd/kyma/alpha/enable/module/opts_test.go b/cmd/kyma/alpha/add/module/opts_test.go similarity index 100% rename from cmd/kyma/alpha/enable/module/opts_test.go rename to cmd/kyma/alpha/add/module/opts_test.go diff --git a/cmd/kyma/alpha/alpha.go b/cmd/kyma/alpha/alpha.go index dcb8e7a12..ebf326d92 100755 --- a/cmd/kyma/alpha/alpha.go +++ b/cmd/kyma/alpha/alpha.go @@ -1,10 +1,10 @@ package alpha import ( + "github.com/kyma-project/cli/cmd/kyma/alpha/add" "github.com/kyma-project/cli/cmd/kyma/alpha/create" + "github.com/kyma-project/cli/cmd/kyma/alpha/delete" "github.com/kyma-project/cli/cmd/kyma/alpha/deploy" - "github.com/kyma-project/cli/cmd/kyma/alpha/disable" - "github.com/kyma-project/cli/cmd/kyma/alpha/enable" "github.com/kyma-project/cli/cmd/kyma/alpha/list" "github.com/kyma-project/cli/cmd/kyma/alpha/sign" "github.com/kyma-project/cli/cmd/kyma/alpha/verify" @@ -23,8 +23,8 @@ func NewCmd(o *cli.Options) *cobra.Command { cmd.AddCommand(create.NewCmd(o)) cmd.AddCommand(list.NewCmd(o)) - cmd.AddCommand(enable.NewCmd(o)) - cmd.AddCommand(disable.NewCmd(o)) + cmd.AddCommand(add.NewCmd(o)) + cmd.AddCommand(delete.NewCmd(o)) cmd.AddCommand(deploy.NewCmd(deploy.NewOptions(o))) cmd.AddCommand(sign.NewCmd(o)) cmd.AddCommand(verify.NewCmd(o)) diff --git a/cmd/kyma/alpha/disable/disable.go b/cmd/kyma/alpha/delete/delete.go similarity index 61% rename from cmd/kyma/alpha/disable/disable.go rename to cmd/kyma/alpha/delete/delete.go index b5f2700a4..87abd5bad 100644 --- a/cmd/kyma/alpha/disable/disable.go +++ b/cmd/kyma/alpha/delete/delete.go @@ -1,15 +1,16 @@ -package disable +package delete import ( - "github.com/kyma-project/cli/cmd/kyma/alpha/disable/module" + "github.com/kyma-project/cli/cmd/kyma/alpha/delete/module" "github.com/kyma-project/cli/internal/cli" "github.com/spf13/cobra" ) func NewCmd(o *cli.Options) *cobra.Command { cmd := &cobra.Command{ - Use: "disable", - Short: "Disables a resource in the Kyma cluster.", + Use: "delete", + Aliases: []string{"disable"}, + Short: "Deletes a resource from the Kyma cluster.", Long: `Use this command to disable a resource in the Kyma cluster. `, } diff --git a/cmd/kyma/alpha/disable/module/module.go b/cmd/kyma/alpha/delete/module/module.go similarity index 92% rename from cmd/kyma/alpha/disable/module/module.go rename to cmd/kyma/alpha/delete/module/module.go index 33a2448bd..7510e3af4 100644 --- a/cmd/kyma/alpha/disable/module/module.go +++ b/cmd/kyma/alpha/delete/module/module.go @@ -29,8 +29,8 @@ func NewCmd(o *Options) *cobra.Command { cmd := &cobra.Command{ Use: "module [name] [flags]", - Short: "Disables a module in the cluster or in the given Kyma resource.", - Long: `Use this command to disable active Kyma modules in the cluster. + Short: "Deletes a module from the cluster or the given Kyma resource.", + Long: `Use this command to delete Kyma modules from the cluster. ### Detailed description @@ -40,8 +40,8 @@ This command disables an active module in the cluster. `, Example: ` -Disable "my-module" from the "alpha" channel in "default-kyma" in "kyma-system" Namespace - kyma alpha disable module my-module -c alpha -n kyma-system -k default-kyma +Delete "my-module" from the "alpha" channel from "default-kyma" in "kyma-system" Namespace + kyma alpha delete module my-module -c alpha -n kyma-system -k default-kyma `, RunE: func(cmd *cobra.Command, args []string) error { return c.Run(cmd.Context(), args) }, Aliases: []string{"mod", "mods", "modules"}, diff --git a/cmd/kyma/alpha/disable/module/module_test.go b/cmd/kyma/alpha/delete/module/module_test.go similarity index 100% rename from cmd/kyma/alpha/disable/module/module_test.go rename to cmd/kyma/alpha/delete/module/module_test.go diff --git a/cmd/kyma/alpha/disable/module/opts.go b/cmd/kyma/alpha/delete/module/opts.go similarity index 100% rename from cmd/kyma/alpha/disable/module/opts.go rename to cmd/kyma/alpha/delete/module/opts.go diff --git a/docs/gen-docs/kyma_alpha.md b/docs/gen-docs/kyma_alpha.md index 221adcfdd..168e9ec30 100644 --- a/docs/gen-docs/kyma_alpha.md +++ b/docs/gen-docs/kyma_alpha.md @@ -22,10 +22,10 @@ Alpha commands are experimental, unreleased features that should only be used by ## See also * [kyma](kyma.md) - Controls a Kyma cluster. +* [kyma alpha add](kyma_alpha_add.md) - Adds a resource to the Kyma cluster. * [kyma alpha create](kyma_alpha_create.md) - Creates resources on the Kyma cluster. +* [kyma alpha delete](kyma_alpha_delete.md) - Deletes a resource from the Kyma cluster. * [kyma alpha deploy](kyma_alpha_deploy.md) - Deploys Kyma on a running Kubernetes cluster. -* [kyma alpha disable](kyma_alpha_disable.md) - Disables a resource in the Kyma cluster. -* [kyma alpha enable](kyma_alpha_enable.md) - Enables a resource in the Kyma cluster. * [kyma alpha list](kyma_alpha_list.md) - Lists resources on the Kyma cluster. * [kyma alpha sign](kyma_alpha_sign.md) - Signs all module resources from an unsigned module component descriptor that's hosted in a remote OCI registry * [kyma alpha verify](kyma_alpha_verify.md) - Verifies all module resources from a signed module component descriptor that's hosted in a remote OCI registry diff --git a/docs/gen-docs/kyma_alpha_enable.md b/docs/gen-docs/kyma_alpha_add.md similarity index 81% rename from docs/gen-docs/kyma_alpha_enable.md rename to docs/gen-docs/kyma_alpha_add.md index b9ad667f1..0d3cd4c3f 100644 --- a/docs/gen-docs/kyma_alpha_enable.md +++ b/docs/gen-docs/kyma_alpha_add.md @@ -1,8 +1,8 @@ --- -title: kyma alpha enable +title: kyma alpha add --- -Enables a resource in the Kyma cluster. +Adds a resource to the Kyma cluster. ## Synopsis @@ -22,5 +22,5 @@ Use this command to enable a resource in the Kyma cluster. ## See also * [kyma alpha](kyma_alpha.md) - Experimental commands -* [kyma alpha enable module](kyma_alpha_enable_module.md) - Enables a module in the cluster or in the given Kyma resource. +* [kyma alpha add module](kyma_alpha_add_module.md) - Adds a module in the cluster or in the given Kyma resource. diff --git a/docs/gen-docs/kyma_alpha_enable_module.md b/docs/gen-docs/kyma_alpha_add_module.md similarity index 80% rename from docs/gen-docs/kyma_alpha_enable_module.md rename to docs/gen-docs/kyma_alpha_add_module.md index 2e0bcb06b..bed62498e 100644 --- a/docs/gen-docs/kyma_alpha_enable_module.md +++ b/docs/gen-docs/kyma_alpha_add_module.md @@ -1,12 +1,12 @@ --- -title: kyma alpha enable module +title: kyma alpha add module --- -Enables a module in the cluster or in the given Kyma resource. +Adds a module in the cluster or in the given Kyma resource. ## Synopsis -Use this command to enable Kyma modules available in the cluster. +Use this command to add Kyma modules available in the cluster. ### Detailed description @@ -17,15 +17,15 @@ A module is available when it is released with a ModuleTemplate. The ModuleTempl ```bash -kyma alpha enable module [name] [flags] +kyma alpha add module [name] [flags] ``` ## Examples ```bash -Enable "my-module" from "alpha" channel in "default-kyma" in "kyma-system" Namespace - kyma alpha enable module my-module -c alpha -n kyma-system -k default-kyma +Add "my-module" from "alpha" channel to "default-kyma" in "kyma-system" Namespace + kyma alpha add module my-module -c alpha -n kyma-system -k default-kyma ``` @@ -53,5 +53,5 @@ Enable "my-module" from "alpha" channel in "default-kyma" in "kyma-system" Names ## See also -* [kyma alpha enable](kyma_alpha_enable.md) - Enables a resource in the Kyma cluster. +* [kyma alpha add](kyma_alpha_add.md) - Adds a resource to the Kyma cluster. diff --git a/docs/gen-docs/kyma_alpha_disable.md b/docs/gen-docs/kyma_alpha_delete.md similarity index 81% rename from docs/gen-docs/kyma_alpha_disable.md rename to docs/gen-docs/kyma_alpha_delete.md index aaa6416c9..d6e4cce63 100644 --- a/docs/gen-docs/kyma_alpha_disable.md +++ b/docs/gen-docs/kyma_alpha_delete.md @@ -1,8 +1,8 @@ --- -title: kyma alpha disable +title: kyma alpha delete --- -Disables a resource in the Kyma cluster. +Deletes a resource from the Kyma cluster. ## Synopsis @@ -22,5 +22,5 @@ Use this command to disable a resource in the Kyma cluster. ## See also * [kyma alpha](kyma_alpha.md) - Experimental commands -* [kyma alpha disable module](kyma_alpha_disable_module.md) - Disables a module in the cluster or in the given Kyma resource. +* [kyma alpha delete module](kyma_alpha_delete_module.md) - Deletes a module from the cluster or the given Kyma resource. diff --git a/docs/gen-docs/kyma_alpha_disable_module.md b/docs/gen-docs/kyma_alpha_delete_module.md similarity index 76% rename from docs/gen-docs/kyma_alpha_disable_module.md rename to docs/gen-docs/kyma_alpha_delete_module.md index 21f1c3602..c9a99128a 100644 --- a/docs/gen-docs/kyma_alpha_disable_module.md +++ b/docs/gen-docs/kyma_alpha_delete_module.md @@ -1,12 +1,12 @@ --- -title: kyma alpha disable module +title: kyma alpha delete module --- -Disables a module in the cluster or in the given Kyma resource. +Deletes a module from the cluster or the given Kyma resource. ## Synopsis -Use this command to disable active Kyma modules in the cluster. +Use this command to delete Kyma modules from the cluster. ### Detailed description @@ -16,15 +16,15 @@ This command disables an active module in the cluster. ```bash -kyma alpha disable module [name] [flags] +kyma alpha delete module [name] [flags] ``` ## Examples ```bash -Disable "my-module" from the "alpha" channel in "default-kyma" in "kyma-system" Namespace - kyma alpha disable module my-module -c alpha -n kyma-system -k default-kyma +Delete "my-module" from the "alpha" channel from "default-kyma" in "kyma-system" Namespace + kyma alpha delete module my-module -c alpha -n kyma-system -k default-kyma ``` @@ -51,5 +51,5 @@ Disable "my-module" from the "alpha" channel in "default-kyma" in "kyma-system" ## See also -* [kyma alpha disable](kyma_alpha_disable.md) - Disables a resource in the Kyma cluster. +* [kyma alpha delete](kyma_alpha_delete.md) - Deletes a resource from the Kyma cluster. diff --git a/go.mod b/go.mod index d018e6faa..223e497ad 100644 --- a/go.mod +++ b/go.mod @@ -8,10 +8,10 @@ require ( github.com/Masterminds/semver/v3 v3.2.1 github.com/avast/retry-go v3.0.0+incompatible github.com/briandowns/spinner v1.23.0 - github.com/containerd/containerd v1.7.12 + github.com/containerd/containerd v1.7.13 github.com/daviddengcn/go-colortext v1.0.0 - github.com/docker/cli v24.0.7+incompatible - github.com/docker/docker v24.0.7+incompatible + github.com/docker/cli v24.0.9+incompatible + github.com/docker/docker v24.0.9+incompatible github.com/docker/go-connections v0.5.0 github.com/fatih/color v1.16.0 github.com/go-git/go-git/v5 v5.11.0 @@ -24,10 +24,10 @@ require ( github.com/kyma-project/lifecycle-manager/api v0.0.0-20231212124126-3539b2df72e0 github.com/mandelsoft/vfs v0.4.0 github.com/onsi/ginkgo/v2 v2.15.0 - github.com/onsi/gomega v1.30.0 - github.com/open-component-model/ocm v0.4.0 + github.com/onsi/gomega v1.31.1 + github.com/open-component-model/ocm v0.6.0 github.com/opencontainers/go-digest v1.0.0 - github.com/opencontainers/image-spec v1.1.0-rc5 + github.com/opencontainers/image-spec v1.1.0-rc6 github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 github.com/pkg/errors v0.9.1 github.com/spf13/cobra v1.8.0 @@ -178,6 +178,7 @@ require ( github.com/go-openapi/swag v0.22.4 // indirect github.com/go-openapi/validate v0.22.3 // indirect github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect + github.com/go-test/deep v1.1.0 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.5.0 // indirect @@ -208,7 +209,10 @@ require ( github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-retryablehttp v0.7.5 // indirect + github.com/hashicorp/go-rootcerts v1.0.2 // indirect + github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect github.com/hashicorp/hcl v1.0.1-vault-5 // indirect + github.com/hashicorp/vault-client-go v0.4.2 // indirect github.com/huandu/xstrings v1.4.0 // indirect github.com/iancoleman/orderedmap v0.2.0 // indirect github.com/iancoleman/strcase v0.2.0 // indirect @@ -250,7 +254,7 @@ require ( github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/moby/locker v1.0.1 // indirect - github.com/moby/moby v20.10.24+incompatible // indirect + github.com/moby/moby v24.0.9+incompatible // indirect github.com/moby/patternmatcher v0.6.0 // indirect github.com/moby/spdystream v0.2.0 // indirect github.com/moby/sys/sequential v0.5.0 // indirect @@ -266,7 +270,7 @@ require ( github.com/nwaples/rardecode v1.1.3 // indirect github.com/oklog/ulid v1.3.1 // indirect github.com/oleiade/reflections v1.0.1 // indirect - github.com/opencontainers/runc v1.1.5 // indirect + github.com/opencontainers/runc v1.1.12 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/otiai10/copy v1.9.0 // indirect github.com/panjf2000/ants/v2 v2.7.1 // indirect @@ -284,6 +288,7 @@ require ( github.com/rivo/uniseg v0.4.4 // indirect github.com/rubenv/sql-migrate v1.5.2 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect + github.com/ryanuber/go-glob v1.0.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sassoftware/relic v7.2.1+incompatible // indirect diff --git a/go.sum b/go.sum index 33878fc9a..f92d8cf50 100644 --- a/go.sum +++ b/go.sum @@ -128,6 +128,10 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/ClickHouse/clickhouse-go v1.4.3/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI= github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= +github.com/DataDog/gostackparse v0.7.0 h1:i7dLkXHvYzHV308hnkvVGDL3BR4FWl7IsXNPz/IGQh4= +github.com/DataDog/gostackparse v0.7.0/go.mod h1:lTfqcJKqS9KnXQGnyQMCugq3u1FP6UZMfWR0aitKFMM= +github.com/InfiniteLoopSpace/go_S-MIME v0.0.0-20181221134359-3f58f9a4b2b6 h1:TkEaE2dfSBN9onWsQ1pC9EVMmVDJqkYWNUwS6+EYxlM= +github.com/InfiniteLoopSpace/go_S-MIME v0.0.0-20181221134359-3f58f9a4b2b6/go.mod h1:yhh4MGRGdTpTET5RhSJx4XNCEkJljP3k8MxTTB3joQA= github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ= github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= @@ -495,8 +499,8 @@ github.com/containerd/containerd v1.5.1/go.mod h1:0DOxVqwDy2iZvrZp2JUx/E+hS0UNTV github.com/containerd/containerd v1.5.7/go.mod h1:gyvv6+ugqY25TiXxcZC3L5yOeYgEw0QMhscqVp1AR9c= github.com/containerd/containerd v1.5.8/go.mod h1:YdFSv5bTFLpG2HIYmfqDpSYYTDX+mc5qtSuYx1YUb/s= github.com/containerd/containerd v1.6.1/go.mod h1:1nJz5xCZPusx6jJU8Frfct988y0NpumIq9ODB0kLtoE= -github.com/containerd/containerd v1.7.12 h1:+KQsnv4VnzyxWcfO9mlxxELaoztsDEjOuCMPAuPqgU0= -github.com/containerd/containerd v1.7.12/go.mod h1:/5OMpE1p0ylxtEUGY8kuCYkDRzJm9NO1TFMWjUpdevk= +github.com/containerd/containerd v1.7.13 h1:wPYKIeGMN8vaggSKuV1X0wZulpMz4CrgEsZdaCyB6Is= +github.com/containerd/containerd v1.7.13/go.mod h1:zT3up6yTRfEUa6+GsITYIJNgSVL9NQ4x4h1RPzk0Wu4= github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/containerd/continuity v0.0.0-20190815185530-f2a389ac0a02/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/containerd/continuity v0.0.0-20191127005431-f65d91d395eb/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= @@ -647,8 +651,8 @@ github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= github.com/docker/cli v0.0.0-20191017083524-a8ff7f821017/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= -github.com/docker/cli v24.0.7+incompatible h1:wa/nIwYFW7BVTGa7SWPVyyXU9lgORqUb1xfI36MSkFg= -github.com/docker/cli v24.0.7+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/cli v24.0.9+incompatible h1:OxbimnP/z+qVjDLpq9wbeFU3Nc30XhSe+LkwYQisD50= +github.com/docker/cli v24.0.9+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY= github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= @@ -658,8 +662,8 @@ github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4Kfc github.com/docker/docker v1.4.2-0.20190924003213-a8608b5b67c7/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v20.10.9+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v20.10.14+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= -github.com/docker/docker v24.0.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v24.0.9+incompatible h1:HPGzNmwfLZWdxHqK9/II92pyi1EpYKsAqcl4G0Of9v0= +github.com/docker/docker v24.0.9+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.6.3/go.mod h1:WRaJzqw3CTB9bk10avuGsjVBZsD05qeibJ1/TYlvc0Y= github.com/docker/docker-credential-helpers v0.6.4/go.mod h1:ofX3UI0Gz1TteYBjtgs07O36Pyasyp66D2uKT7H8W1c= github.com/docker/docker-credential-helpers v0.8.0 h1:YQFtbBQb4VrpoPxhFuzEBPQ9E16qz5SpHLS+uswaCp8= @@ -1139,6 +1143,8 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hashicorp/vault-client-go v0.4.2 h1:XeUXb5jnDuCUhC8HRpkdGPLh1XtzXmiOnF0mXEbARxI= +github.com/hashicorp/vault-client-go v0.4.2/go.mod h1:4tDw7Uhq5XOxS1fO+oMtotHL7j4sB9cp0T7U6m4FzDY= github.com/hashicorp/vault/api v1.10.0 h1:/US7sIjWN6Imp4o/Rj1Ce2Nr5bki/AXi9vAW3p2tOJQ= github.com/hashicorp/vault/api v1.10.0/go.mod h1:jo5Y/ET+hNyz+JnKDt8XLAdKs+AM0G5W0Vp1IrFI8N8= github.com/howeyc/gopass v0.0.0-20210920133722-c8aef6fb66ef h1:A9HsByNhogrvm9cWb28sjiS3i7tcKCkflWFEkHfuAgM= @@ -1436,8 +1442,8 @@ github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zx github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg= github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= -github.com/moby/moby v20.10.24+incompatible h1:hjfxUufgeyrgolyaOWASyR9SvehpNcq/QHp/tx4VgsM= -github.com/moby/moby v20.10.24+incompatible/go.mod h1:fDXVQ6+S340veQPv35CzDahGBmHsiclFwfEygB/TWMc= +github.com/moby/moby v24.0.9+incompatible h1:Z/hFbZJqC5Fmuf6jesMLdHU71CMAgdiSJ1ZYey+bFmg= +github.com/moby/moby v24.0.9+incompatible/go.mod h1:fDXVQ6+S340veQPv35CzDahGBmHsiclFwfEygB/TWMc= github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk= github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= github.com/moby/spdystream v0.2.0 h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8= @@ -1529,10 +1535,10 @@ github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDs github.com/onsi/gomega v1.15.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0= github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= -github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= -github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= -github.com/open-component-model/ocm v0.4.0 h1:S+rPJGoDnSvxhBn3QS2HXURxugTjCM4XWEJLZSaH6Ek= -github.com/open-component-model/ocm v0.4.0/go.mod h1:7RAqaUMmA4BlwW5ZEUBm8amWIb1TL9FhNigNXQ6wiu0= +github.com/onsi/gomega v1.31.1 h1:KYppCUK+bUgAZwHOu7EXVBKyQA6ILvOESHkn/tgoqvo= +github.com/onsi/gomega v1.31.1/go.mod h1:y40C95dwAD1Nz36SsEnxvfFe8FFfNxzI5eJ0EYGyAy0= +github.com/open-component-model/ocm v0.6.0 h1:R8TQthzSddiU5i/NEJv5EziSSSqO9FAnO7WhqOcUEXA= +github.com/open-component-model/ocm v0.6.0/go.mod h1:rqMOD7puXAcLb7YMG2Zt2KH0vfBL/yhn9+uO6e0wLJg= github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= @@ -1544,8 +1550,8 @@ github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zM github.com/opencontainers/image-spec v1.0.2-0.20211117181255-693428a734f5/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/image-spec v1.0.3-0.20211202193544-a5463b7f9c84/go.mod h1:Qnt1q4cjDNQI9bT832ziho5Iw2BhK8o1KwLOwW56VP4= -github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI= -github.com/opencontainers/image-spec v1.1.0-rc5/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8= +github.com/opencontainers/image-spec v1.1.0-rc6 h1:XDqvyKsJEbRtATzkgItUqBA7QHk58yxX1Ov9HERHNqU= +github.com/opencontainers/image-spec v1.1.0-rc6/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= @@ -1554,8 +1560,8 @@ github.com/opencontainers/runc v1.0.0-rc93/go.mod h1:3NOsor4w32B2tC0Zbl8Knk4Wg84 github.com/opencontainers/runc v1.0.2/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0= github.com/opencontainers/runc v1.1.0/go.mod h1:Tj1hFw6eFWp/o33uxGf5yF2BX5yz2Z6iptFpuvbbKqc= github.com/opencontainers/runc v1.1.1/go.mod h1:Tj1hFw6eFWp/o33uxGf5yF2BX5yz2Z6iptFpuvbbKqc= -github.com/opencontainers/runc v1.1.5 h1:L44KXEpKmfWDcS02aeGm8QNTFXTo2D+8MYGDIJ/GDEs= -github.com/opencontainers/runc v1.1.5/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= +github.com/opencontainers/runc v1.1.12 h1:BOIssBaW1La0/qbNZHXOOa71dZfZEQOzW7dqQf3phss= +github.com/opencontainers/runc v1.1.12/go.mod h1:S+lQwSfncpBha7XTy/5lBwWgm5+y5Ma/O44Ekby9FK8= github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.0.1/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.0.2-0.20190207185410-29686dbc5559/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= @@ -1705,7 +1711,6 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg github.com/sebdah/goldie/v2 v2.5.3/go.mod h1:oZ9fp0+se1eapSRjfYbsV/0Hqhbuu3bJVvKI/NNtssI= github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= github.com/seccomp/libseccomp-golang v0.9.2-0.20210429002308-3879420cc921/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg= -github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg= github.com/secure-systems-lab/go-securesystemslib v0.7.0 h1:OwvJ5jQf9LnIAS83waAjPbcMsODrTQUpJ02eNLUoxBg= github.com/secure-systems-lab/go-securesystemslib v0.7.0/go.mod h1:/2gYnlnHVQ6xeGtfIqFy7Do03K4cdCY0A/GlJLDKLHI= github.com/segmentio/ksuid v1.0.4 h1:sBo2BdShXjmcugAMwjugoGUdUV0pcxY5mW4xKRn3v4c= diff --git a/pkg/module/blob/blob.go b/pkg/module/blob/blob.go index 253a2e5fe..ecaf6e114 100644 --- a/pkg/module/blob/blob.go +++ b/pkg/module/blob/blob.go @@ -64,6 +64,10 @@ func (o *Output) Digest() digest.Digest { return digest.FromString(o.digest) } +func (o *Output) Dup() (accessio.BlobAccess, error) { + return o, nil +} + type InputType string const ( diff --git a/pkg/module/oci_repo.go b/pkg/module/oci_repo.go index 035eef614..f500c65d5 100644 --- a/pkg/module/oci_repo.go +++ b/pkg/module/oci_repo.go @@ -2,6 +2,7 @@ package module import ( "fmt" + "reflect" "github.com/open-component-model/ocm/pkg/common" "github.com/open-component-model/ocm/pkg/contexts/ocm" @@ -25,14 +26,14 @@ type OciRepoAccess interface { type OciRepo struct{} func (r *OciRepo) ComponentVersionExists(archive *comparch.ComponentArchive, repo cpi.Repository) (bool, error) { - return repo.ExistsComponentVersion(archive.ComponentVersionAccess.GetName(), - archive.ComponentVersionAccess.GetVersion()) + return repo.ExistsComponentVersion(archive.GetName(), + archive.GetVersion()) } func (r *OciRepo) GetComponentVersion(archive *comparch.ComponentArchive, repo cpi.Repository) (ocm.ComponentVersionAccess, error) { - return repo.LookupComponentVersion(archive.ComponentVersionAccess.GetName(), - archive.ComponentVersionAccess.GetVersion()) + return repo.LookupComponentVersion(archive.GetName(), + archive.GetVersion()) } func (r *OciRepo) PushComponentVersion(archive *comparch.ComponentArchive, repo cpi.Repository, overwrite bool) error { @@ -42,7 +43,7 @@ func (r *OciRepo) PushComponentVersion(archive *comparch.ComponentArchive, repo } if err = transfer.TransferVersion( - common.NewLoggingPrinter(archive.GetContext().Logger()), nil, archive.ComponentVersionAccess, repo, + common.NewLoggingPrinter(archive.GetContext().Logger()), nil, archive, repo, &customTransferHandler{transferHandler}, ); err != nil { return fmt.Errorf("could not finish component transfer: %w", err) @@ -63,7 +64,8 @@ func (r *OciRepo) DescriptorResourcesAreEquivalent(archive *comparch.ComponentAr localResourcesMap[res.Name] = res } - for _, res := range remoteResources { + for i := range remoteResources { + res := remoteResources[i] localResource := localResourcesMap[res.Name] if res.Name == RawManifestLayerName { remoteAccess, ok := res.Access.(*runtime.UnstructuredVersionedTypedObject) @@ -88,10 +90,36 @@ func (r *OciRepo) DescriptorResourcesAreEquivalent(archive *comparch.ComponentAr if remoteAccessLocalReference[7:] != localAccessObject.LocalReference[7:] { return false } - } else if !res.IsEquivalent(&localResource) { + } else if !isEquivalent(&res, &localResource) { return false } } return true } + +func isEquivalent(r *compdesc.Resource, e compdesc.ElementMetaAccessor) bool { + // Paranoid sanity checks + if r == nil && e == nil { + return true + } + if r == nil && e != nil || r != nil && e == nil { + return false + } + + // Taken from OCM@v0.4.0 because the implementation in v0.6.0 looks flawed + o, ok := e.(*compdesc.Resource) + if !ok { + return false + } + if !reflect.DeepEqual(&r.ElementMeta, &o.ElementMeta) { + return false + } + if !reflect.DeepEqual(&r.Access, &o.Access) { + return false + } + return r.Type == o.Type && + r.Relation == o.Relation && + reflect.DeepEqual(r.SourceRef, o.SourceRef) + +} diff --git a/pkg/module/remote.go b/pkg/module/remote.go index 01e9642b1..9d5495a68 100644 --- a/pkg/module/remote.go +++ b/pkg/module/remote.go @@ -141,7 +141,7 @@ func (r *Remote) ShouldPushArchive(repo cpi.Repository, archive *comparch.Compon } return false, fmt.Errorf("version %s already exists with different content, please use "+ "--module-archive-version-overwrite flag to overwrite it", - archive.ComponentVersionAccess.GetVersion()) + archive.GetVersion()) } } diff --git a/pkg/module/resources.go b/pkg/module/resources.go index bca41faf6..635d2f3f5 100644 --- a/pkg/module/resources.go +++ b/pkg/module/resources.go @@ -14,6 +14,7 @@ import ( "github.com/open-component-model/ocm/pkg/common/accessobj" "github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc" ocmv1 "github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc/meta/v1" + "github.com/open-component-model/ocm/pkg/contexts/ocm/cpi" "github.com/open-component-model/ocm/pkg/contexts/ocm/repositories/comparch" "github.com/pkg/errors" "go.uber.org/zap" @@ -117,7 +118,7 @@ func addBlob(fs vfs.FileSystem, archive *comparch.ComponentArchive, resource *Re return err } - return archive.SetResource(&resource.ResourceMeta, blobAccess) + return archive.SetResource(&resource.ResourceMeta, blobAccess, cpi.ModifyResource(true)) } func (rd ResourceDescriptor) String() string { diff --git a/pkg/module/security_scan.go b/pkg/module/security_scan.go index 80ee5625f..9c078b6d1 100644 --- a/pkg/module/security_scan.go +++ b/pkg/module/security_scan.go @@ -6,7 +6,7 @@ import ( "os" "strings" - "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs/types/ociimage" + itociartifact "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs/types/ociartifact" "github.com/open-component-model/ocm/pkg/contexts/ocm/accessmethods/ociartifact" ocm "github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc" ocmv1 "github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc/meta/v1" @@ -97,7 +97,7 @@ func appendProtecodeImagesLayers(descriptor *ocm.ComponentDescriptor, config *Se Labels: []ocmv1.Label{*imageTypeLabel}, Version: imageTag, }, - Type: ociimage.TYPE, + Type: itociartifact.LEGACY_TYPE, Relation: ocmv1.ExternalRelation, }, Access: access, diff --git a/pkg/module/sign.go b/pkg/module/sign.go index 403c3638c..053d8fd7f 100644 --- a/pkg/module/sign.go +++ b/pkg/module/sign.go @@ -10,6 +10,7 @@ import ( "github.com/open-component-model/ocm/pkg/signing" "github.com/open-component-model/ocm/pkg/signing/handlers/rsa" "github.com/open-component-model/ocm/pkg/signing/hasher/sha512" + "github.com/open-component-model/ocm/pkg/signing/signutils" "github.com/pkg/errors" ) @@ -112,7 +113,7 @@ func privateKey(pathToPrivateKey string) (interface{}, error) { return nil, fmt.Errorf("unable to open key file: %w", err) } - key, err := signing.ParsePrivateKey(privateKeyFile) + key, err := signutils.ParsePrivateKey(privateKeyFile) if err != nil { return nil, fmt.Errorf("unable to parse private key: %w", err) } @@ -125,7 +126,7 @@ func publicKey(pathToPublicKey string) (interface{}, error) { return nil, fmt.Errorf("unable to open key file: %w", err) } - key, err := signing.ParsePublicKey(publicKeyFile) + key, err := signutils.ParsePublicKey(publicKeyFile) if err != nil { return nil, fmt.Errorf("unable to parse public key: %w", err) } diff --git a/tests/e2e/create_module/kyma_create_module_test.go b/tests/e2e/create_module/kyma_create_module_test.go index 5d85460bd..2382ba877 100644 --- a/tests/e2e/create_module/kyma_create_module_test.go +++ b/tests/e2e/create_module/kyma_create_module_test.go @@ -69,7 +69,7 @@ func Test_ModuleTemplate(t *testing.T) { ociArtifactAccessSpec, ok := resourceAccessSpec.(*ociartifact.AccessSpec) assert.True(t, ok) assert.Equal(t, ociartifact.Type, ociArtifactAccessSpec.GetType()) - assert.Equal(t, "europe-docker.pkg.dev/kyma-project/prod/template-operator:0.1.0", + assert.Equal(t, "europe-docker.pkg.dev/kyma-project/prod/template-operator:0.1.2", ociArtifactAccessSpec.ImageReference) }) @@ -102,7 +102,7 @@ func Test_ModuleTemplate(t *testing.T) { flattened := e2e.Flatten(secScanLabels) assert.Equal(t, map[string]string{ "git.kyma-project.io/ref": "refs/heads/main", - "scan.security.kyma-project.io/rc-tag": "0.1.0", + "scan.security.kyma-project.io/rc-tag": "0.1.2", "scan.security.kyma-project.io/language": "golang-mod", "scan.security.kyma-project.io/dev-branch": "main", "scan.security.kyma-project.io/subprojects": "false",