Skip to content

Commit 9d697a9

Browse files
committed
Complete migration from Cirrus CI to GHA (Lima)
Fix issue 5238 Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
1 parent edbed61 commit 9d697a9

5 files changed

Lines changed: 111 additions & 171 deletions

File tree

.cirrus.yml

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

.github/workflows/test.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,12 @@ jobs:
210210
PKG_CONFIG_PATH: /usr/386/lib/pkgconfig
211211
run: sudo -E PATH="$PATH" -- make GOARCH=386 localunittest
212212

213-
fedora:
214-
timeout-minutes: 30
213+
lima:
214+
timeout-minutes: 60
215+
strategy:
216+
fail-fast: false
217+
matrix:
218+
template: [almalinux-8, almalinux-9, centos-stream-10, fedora]
215219
runs-on: ubuntu-24.04
216220
steps:
217221
- uses: actions/checkout@v6
@@ -230,13 +234,13 @@ jobs:
230234
# CPUs: min(4, host CPU cores)
231235
# RAM: min(4 GiB, half of host memory)
232236
# Disk: 100 GiB
233-
run: limactl start --plain --name=default template://fedora
237+
run: limactl start --plain --name=default template:${{ matrix.template }}
234238

235239
- name: "Initialize VM"
236240
run: |
237241
set -eux -o pipefail
238242
limactl cp -r . default:/tmp/runc
239-
lima sudo /tmp/runc/script/setup_host_fedora.sh
243+
lima sudo /tmp/runc/script/setup_host.sh
240244
241245
- name: "Show guest info"
242246
run: |
@@ -264,6 +268,8 @@ jobs:
264268
run: ssh -tt lima-default sudo -i make -C /tmp/runc localintegration
265269

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

269275
- name: "Run integration tests (fs driver, rootless)"
@@ -273,7 +279,7 @@ jobs:
273279
needs:
274280
- test
275281
- cross-i386
276-
- fedora
282+
- lima
277283
runs-on: ubuntu-24.04
278284
steps:
279285
- 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: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
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
98+
99+
# Allow potentially unsafe tests.
100+
echo 'export RUNC_ALLOW_UNSAFE_TESTS=yes' >>/root/.bashrc

script/setup_host_fedora.sh

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

0 commit comments

Comments
 (0)