Skip to content

Commit 19493bf

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 19493bf

File tree

5 files changed

+108
-175
lines changed

5 files changed

+108
-175
lines changed

.cirrus.yml

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

.github/workflows/test.yml

Lines changed: 11 additions & 9 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
@@ -226,17 +230,13 @@ jobs:
226230

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

235235
- name: "Initialize VM"
236236
run: |
237237
set -eux -o pipefail
238238
limactl cp -r . default:/tmp/runc
239-
lima sudo /tmp/runc/script/setup_host_fedora.sh
239+
lima sudo /tmp/runc/script/setup_host.sh
240240
241241
- name: "Show guest info"
242242
run: |
@@ -264,6 +264,8 @@ jobs:
264264
run: ssh -tt lima-default sudo -i make -C /tmp/runc localintegration
265265

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

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