Skip to content

Commit 088fe02

Browse files
authored
Merge pull request #3904 from AkihiroSuda/drop-ubuntu-20.04
CI: drop Ubuntu 20.04, add AlmaLinux 8
2 parents f364f24 + 4d76aa9 commit 088fe02

File tree

3 files changed

+107
-12
lines changed

3 files changed

+107
-12
lines changed

.github/workflows/test.yml

Lines changed: 90 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,7 @@ jobs:
104104
strategy:
105105
fail-fast: false
106106
matrix:
107-
# ubuntu-20.04: cgroup v1, ubuntu-22.04 and later: cgroup v2
108107
include:
109-
- ubuntu: 20.04
110-
containerd: v1.6.36
111-
runner: "ubuntu-20.04"
112-
arch: amd64
113108
- ubuntu: 22.04
114109
containerd: v1.7.25
115110
runner: "ubuntu-22.04"
@@ -228,16 +223,10 @@ jobs:
228223
strategy:
229224
fail-fast: false
230225
matrix:
231-
# ubuntu-20.04: cgroup v1, ubuntu-22.04 and later: cgroup v2
232226
include:
233-
- ubuntu: 20.04
234-
containerd: v1.6.36
235-
rootlesskit: v1.1.1 # Deprecated
236-
target: rootless
237-
arch: amd64
238227
- ubuntu: 22.04
239228
containerd: v1.7.25
240-
rootlesskit: v2.3.2
229+
rootlesskit: v1.1.1 # Deprecated
241230
target: rootless
242231
arch: amd64
243232
- ubuntu: 24.04
@@ -427,3 +416,92 @@ jobs:
427416
run: sudo vagrant up --provision-with=test-unit
428417
- name: test-integration
429418
run: sudo vagrant up --provision-with=test-integration
419+
420+
# EL8 is used for testing compatibility with cgroup v1.
421+
# Do not upgrade this to EL9 (cgroup v2).
422+
test-integration-el8:
423+
timeout-minutes: 60
424+
name: "EL8 (cgroup v1)"
425+
strategy:
426+
fail-fast: false
427+
matrix:
428+
mode: ["rootful", "rootless"]
429+
runs-on: ubuntu-24.04
430+
steps:
431+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
432+
with:
433+
fetch-depth: 1
434+
- name: "Install QEMU"
435+
run: |
436+
set -eux
437+
sudo apt-get update
438+
sudo apt-get -qq install -y --no-install-recommends ovmf qemu-system-x86 qemu-utils
439+
sudo modprobe kvm
440+
# `sudo usermod -aG kvm $(whoami)` does not take an effect on GHA
441+
sudo chown $(whoami) /dev/kvm
442+
- name: "Install Lima"
443+
env:
444+
GITHUB_TOKEN: ${{ github.token }} # required by `gh attestation verify`
445+
run: |
446+
set -eux
447+
LIMA_VERSION=$(curl -fsSL https://api.github.com/repos/lima-vm/lima/releases/latest | jq -r .tag_name)
448+
FILE="lima-${LIMA_VERSION:1}-Linux-x86_64.tar.gz"
449+
curl -fOSL https://github.com/lima-vm/lima/releases/download/${LIMA_VERSION}/${FILE}
450+
gh attestation verify --owner=lima-vm "${FILE}"
451+
sudo tar Cxzf /usr/local "${FILE}"
452+
rm -f "${FILE}"
453+
# Export LIMA_VERSION For the GHA cache key
454+
echo "LIMA_VERSION=${LIMA_VERSION}" >>$GITHUB_ENV
455+
- uses: actions/cache@0c907a75c2c80ebcb7f088228285e798b750cf8f # v4.2.1
456+
with:
457+
path: ~/.cache/lima
458+
key: lima-${{ env.LIMA_VERSION }}
459+
- name: "Start the guest VM"
460+
run: |
461+
set -eux
462+
# containerd=none is set because the built-in containerd support conflicts with Docker
463+
limactl start \
464+
--name=default \
465+
--cpus=4 \
466+
--memory=12 \
467+
--containerd=none \
468+
--set '.mounts=null | .portForwards=[{"guestSocket":"/var/run/docker.sock","hostSocket":"{{.Dir}}/sock/docker.sock"}]' \
469+
template://almalinux-8
470+
# FIXME: the tests should be directly executed in the VM without nesting Docker inside it
471+
# https://github.com/containerd/nerdctl/issues/3858
472+
- name: "Install dockerd in the guest VM"
473+
run: |
474+
set -eux
475+
lima sudo mkdir -p /etc/systemd/system/docker.socket.d
476+
cat <<-EOF | lima sudo tee /etc/systemd/system/docker.socket.d/override.conf
477+
[Socket]
478+
SocketUser=$(whoami)
479+
EOF
480+
lima sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
481+
lima sudo dnf -q -y install docker-ce --nobest
482+
lima sudo systemctl enable --now docker
483+
- name: "Configure the host to use dockerd in the guest VM"
484+
run: |
485+
set -eux
486+
sudo systemctl disable --now docker.service docker.socket
487+
export DOCKER_HOST="unix://$(limactl ls --format '{{.Dir}}/sock/docker.sock' default)"
488+
echo "DOCKER_HOST=${DOCKER_HOST}" >>$GITHUB_ENV
489+
docker info
490+
docker version
491+
- name: "Prepare integration tests"
492+
env:
493+
MODE: ${{ matrix.mode }}
494+
run: |
495+
set -eux
496+
TARGET=test-integration
497+
[ "$MODE" = "rootless" ] && TARGET=test-integration-rootless
498+
docker build -t test-integration --target "${TARGET}" .
499+
# losetup not working as expected on EL8?
500+
# > === FAIL: cmd/nerdctl/container TestRunDevice (0.44s)
501+
# > container_run_cgroup_linux_test.go:236: assertion failed: error is not nil: loopback setup failed ([losetup --find --show /tmp/containerd-test-loopback3931357228]):
502+
# > stdout="", stderr="losetup: /tmp/containerd-test-loopback3931357228: failed to set up loop device: No such file or directory\n": exit status 1
503+
# https://github.com/containerd/nerdctl/pull/3904#issuecomment-2670917820
504+
sudo losetup -Dv
505+
sudo losetup -lv
506+
- name: "Run integration tests"
507+
run: docker run -t --rm --privileged test-integration

cmd/nerdctl/container/container_run_cgroup_linux_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"fmt"
2323
"os"
2424
"path/filepath"
25+
"strings"
2526
"testing"
2627

2728
"github.com/moby/sys/userns"
@@ -34,6 +35,7 @@ import (
3435

3536
"github.com/containerd/nerdctl/v2/pkg/cmd/container"
3637
"github.com/containerd/nerdctl/v2/pkg/idutil/containerwalker"
38+
"github.com/containerd/nerdctl/v2/pkg/infoutil"
3739
"github.com/containerd/nerdctl/v2/pkg/testutil"
3840
"github.com/containerd/nerdctl/v2/pkg/testutil/nerdtest"
3941
)
@@ -226,6 +228,14 @@ func TestRunDevice(t *testing.T) {
226228
t.Skip("test requires the root in the initial user namespace")
227229
}
228230

231+
if unameR := infoutil.UnameR(); strings.Contains(unameR, ".el8") {
232+
t.Logf("Assuming to be running on EL8 (kernel release %q)", unameR)
233+
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")
234+
// > === FAIL: cmd/nerdctl/container TestRunDevice (0.44s)
235+
// > container_run_cgroup_linux_test.go:236: assertion failed: error is not nil: loopback setup failed ([losetup --find --show /tmp/containerd-test-loopback3931357228]):
236+
// > stdout="", stderr="losetup: /tmp/containerd-test-loopback3931357228: failed to set up loop device: No such file or directory\n": exit status 1
237+
}
238+
229239
const n = 3
230240
lo := make([]*loopback.Loopback, n)
231241
loContent := make([]string, n)

cmd/nerdctl/container/container_stats_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ package container
1818

1919
import (
2020
"runtime"
21+
"strings"
2122
"testing"
2223

2324
"github.com/containerd/nerdctl/mod/tigron/expect"
2425
"github.com/containerd/nerdctl/mod/tigron/require"
2526
"github.com/containerd/nerdctl/mod/tigron/test"
2627

28+
"github.com/containerd/nerdctl/v2/pkg/infoutil"
2729
"github.com/containerd/nerdctl/v2/pkg/testutil"
2830
"github.com/containerd/nerdctl/v2/pkg/testutil/nerdtest"
2931
)
@@ -43,6 +45,11 @@ func TestStats(t *testing.T) {
4345
)
4446
}
4547

48+
if unameR := infoutil.UnameR(); strings.Contains(unameR, ".el8") {
49+
t.Logf("Assuming to be running on EL8 (kernel release %q)", unameR)
50+
t.Skip("FIXME: the test seems to hang on EL8: https://github.com/containerd/nerdctl/pull/3904#issuecomment-2693931822")
51+
}
52+
4653
testCase.Cleanup = func(data test.Data, helpers test.Helpers) {
4754
helpers.Anyhow("rm", "-f", data.Identifier("container"))
4855
helpers.Anyhow("rm", "-f", data.Identifier("memlimited"))

0 commit comments

Comments
 (0)