Skip to content

Commit

Permalink
support ci arm64
Browse files Browse the repository at this point in the history
Signed-off-by: Kay Yan <[email protected]>
  • Loading branch information
yankay committed Jul 17, 2024
1 parent 370cab6 commit 34c63b2
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
run: go test -v ./pkg/...

test-integration:
runs-on: "ubuntu-${{ matrix.ubuntu }}"
runs-on: "${{ matrix.runner }}"
timeout-minutes: 40
strategy:
fail-fast: false
Expand All @@ -58,10 +58,16 @@ jobs:
include:
- ubuntu: 20.04
containerd: v1.6.33
runner: "ubuntu-20.04"
- ubuntu: 22.04
containerd: v1.7.19
runner: "ubuntu-22.04"
- ubuntu: 24.04
containerd: v2.0.0-rc.3
runner: "ubuntu-24.04"
- ubuntu: 24.04
containerd: v2.0.0-rc.3
runner: github-arm64-2c-8gb
env:
UBUNTU_VERSION: "${{ matrix.ubuntu }}"
CONTAINERD_VERSION: "${{ matrix.containerd }}"
Expand Down
13 changes: 11 additions & 2 deletions cmd/nerdctl/container_run_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,13 @@ func TestRunSigProxy(t *testing.T) {
}
}

func fluentdImage() string {
if runtime.GOARCH == "arm64" {
return testutil.FluentdImageArm64
}
return testutil.FluentdImage
}

func TestRunWithFluentdLogDriver(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("fluentd log driver is not yet implemented on Windows")
Expand All @@ -409,7 +416,8 @@ func TestRunWithFluentdLogDriver(t *testing.T) {

containerName := testutil.Identifier(t)
base.Cmd("run", "-d", "--name", containerName, "-p", "24224:24224",
"-v", fmt.Sprintf("%s:/fluentd/log", tempDirectory), testutil.FluentdImage).AssertOK()
"-v", fmt.Sprintf("%s:/fluentd/log", tempDirectory),
fluentdImage()).AssertOK()
defer base.Cmd("rm", "-f", containerName).AssertOK()
time.Sleep(3 * time.Second)

Expand Down Expand Up @@ -441,7 +449,8 @@ func TestRunWithFluentdLogDriverWithLogOpt(t *testing.T) {

containerName := testutil.Identifier(t)
base.Cmd("run", "-d", "--name", containerName, "-p", "24225:24224",
"-v", fmt.Sprintf("%s:/fluentd/log", tempDirectory), testutil.FluentdImage).AssertOK()
"-v", fmt.Sprintf("%s:/fluentd/log", tempDirectory),
fluentdImage()).AssertOK()
defer base.Cmd("rm", "-f", containerName).AssertOK()
time.Sleep(3 * time.Second)

Expand Down
11 changes: 11 additions & 0 deletions cmd/nerdctl/multi_platform_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package main
import (
"fmt"
"io"
"runtime"
"strings"
"testing"

Expand All @@ -38,6 +39,12 @@ func testMultiPlatformRun(base *testutil.Base, alpineImage string) {
"linux/arm": "armv7l",
"linux/arm/v7": "armv7l",
}
// using aarch64 instead of armv7l because the arm64 system is compatible with armv7.
if runtime.GOARCH == "arm64" {
testCases["arm"] = "aarch64"
testCases["linux/arm"] = "aarch64"
testCases["linux/arm/v7"] = "aarch64"
}
for plat, expectedUnameM := range testCases {
t.Logf("Testing %q (%q)", plat, expectedUnameM)
cmd := base.Cmd("run", "--rm", "--platform="+plat, alpineImage, "uname", "-m")
Expand Down Expand Up @@ -159,6 +166,10 @@ RUN uname -m > /usr/share/nginx/html/index.html
"http://127.0.0.1:8081": "aarch64",
"http://127.0.0.1:8082": "armv7l",
}
// using aarch64 instead of armv7l because the arm64 system is compatible with armv7.
if runtime.GOARCH == "arm64" {
testCases["http://127.0.0.1:8082"] = "aarch64"
}

for testURL, expectedIndexHTML := range testCases {
resp, err := nettestutil.HTTPGet(testURL, 50, false)
Expand Down
1 change: 1 addition & 0 deletions pkg/testutil/testutil_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ var (
MariaDBImage = mirrorOf("mariadb:10.5")
DockerAuthImage = mirrorOf("cesanta/docker_auth:1.7")
FluentdImage = mirrorOf("fluent/fluentd:v1.14-1")
FluentdImageArm64 = mirrorOf("fluent/fluentd:v1.14-arm64-debian")
KuboImage = mirrorOf("ipfs/kubo:v0.16.0")
SystemdImage = "ghcr.io/containerd/stargz-snapshotter:0.15.1-kind"

Expand Down

0 comments on commit 34c63b2

Please sign in to comment.