Skip to content

Commit 5e3b21e

Browse files
authored
Merge pull request #5248 from AkihiroSuda/cherrypick-5239-1.5
[release-1.5] Complete migration from Cirrus CI to GHA (Lima)
2 parents c0b996d + a03e109 commit 5e3b21e

5 files changed

Lines changed: 109 additions & 170 deletions

File tree

.cirrus.yml

Lines changed: 0 additions & 125 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,12 @@ jobs:
208208
PKG_CONFIG_PATH: /usr/386/lib/pkgconfig
209209
run: sudo -E PATH="$PATH" -- make GOARCH=386 localunittest
210210

211-
fedora:
212-
timeout-minutes: 30
211+
lima:
212+
timeout-minutes: 60
213+
strategy:
214+
fail-fast: false
215+
matrix:
216+
template: [almalinux-8, almalinux-9, centos-stream-10, fedora]
213217
runs-on: ubuntu-24.04
214218
steps:
215219
- uses: actions/checkout@v6
@@ -220,21 +224,21 @@ jobs:
220224
- uses: actions/cache@v5
221225
with:
222226
path: ~/.cache/lima
223-
key: lima-${{ steps.lima-actions-setup.outputs.version }}
227+
key: lima-${{ steps.lima-actions-setup.outputs.version }}-${{ matrix.template }}
224228

225229
- name: "Start VM"
226230
# --plain is set to disable file sharing, port forwarding, built-in containerd, etc. for faster start up
227231
#
228232
# CPUs: min(4, host CPU cores)
229233
# RAM: min(4 GiB, half of host memory)
230234
# Disk: 100 GiB
231-
run: limactl start --plain --name=default template://fedora
235+
run: limactl start --plain --name=default template:${{ matrix.template }}
232236

233237
- name: "Initialize VM"
234238
run: |
235239
set -eux -o pipefail
236240
limactl cp -r . default:/tmp/runc
237-
lima sudo /tmp/runc/script/setup_host_fedora.sh
241+
lima sudo /tmp/runc/script/setup_host.sh
238242
239243
- name: "Show guest info"
240244
run: |
@@ -262,6 +266,8 @@ jobs:
262266
run: ssh -tt lima-default sudo -i make -C /tmp/runc localintegration
263267

264268
- name: "Run integration tests (systemd driver, rootless)"
269+
# Needs cgroup v2
270+
if: ${{ matrix.template != 'almalinux-8' }}
265271
run: ssh -tt lima-default sudo -i make -C /tmp/runc localrootlessintegration RUNC_USE_SYSTEMD=yes
266272

267273
- name: "Run integration tests (fs driver, rootless)"
@@ -271,7 +277,7 @@ jobs:
271277
needs:
272278
- test
273279
- cross-i386
274-
- fedora
280+
- lima
275281
runs-on: ubuntu-24.04
276282
steps:
277283
- run: echo "All jobs completed"

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/588/badge)](https://bestpractices.coreinfrastructure.org/projects/588)
66
[![gha/validate](https://github.com/opencontainers/runc/workflows/validate/badge.svg)](https://github.com/opencontainers/runc/actions?query=workflow%3Avalidate)
77
[![gha/ci](https://github.com/opencontainers/runc/workflows/ci/badge.svg)](https://github.com/opencontainers/runc/actions?query=workflow%3Aci)
8-
[![CirrusCI](https://api.cirrus-ci.com/github/opencontainers/runc.svg)](https://cirrus-ci.com/github/opencontainers/runc)
98

109
## Introduction
1110

script/setup_host.sh

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#!/bin/bash
2+
# This script is used for initializing the host environment for CI.
3+
# Supports Fedora and EL-based distributions.
4+
set -eux -o pipefail
5+
6+
: "${LIBPATHRS_VERSION:=0.2.4}"
7+
8+
# BATS_VERSION is only consumed for the EL8 platform as its bats package is too old.
9+
: "${BATS_VERSION:=v1.12.0}"
10+
11+
SCRIPTDIR="$(dirname "${BASH_SOURCE[0]}")"
12+
13+
# PLATFORM_ID is not available on Fedora
14+
PLATFORM_ID=
15+
grep -q ^PLATFORM_ID /etc/os-release && PLATFORM_ID="$(grep -oP '^PLATFORM_ID="\K[^"]+' /etc/os-release)"
16+
17+
# Initialize DNF
18+
DNF=(dnf -y --setopt=install_weak_deps=False --setopt=tsflags=nodocs)
19+
case "$PLATFORM_ID" in
20+
platform:el8)
21+
# DNF+=(--exclude="kernel,kernel-core") seems to fail
22+
"${DNF[@]}" config-manager --set-enabled powertools # for glibc-static
23+
"${DNF[@]}" install epel-release
24+
;;
25+
platform:el9 | platform:el10)
26+
DNF+=(--exclude="kernel,kernel-core")
27+
"${DNF[@]}" config-manager --set-enabled crb # for glibc-static
28+
"${DNF[@]}" install epel-release
29+
;;
30+
*)
31+
# Fedora
32+
DNF+=(--exclude="kernel,kernel-core")
33+
;;
34+
esac
35+
36+
# Install common packages
37+
RPMS=(cargo container-selinux fuse-sshfs git-core glibc-static golang iptables jq libseccomp-devel lld make policycoreutils wget)
38+
# Work around dnf mirror failures by retrying a few times.
39+
for i in $(seq 0 2); do
40+
sleep "$i"
41+
"${DNF[@]}" update && "${DNF[@]}" install "${RPMS[@]}" && break
42+
done
43+
# shellcheck disable=SC2181
44+
[ $? -eq 0 ] # fail if dnf failed
45+
46+
# Install CRIU
47+
if [ "$PLATFORM_ID" = "platform:el8" ]; then
48+
# Use newer criu (with https://github.com/checkpoint-restore/criu/pull/2545).
49+
# Alas we have to disable container-tools for that.
50+
"${DNF[@]}" module disable container-tools
51+
"${DNF[@]}" copr enable adrian/criu-el8
52+
fi
53+
"${DNF[@]}" install criu
54+
55+
# Install BATS
56+
if [ "$PLATFORM_ID" = "platform:el8" ]; then
57+
# The packaged version of bats is too old: `BATS_ERROR_SUFFIX: unbound variable`, `bats_require_minimum_version: command not found`
58+
(
59+
cd /tmp
60+
git clone https://github.com/bats-core/bats-core
61+
(
62+
cd bats-core
63+
git checkout "$BATS_VERSION"
64+
./install.sh /usr/local
65+
cat >>/etc/profile.d/sh.local <<'EOF'
66+
PATH="/usr/local/bin:$PATH"
67+
export PATH
68+
EOF
69+
cat >/etc/sudoers.d/local <<'EOF'
70+
Defaults secure_path = "/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
71+
EOF
72+
)
73+
rm -rf bats-core
74+
)
75+
else
76+
"${DNF[@]}" install bats
77+
fi
78+
79+
# Clean up DNF
80+
dnf clean all
81+
82+
# Install libpathrs
83+
"$SCRIPTDIR"/build-libpathrs.sh "$LIBPATHRS_VERSION" /usr
84+
85+
# Setup rootless user.
86+
"$SCRIPTDIR"/setup_rootless.sh
87+
88+
# Delegate all cgroup v2 controllers to rootless user via --systemd-cgroup
89+
if [ -e /sys/fs/cgroup/cgroup.controllers ]; then
90+
mkdir -p /etc/systemd/system/user@.service.d
91+
cat >/etc/systemd/system/user@.service.d/delegate.conf <<'EOF'
92+
[Service]
93+
# The default (since systemd v252) is "pids memory cpu".
94+
Delegate=yes
95+
EOF
96+
systemctl daemon-reload
97+
fi

script/setup_host_fedora.sh

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)