From e683ff7d8269c2d497170558fe7e52e0c7bab716 Mon Sep 17 00:00:00 2001 From: Nesma Badr Date: Fri, 11 Oct 2024 13:24:15 +0200 Subject: [PATCH] deps: Import ocm.software instead of github.com/open-component-model (#64) * Import ocm.software instead of github.com/open-component-model * Bump lifecycle manager api --- .golangci.yaml | 8 ++--- go.mod | 3 +- go.sum | 6 ++-- internal/service/registry/registry.go | 6 ++-- tests/e2e/create/create_test.go | 48 +++++++++++++-------------- 5 files changed, 32 insertions(+), 39 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 8e41fd94..ff9ec118 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -60,12 +60,6 @@ linters-settings: alias: scaffoldcmd - pkg: github.com/kyma-project/modulectl/cmd/modulectl/create alias: createcmd - - pkg: github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc/meta/v1 - alias: ocmmetav1 - - pkg: github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc/versions/v2 - alias: compdescv2 - - pkg: github.com/open-component-model/ocm/pkg/contexts/ocm/repositories/ocireg - alias: ocmocireg - pkg: github.com/kyma-project/modulectl/internal/service/moduleconfig/generator alias: moduleconfiggenerator - pkg: github.com/kyma-project/modulectl/internal/service/moduleconfig/reader @@ -74,6 +68,8 @@ linters-settings: alias: ocmv1 - pkg: ocm.software/ocm/cmds/ocm/commands/ocmcmds/common/inputs/types/ociartifact alias: ociartifacttypes + - pkg: ocm.software/ocm/api/oci/extensions/repositories/ocireg + alias: ocirepo - pkg: k8s.io/apimachinery/pkg/apis/meta/v1 alias: metav1 ireturn: diff --git a/go.mod b/go.mod index 21e61ce7..7685901c 100644 --- a/go.mod +++ b/go.mod @@ -5,11 +5,10 @@ go 1.23.2 require ( github.com/Masterminds/semver/v3 v3.3.0 github.com/go-git/go-git/v5 v5.12.0 - github.com/kyma-project/lifecycle-manager/api v0.0.0-20240918085249-66f3802ce0ae + github.com/kyma-project/lifecycle-manager/api v0.0.0-20241011105939-73146fa998d9 github.com/mandelsoft/vfs v0.4.3 github.com/onsi/ginkgo/v2 v2.20.2 github.com/onsi/gomega v1.34.2 - github.com/open-component-model/ocm v0.13.0 github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.9.0 diff --git a/go.sum b/go.sum index 4f741a3c..e766cc33 100644 --- a/go.sum +++ b/go.sum @@ -673,8 +673,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/kyma-project/lifecycle-manager/api v0.0.0-20240918085249-66f3802ce0ae h1:oMVWWLuZlqYXquXLAJq4929p1qHO2QOD+NDjbLKTh4A= -github.com/kyma-project/lifecycle-manager/api v0.0.0-20240918085249-66f3802ce0ae/go.mod h1:379rKdE9P3Grrg+yZuIygD0YpaUoQtUX831J66cscWU= +github.com/kyma-project/lifecycle-manager/api v0.0.0-20241011105939-73146fa998d9 h1:mxi7A1orZisV63Vj7qSXVA8Njuw1M5cfiS5hUYatQZQ= +github.com/kyma-project/lifecycle-manager/api v0.0.0-20241011105939-73146fa998d9/go.mod h1:tPAWE8Vb6v8gBQKjByNLG6P7jPoJ9MM3Q09DUM/BfMc= github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/letsencrypt/boulder v0.0.0-20240620165639-de9c06129bec h1:2tTW6cDth2TSgRbAhD7yjZzTQmcN25sDRPEeinR51yQ= @@ -786,8 +786,6 @@ github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAl github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/onsi/gomega v1.34.2 h1:pNCwDkzrsv7MS9kpaQvVb1aVLahQXyJ/Tv5oAZMI3i8= github.com/onsi/gomega v1.34.2/go.mod h1:v1xfxRgk0KIsG+QOdm7p8UosrOzPYRo60fd3B/1Dukc= -github.com/open-component-model/ocm v0.13.0 h1:rm31Z7SpFzpxCIUagaFEUI4cSIS098Hf2H0dToV2nOA= -github.com/open-component-model/ocm v0.13.0/go.mod h1:+ovmIxTexDM2fcnfVg9uqJh22A7KOxwa/stNJn315yU= github.com/open-policy-agent/opa v0.67.0 h1:FOdsO9yNhfmrh+72oVK7ImWmzruG+VSpfbr5IBqEWVs= github.com/open-policy-agent/opa v0.67.0/go.mod h1:aqKlHc8E2VAAylYE9x09zJYr/fYzGX+JKne89UGqFzk= github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= diff --git a/internal/service/registry/registry.go b/internal/service/registry/registry.go index ce20bd69..b1c6b139 100644 --- a/internal/service/registry/registry.go +++ b/internal/service/registry/registry.go @@ -9,7 +9,7 @@ import ( "ocm.software/ocm/api/credentials" "ocm.software/ocm/api/credentials/extensions/repositories/dockerconfig" - "ocm.software/ocm/api/oci/extensions/repositories/ocireg" + ocirepo "ocm.software/ocm/api/oci/extensions/repositories/ocireg" "ocm.software/ocm/api/ocm/cpi" "ocm.software/ocm/api/ocm/extensions/repositories/comparch" "ocm.software/ocm/api/utils/runtime" @@ -75,14 +75,14 @@ func (s *Service) getRepository(insecure bool, userPasswordCreds, registryURL st } ctx := cpi.DefaultContext() - repoType := ocireg.Type + repoType := ocirepo.Type registryURL = NoSchemeURL(registryURL) if insecure { registryURL = "http://" + registryURL } creds := GetCredentials(ctx, insecure, userPasswordCreds, registryURL) - ociRepoSpec := &ocireg.RepositorySpec{ + ociRepoSpec := &ocirepo.RepositorySpec{ ObjectVersionedType: runtime.NewVersionedObjectType(repoType), BaseURL: registryURL, } diff --git a/tests/e2e/create/create_test.go b/tests/e2e/create/create_test.go index 9423c189..459f2617 100644 --- a/tests/e2e/create/create_test.go +++ b/tests/e2e/create/create_test.go @@ -3,19 +3,18 @@ package create_test import ( - "github.com/open-component-model/ocm/pkg/contexts/ocm/accessmethods/github" - "github.com/open-component-model/ocm/pkg/contexts/ocm/accessmethods/ociartifact" "io/fs" "os" - "github.com/open-component-model/ocm/pkg/contexts/oci/repositories/ocireg" - "github.com/open-component-model/ocm/pkg/contexts/ocm" - "github.com/open-component-model/ocm/pkg/contexts/ocm/accessmethods/localblob" - "github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc" - ocmmetav1 "github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc/meta/v1" - compdescv2 "github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc/versions/v2" - ocmocireg "github.com/open-component-model/ocm/pkg/contexts/ocm/repositories/ocireg" "k8s.io/apimachinery/pkg/util/yaml" + "ocm.software/ocm/api/ocm" + "ocm.software/ocm/api/ocm/compdesc" + ocmv1 "ocm.software/ocm/api/ocm/compdesc/meta/v1" + "ocm.software/ocm/api/ocm/compdesc/versions/v2" + "ocm.software/ocm/api/ocm/extensions/accessmethods/github" + "ocm.software/ocm/api/ocm/extensions/accessmethods/localblob" + "ocm.software/ocm/api/ocm/extensions/accessmethods/ociartifact" + "ocm.software/ocm/api/ocm/extensions/repositories/ocireg" "github.com/kyma-project/lifecycle-manager/api/shared" "github.com/kyma-project/lifecycle-manager/api/v1beta2" @@ -147,7 +146,7 @@ var _ = Describe("Test 'create' command", Ordered, func() { Expect(err).ToNot(HaveOccurred()) descriptor := getDescriptor(template) Expect(descriptor).ToNot(BeNil()) - Expect(descriptor.SchemaVersion()).To(Equal(compdescv2.SchemaVersion)) + Expect(descriptor.SchemaVersion()).To(Equal(v2.SchemaVersion)) By("And annotations should be correct") annotations := template.Annotations @@ -158,14 +157,14 @@ var _ = Describe("Test 'create' command", Ordered, func() { Expect(descriptor.RepositoryContexts).To(HaveLen(1)) repo := descriptor.GetEffectiveRepositoryContext() Expect(repo.Object["baseUrl"]).To(Equal(ociRegistry)) - Expect(repo.Object["componentNameMapping"]).To(Equal(string(ocmocireg.OCIRegistryURLPathMapping))) + Expect(repo.Object["componentNameMapping"]).To(Equal(string(ocireg.OCIRegistryURLPathMapping))) Expect(repo.Object["type"]).To(Equal(ocireg.Type)) By("And descriptor.component.resources should be correct") Expect(descriptor.Resources).To(HaveLen(1)) resource := descriptor.Resources[0] Expect(resource.Name).To(Equal("raw-manifest")) - Expect(resource.Relation).To(Equal(ocmmetav1.LocalRelation)) + Expect(resource.Relation).To(Equal(ocmv1.LocalRelation)) Expect(resource.Type).To(Equal("directory")) Expect(resource.Version).To(Equal("1.0.0")) @@ -265,7 +264,7 @@ var _ = Describe("Test 'create' command", Ordered, func() { Expect(descriptor.Resources).To(HaveLen(2)) resource := descriptor.Resources[1] Expect(resource.Name).To(Equal("default-cr")) - Expect(resource.Relation).To(Equal(ocmmetav1.LocalRelation)) + Expect(resource.Relation).To(Equal(ocmv1.LocalRelation)) Expect(resource.Type).To(Equal("directory")) Expect(resource.Version).To(Equal("1.0.2")) @@ -282,15 +281,16 @@ var _ = Describe("Test 'create' command", Ordered, func() { Context("Given 'modulectl create' command", func() { var cmd createCmd - It("When invoked with valid module-config containing security-scanner-config and different version, and the git-remote flag", func() { - cmd = createCmd{ - moduleConfigFile: withSecurityConfig, - registry: ociRegistry, - insecure: true, - output: templateOutputPath, - gitRemote: gitRemote, - } - }) + It("When invoked with valid module-config containing security-scanner-config and different version, and the git-remote flag", + func() { + cmd = createCmd{ + moduleConfigFile: withSecurityConfig, + registry: ociRegistry, + insecure: true, + output: templateOutputPath, + gitRemote: gitRemote, + } + }) It("Then the command should succeed", func() { Expect(cmd.execute()).To(Succeed()) @@ -307,7 +307,7 @@ var _ = Describe("Test 'create' command", Ordered, func() { Expect(descriptor.Resources).To(HaveLen(2)) resource := descriptor.Resources[0] Expect(resource.Name).To(Equal("template-operator")) - Expect(resource.Relation).To(Equal(ocmmetav1.ExternalRelation)) + Expect(resource.Relation).To(Equal(ocmv1.ExternalRelation)) Expect(resource.Type).To(Equal("ociArtifact")) Expect(resource.Version).To(Equal("1.0.0")) resource = descriptor.Resources[1] @@ -426,7 +426,7 @@ func getDescriptor(template *v1beta2.ModuleTemplate) *v1beta2.Descriptor { return desc } -func flatten(labels ocmmetav1.Labels) map[string]string { +func flatten(labels ocmv1.Labels) map[string]string { labelsMap := make(map[string]string) for _, l := range labels { var value string