From ae5b29ef4d493d674173238e4b1c25abaf379efc Mon Sep 17 00:00:00 2001 From: yzewei Date: Wed, 17 Jan 2024 14:20:55 +0800 Subject: [PATCH] Add Loongarch64 support Signed-off-by: yzewei --- .github/workflows/integration.yaml | 5 +++++ cmd/artifact/config/config_suite_test.go | 5 +++-- cmd/artifact/manifest/manifest_suite_test.go | 5 +++-- pkg/oci/puller/puller_suite_test.go | 5 +++-- pkg/oci/pusher/pusher_suite_test.go | 1 + pkg/oci/pusher/pusher_test.go | 7 ++++--- 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 29d6103fa..6c74d21b6 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -18,9 +18,14 @@ jobs: goarch: - arm64 - amd64 + - loong64 exclude: - goarch: arm64 goos: windows + - goarch: loong64 + goos: windows + - goarch: loong64 + goos: darwin steps: - name: Checkout commit uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 diff --git a/cmd/artifact/config/config_suite_test.go b/cmd/artifact/config/config_suite_test.go index 95d907745..ef33efc2f 100644 --- a/cmd/artifact/config/config_suite_test.go +++ b/cmd/artifact/config/config_suite_test.go @@ -47,6 +47,7 @@ var ( testPluginPlatform1 = "linux/amd64" testPluginPlatform2 = "windows/amd64" testPluginPlatform3 = "linux/arm64" + testPluginPlatform4 = "linux/loong64" ctx = context.Background() pluginMultiPlatformRef string rulesRef string @@ -98,8 +99,8 @@ var _ = BeforeSuite(func() { pusher := ocipusher.NewPusher(authn.NewClient(authn.WithCredentials(&auth.EmptyCredential)), true, nil) // Push plugin artifact with multiple architectures. - filePathsAndPlatforms := ocipusher.WithFilepathsAndPlatforms([]string{testPluginTarball, testPluginTarball, testPluginTarball}, - []string{testPluginPlatform1, testPluginPlatform2, testPluginPlatform3}) + filePathsAndPlatforms := ocipusher.WithFilepathsAndPlatforms([]string{testPluginTarball, testPluginTarball, testPluginTarball, testPluginTarball}, + []string{testPluginPlatform1, testPluginPlatform2, testPluginPlatform3, testPluginPlatform4}) pluginMultiPlatformRef = localRegistryHost + "/plugins:multiplatform" artConfig := oci.ArtifactConfig{} Expect(artConfig.ParseDependencies("my-dep:1.2.3|my-alt-dep:1.4.5")).ToNot(HaveOccurred()) diff --git a/cmd/artifact/manifest/manifest_suite_test.go b/cmd/artifact/manifest/manifest_suite_test.go index c83547ecf..23cfc6b3a 100644 --- a/cmd/artifact/manifest/manifest_suite_test.go +++ b/cmd/artifact/manifest/manifest_suite_test.go @@ -47,6 +47,7 @@ var ( testPluginPlatform1 = "linux/amd64" testPluginPlatform2 = "windows/amd64" testPluginPlatform3 = "linux/arm64" + testPluginPlatform4 = "linux/loong64" ctx = context.Background() pluginMultiPlatformRef string rulesRef string @@ -97,8 +98,8 @@ var _ = BeforeSuite(func() { pusher := ocipusher.NewPusher(authn.NewClient(authn.WithCredentials(&auth.EmptyCredential)), true, nil) // Push plugin artifact with multiple architectures. - filePathsAndPlatforms := ocipusher.WithFilepathsAndPlatforms([]string{testPluginTarball, testPluginTarball, testPluginTarball}, - []string{testPluginPlatform1, testPluginPlatform2, testPluginPlatform3}) + filePathsAndPlatforms := ocipusher.WithFilepathsAndPlatforms([]string{testPluginTarball, testPluginTarball, testPluginTarball, testPluginTarball}, + []string{testPluginPlatform1, testPluginPlatform2, testPluginPlatform3, testPluginPlatform4}) pluginMultiPlatformRef = localRegistryHost + "/plugins:multiplatform" artConfig := oci.ArtifactConfig{} Expect(artConfig.ParseDependencies("my-dep:1.2.3|my-alt-dep:1.4.5")).ToNot(HaveOccurred()) diff --git a/pkg/oci/puller/puller_suite_test.go b/pkg/oci/puller/puller_suite_test.go index 9c617a9b0..f5269a399 100644 --- a/pkg/oci/puller/puller_suite_test.go +++ b/pkg/oci/puller/puller_suite_test.go @@ -49,6 +49,7 @@ var ( testPluginPlatform1 = "linux/amd64" testPluginPlatform2 = "windows/amd64" testPluginPlatform3 = "linux/arm64" + testPluginPlatform4 = "linux/loong64" ctx = context.Background() destinationDir string pluginMultiPlatformRef string @@ -98,8 +99,8 @@ var _ = BeforeSuite(func() { pusher := ocipusher.NewPusher(authn.NewClient(authn.WithCredentials(&auth.EmptyCredential)), true, nil) // Push plugin artifact with multiple architectures. - filePathsAndPlatforms := ocipusher.WithFilepathsAndPlatforms([]string{testPluginTarball, testPluginTarball, testPluginTarball}, - []string{testPluginPlatform1, testPluginPlatform2, testPluginPlatform3}) + filePathsAndPlatforms := ocipusher.WithFilepathsAndPlatforms([]string{testPluginTarball, testPluginTarball, testPluginTarball, testPluginTarball}, + []string{testPluginPlatform1, testPluginPlatform2, testPluginPlatform3, testPluginPlatform4}) pluginMultiPlatformRef = localRegistryHost + "/plugins:multiplatform" artConfig := oci.ArtifactConfig{} Expect(artConfig.ParseDependencies("my-dep:1.2.3|my-alt-dep:1.4.5")).ToNot(HaveOccurred()) diff --git a/pkg/oci/pusher/pusher_suite_test.go b/pkg/oci/pusher/pusher_suite_test.go index 0c98863d9..478668224 100644 --- a/pkg/oci/pusher/pusher_suite_test.go +++ b/pkg/oci/pusher/pusher_suite_test.go @@ -39,6 +39,7 @@ var ( testPluginPlatform1 = "linux/amd64" testPluginPlatform2 = "windows/amd64" testPluginPlatform3 = "linux/arm64" + testPluginPlatform4 = "linux/loong64" ctx = context.Background() ) diff --git a/pkg/oci/pusher/pusher_test.go b/pkg/oci/pusher/pusher_test.go index dca8097bd..82bc46f1a 100644 --- a/pkg/oci/pusher/pusher_test.go +++ b/pkg/oci/pusher/pusher_test.go @@ -169,8 +169,8 @@ var _ = Describe("Pusher", func() { Context("pushing multiple flavors of plugin: 3 filepath, 3 platform without tag", func() { BeforeEach(func() { // Different files, one for each platform. - filePathsAndPlatforms = ocipusher.WithFilepathsAndPlatforms([]string{testPluginTarball, testPluginTarball, testPluginTarball}, - []string{testPluginPlatform1, testPluginPlatform2, testPluginPlatform3}) + filePathsAndPlatforms = ocipusher.WithFilepathsAndPlatforms([]string{testPluginTarball, testPluginTarball, testPluginTarball, testPluginTarball}, + []string{testPluginPlatform1, testPluginPlatform2, testPluginPlatform3, testPluginPlatform4}) options = []ocipusher.Option{filePathsAndPlatforms} // Pushing the artifact without an explicit tag, the default tag (latest) will be added by the pusher. repoAndTag = "/plugin-test-three-flavors" @@ -189,10 +189,11 @@ var _ = Describe("Pusher", func() { // Being the artifact of type plugin we expect that the retrieved descriptor is of type image index. Expect(d.MediaType).To(Equal(v1.MediaTypeImageIndex)) Expect(d.Digest.String()).To(Equal(result.Digest)) - Expect(index.Manifests).To(HaveLen(3)) + Expect(index.Manifests).To(HaveLen(4)) Expect(fmt.Sprintf("%s/%s", index.Manifests[0].Platform.OS, index.Manifests[0].Platform.Architecture)).To(Equal(testPluginPlatform1)) Expect(fmt.Sprintf("%s/%s", index.Manifests[1].Platform.OS, index.Manifests[1].Platform.Architecture)).To(Equal(testPluginPlatform2)) Expect(fmt.Sprintf("%s/%s", index.Manifests[2].Platform.OS, index.Manifests[2].Platform.Architecture)).To(Equal(testPluginPlatform3)) + Expect(fmt.Sprintf("%s/%s", index.Manifests[3].Platform.OS, index.Manifests[3].Platform.Architecture)).To(Equal(testPluginPlatform4)) }) })