Skip to content

Commit

Permalink
Add Loongarch64 support
Browse files Browse the repository at this point in the history
Signed-off-by: yzewei <[email protected]>
  • Loading branch information
yzewei committed Jan 15, 2024
1 parent c89a6a8 commit 35b4ac2
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions cmd/artifact/config/config_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ var (
testPluginPlatform1 = "linux/amd64"
testPluginPlatform2 = "windows/amd64"
testPluginPlatform3 = "linux/arm64"
testPluginPlatform4 = "linux/loong64"
ctx = context.Background()
pluginMultiPlatformRef string
rulesRef string
Expand Down Expand Up @@ -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())
Expand Down
5 changes: 3 additions & 2 deletions cmd/artifact/manifest/manifest_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ var (
testPluginPlatform1 = "linux/amd64"
testPluginPlatform2 = "windows/amd64"
testPluginPlatform3 = "linux/arm64"
testPluginPlatform4 = "linux/loong64"
ctx = context.Background()
pluginMultiPlatformRef string
rulesRef string
Expand Down Expand Up @@ -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())
Expand Down
7 changes: 5 additions & 2 deletions cmd/registry/push/push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ var registryPushTests = Describe("push", func() {
// Plugin's platforms.
platformARM64 = "linux/arm64"
platformAMD64 = "linux/amd64"
platformLOONG64 = "linux/loong64"

// Data fetched from registry and used for assertions.
pluginData *testutils.PluginArtifact
Expand Down Expand Up @@ -479,7 +480,7 @@ var registryPushTests = Describe("push", func() {
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(pluginData.Descriptor.Digest.String())))

By("checking index")
Expect(pluginData.Index.Manifests).Should(HaveLen(2))
Expect(pluginData.Index.Manifests).Should(HaveLen(3))

if annotation {
Expect(pluginData.Index.Annotations).Should(HaveKeyWithValue("org.opencontainers.image.source", anSource))
Expand All @@ -490,6 +491,7 @@ var registryPushTests = Describe("push", func() {
By("checking platforms")
Expect(pluginData.Platforms).Should(HaveKey(platformARM64))
Expect(pluginData.Platforms).Should(HaveKey(platformAMD64))
Expect(pluginData.Platforms).Should(HaveKey(platformLOONG64))

By("checking config layer")
for _, p := range pluginData.Platforms {
Expand Down Expand Up @@ -539,7 +541,8 @@ var registryPushTests = Describe("push", func() {
When("with full flags and args", func() {
BeforeEach(func() {
args = []string{registryCmd, pushCmd, fullRepoName, plugin, pluginRaw, "--type", "plugin", "--platform",
platformAMD64, "--platform", platformARM64, "--version", version, "--config", configFile,
platformAMD64, "--platform",
platformARM64, "--platform", platformLOONG64, "--version", version, "--config", configFile,
"--plain-http", "--depends-on", dep1, "--depends-on", dep2, "--requires", req, "--annotation-source", anSource,
"--tag", pushedTags[0], "--tag", pushedTags[1], "--tag", pushedTags[2], "--name", artifactNameInConfigLayer}
})
Expand Down
5 changes: 3 additions & 2 deletions pkg/oci/puller/puller_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ var (
testPluginPlatform1 = "linux/amd64"
testPluginPlatform2 = "windows/amd64"
testPluginPlatform3 = "linux/arm64"
testPluginPlatform4 = "linux/loong64"
ctx = context.Background()
destinationDir string
pluginMultiPlatformRef string
Expand Down Expand Up @@ -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())
Expand Down
1 change: 1 addition & 0 deletions pkg/oci/pusher/pusher_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ var (
testPluginPlatform1 = "linux/amd64"
testPluginPlatform2 = "windows/amd64"
testPluginPlatform3 = "linux/arm64"
testPluginPlatform4 = "linux/loong64"
ctx = context.Background()
)

Expand Down
5 changes: 3 additions & 2 deletions pkg/oci/pusher/pusher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ var _ = Describe("Pusher", func() {
BeforeEach(func() {
// Different files, one for each platform.
filePathsAndPlatforms = ocipusher.WithFilepathsAndPlatforms([]string{testPluginTarball, testPluginTarball, testPluginTarball},
[]string{testPluginPlatform1, testPluginPlatform2, testPluginPlatform3})
[]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"
Expand All @@ -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))
})
})

Expand Down

0 comments on commit 35b4ac2

Please sign in to comment.