From 3fffaa5d485f2a3bb2ba61e3403e7f88d963ab65 Mon Sep 17 00:00:00 2001 From: apostasie Date: Mon, 3 Mar 2025 13:43:33 -0800 Subject: [PATCH] Fix alma ci target Ensure alma test are ran against the right version of containerd, ubuntu and rootlesskit inside the container. Signed-off-by: apostasie --- .github/workflows/test.yml | 26 +++++++++++++------ .../container_run_cgroup_linux_test.go | 10 ------- cmd/nerdctl/container/container_stats_test.go | 7 ----- 3 files changed, 18 insertions(+), 25 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1bb2570a076..4fbccbc3a20 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -427,6 +427,10 @@ jobs: matrix: mode: ["rootful", "rootless"] runs-on: ubuntu-24.04 + env: + UBUNTU_VERSION: 20.04 + CONTAINERD_VERSION: v1.6.36 + ROOTLESSKIT_VERSION: v1.1.1 steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: @@ -493,15 +497,21 @@ jobs: MODE: ${{ matrix.mode }} run: | set -eux - TARGET=test-integration - [ "$MODE" = "rootless" ] && TARGET=test-integration-rootless - docker build -t test-integration --target "${TARGET}" . - # losetup not working as expected on EL8? - # > === FAIL: cmd/nerdctl/container TestRunDevice (0.44s) - # > container_run_cgroup_linux_test.go:236: assertion failed: error is not nil: loopback setup failed ([losetup --find --show /tmp/containerd-test-loopback3931357228]): - # > stdout="", stderr="losetup: /tmp/containerd-test-loopback3931357228: failed to set up loop device: No such file or directory\n": exit status 1 - # https://github.com/containerd/nerdctl/pull/3904#issuecomment-2670917820 + sudo losetup -Dv sudo losetup -lv + + TARGET=test-integration + [ "$MODE" = "rootless" ] && TARGET=test-integration-rootless + docker buildx create --name with-gha --use + docker buildx build \ + --output=type=docker \ + --cache-from type=gha,scope=amd64-${CONTAINERD_VERSION} \ + -t test-integration --target "${TARGET}" \ + --build-arg UBUNTU_VERSION=${UBUNTU_VERSION} \ + --build-arg CONTAINERD_VERSION=${CONTAINERD_VERSION} \ + --build-arg ROOTLESSKIT_VERSION=${ROOTLESSKIT_VERSION} \ + . + - name: "Run integration tests" run: docker run -t --rm --privileged test-integration diff --git a/cmd/nerdctl/container/container_run_cgroup_linux_test.go b/cmd/nerdctl/container/container_run_cgroup_linux_test.go index b70c8936824..287d372908e 100644 --- a/cmd/nerdctl/container/container_run_cgroup_linux_test.go +++ b/cmd/nerdctl/container/container_run_cgroup_linux_test.go @@ -22,7 +22,6 @@ import ( "fmt" "os" "path/filepath" - "strings" "testing" "github.com/moby/sys/userns" @@ -35,7 +34,6 @@ import ( "github.com/containerd/nerdctl/v2/pkg/cmd/container" "github.com/containerd/nerdctl/v2/pkg/idutil/containerwalker" - "github.com/containerd/nerdctl/v2/pkg/infoutil" "github.com/containerd/nerdctl/v2/pkg/testutil" "github.com/containerd/nerdctl/v2/pkg/testutil/nerdtest" ) @@ -228,14 +226,6 @@ func TestRunDevice(t *testing.T) { t.Skip("test requires the root in the initial user namespace") } - if unameR := infoutil.UnameR(); strings.Contains(unameR, ".el8") { - t.Logf("Assuming to be running on EL8 (kernel release %q)", unameR) - t.Skip("FIXME: loopback.New fails on EL8 (when the test is executed inside a container) https://github.com/containerd/nerdctl/pull/3904#issuecomment-2670917820") - // > === FAIL: cmd/nerdctl/container TestRunDevice (0.44s) - // > container_run_cgroup_linux_test.go:236: assertion failed: error is not nil: loopback setup failed ([losetup --find --show /tmp/containerd-test-loopback3931357228]): - // > stdout="", stderr="losetup: /tmp/containerd-test-loopback3931357228: failed to set up loop device: No such file or directory\n": exit status 1 - } - const n = 3 lo := make([]*loopback.Loopback, n) loContent := make([]string, n) diff --git a/cmd/nerdctl/container/container_stats_test.go b/cmd/nerdctl/container/container_stats_test.go index 897a108228f..0648d502d94 100644 --- a/cmd/nerdctl/container/container_stats_test.go +++ b/cmd/nerdctl/container/container_stats_test.go @@ -18,14 +18,12 @@ package container import ( "runtime" - "strings" "testing" "github.com/containerd/nerdctl/mod/tigron/expect" "github.com/containerd/nerdctl/mod/tigron/require" "github.com/containerd/nerdctl/mod/tigron/test" - "github.com/containerd/nerdctl/v2/pkg/infoutil" "github.com/containerd/nerdctl/v2/pkg/testutil" "github.com/containerd/nerdctl/v2/pkg/testutil/nerdtest" ) @@ -45,11 +43,6 @@ func TestStats(t *testing.T) { ) } - if unameR := infoutil.UnameR(); strings.Contains(unameR, ".el8") { - t.Logf("Assuming to be running on EL8 (kernel release %q)", unameR) - t.Skip("FIXME: the test seems to hang on EL8: https://github.com/containerd/nerdctl/pull/3904#issuecomment-2693931822") - } - testCase.Cleanup = func(data test.Data, helpers test.Helpers) { helpers.Anyhow("rm", "-f", data.Identifier("container")) helpers.Anyhow("rm", "-f", data.Identifier("memlimited"))