From 52d567924e42949fb58f2acc3c302670cf0083c8 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 | 49 +++++++++++++------ .../container_run_cgroup_linux_test.go | 10 ---- cmd/nerdctl/container/container_stats_test.go | 7 --- 3 files changed, 34 insertions(+), 32 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1bb2570a076..aeb628c1a4f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -337,8 +337,9 @@ jobs: docker run --privileged --rm tonistiigi/binfmt --install linux/arm/v7 - name: "Prepare integration test environment" run: | - sudo apt-get install -y expect - go install -v gotest.tools/gotestsum@v1 + # FIXME: remove when we are done removing unbuffer from tests + sudo apt-get install -qq expect + make install-dev-tools - name: "Ensure that the integration test suite is compatible with Docker" run: WITH_SUDO=true ./hack/test-integration.sh -test.target=docker - name: "Ensure that the IPv6 integration test suite is compatible with Docker" @@ -400,13 +401,13 @@ jobs: curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list sudo sed -i 's/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/ubuntu.sources - sudo apt-get update - sudo apt-get install -y libvirt-daemon libvirt-daemon-system vagrant ovmf + sudo apt-get update -qq + sudo apt-get install -qq --no-install-recommends libvirt-daemon libvirt-daemon-system vagrant ovmf # https://github.com/vagrant-libvirt/vagrant-libvirt/issues/1725#issuecomment-1454058646 sudo cp /usr/share/OVMF/OVMF_VARS_4M.fd /var/lib/libvirt/qemu/nvram/ sudo systemctl enable --now libvirtd sudo apt-get build-dep -y ruby-libvirt - sudo apt-get install -y --no-install-recommends libxslt-dev libxml2-dev libvirt-dev ruby-bundler ruby-dev zlib1g-dev + sudo apt-get install -qq --no-install-recommends libxslt-dev libxml2-dev libvirt-dev ruby-bundler ruby-dev zlib1g-dev sudo vagrant plugin install vagrant-libvirt - name: Boot VM run: | @@ -427,6 +428,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: @@ -434,8 +439,8 @@ jobs: - name: "Install QEMU" run: | set -eux - sudo apt-get update - sudo apt-get -qq install -y --no-install-recommends ovmf qemu-system-x86 qemu-utils + sudo apt-get update -qq + sudo apt-get install -qq --no-install-recommends ovmf qemu-system-x86 qemu-utils sudo modprobe kvm # `sudo usermod -aG kvm $(whoami)` does not take an effect on GHA sudo chown $(whoami) /dev/kvm @@ -488,20 +493,34 @@ jobs: echo "DOCKER_HOST=${DOCKER_HOST}" >>$GITHUB_ENV docker info docker version + - name: "Expose GitHub Runtime variables for gha" + uses: crazy-max/ghaction-github-runtime@b3a9207c0e1ef41f4cf215303c976869d0c2c1c4 # v3.0.0 - name: "Prepare integration tests" env: 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 + # Presumably, docker already did screw the pooch wrt /dev, so bounce it + sudo setenforce 0 + sudo systemctl stop docker + docker info + sudo systemctl start docker + docker info + + 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"))