From d01a2717e60efde5fa4c5023306fe3e7c5c00bd3 Mon Sep 17 00:00:00 2001 From: Kay Yan Date: Fri, 31 May 2024 12:21:12 +0000 Subject: [PATCH] support ci arm64 Signed-off-by: Kay Yan --- .github/workflows/test.yml | 23 +++++++++++++++++++++++ Dockerfile | 4 ++++ cmd/nerdctl/container_run_linux_test.go | 12 ++++++++++-- 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d5930e8d695..3ea5e0e73db 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -317,3 +317,26 @@ jobs: run: sudo vagrant up --provision-with=test-unit - name: test-integration run: sudo vagrant up --provision-with=test-integration + + test-integration-arm64: + name: test-integration-arm64 + runs-on: github-arm64-2c-8gb + timeout-minutes: 40 + steps: + - uses: actions/checkout@v4.1.7 + with: + fetch-depth: 1 + - name: "Prepare integration test environment" + run: DOCKER_BUILDKIT=1 docker build -t test-integration-arm64 --target test-integration-arm64 . + - name: "Remove snap loopback devices (conflicts with our loopback devices in TestRunDevice)" + run: | + sudo systemctl disable --now snapd.service snapd.socket + sudo apt-get purge -y snapd + sudo losetup -Dv + sudo losetup -lv + - name: "Register QEMU (tonistiigi/binfmt)" + run: docker run --privileged --rm tonistiigi/binfmt --install all + - name: "Run integration tests" + run: docker run -t --rm --privileged test-integration-arm64 + # - name: Setup tmate session + # uses: mxschmitt/action-tmate@v3 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 9746b272409..047ac2f6573 100644 --- a/Dockerfile +++ b/Dockerfile @@ -356,4 +356,8 @@ FROM test-integration AS test-integration-ipv6 CMD ["gotestsum", "--format=testname", "--rerun-fails=2", "--packages=github.com/containerd/nerdctl/v2/cmd/nerdctl/...", \ "--", "-timeout=30m", "-args", "-test.kill-daemon", "-test.ipv6"] +FROM test-integration AS test-integration-arm64 +CMD ["gotestsum", "--format=testname", "--rerun-fails=2", "--packages=github.com/containerd/nerdctl/v2/cmd/nerdctl/...", \ + "--", "-timeout=30m", "-args", "-test.kill-daemon"] + FROM base AS demo diff --git a/cmd/nerdctl/container_run_linux_test.go b/cmd/nerdctl/container_run_linux_test.go index f73fd8ebfda..df10942ce1b 100644 --- a/cmd/nerdctl/container_run_linux_test.go +++ b/cmd/nerdctl/container_run_linux_test.go @@ -409,7 +409,7 @@ 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) @@ -430,6 +430,14 @@ func TestRunWithFluentdLogDriver(t *testing.T) { assert.Equal(t, true, strings.Contains(logData, inspectedContainer.ID)) } +func fluentdImage() string { + if runtime.GOARCH == "arm64" { + return "fluent/fluentd:v1.14-arm64-debian" + } else { + return testutil.FluentdImage + } +} + func TestRunWithFluentdLogDriverWithLogOpt(t *testing.T) { if runtime.GOOS == "windows" { t.Skip("fluentd log driver is not yet implemented on Windows") @@ -441,7 +449,7 @@ 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)