Skip to content

Commit 235f9e4

Browse files
authored
Merge pull request #5253 from AkihiroSuda/cherrypick-5239-1.3
[release-1.3] Complete migration from Cirrus CI to GHA (Lima)
2 parents 760c2f9 + 65f37ff commit 235f9e4

5 files changed

Lines changed: 104 additions & 157 deletions

File tree

.cirrus.yml

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

.github/workflows/test.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,12 @@ jobs:
178178
- name: unit test
179179
run: sudo -E PATH="$PATH" -- make GOARCH=386 localunittest
180180

181-
fedora:
182-
timeout-minutes: 30
181+
lima:
182+
timeout-minutes: 60
183+
strategy:
184+
fail-fast: false
185+
matrix:
186+
template: [almalinux-8, almalinux-9, centos-stream-10, fedora]
183187
runs-on: ubuntu-24.04
184188
steps:
185189
- uses: actions/checkout@v5
@@ -190,21 +194,21 @@ jobs:
190194
- uses: actions/cache@v4
191195
with:
192196
path: ~/.cache/lima
193-
key: lima-${{ steps.lima-actions-setup.outputs.version }}
197+
key: lima-${{ steps.lima-actions-setup.outputs.version }}-${{ matrix.template }}
194198

195199
- name: "Start VM"
196200
# --plain is set to disable file sharing, port forwarding, built-in containerd, etc. for faster start up
197201
#
198202
# CPUs: min(4, host CPU cores)
199203
# RAM: min(4 GiB, half of host memory)
200204
# Disk: 100 GiB
201-
run: limactl start --plain --name=default template://fedora
205+
run: limactl start --plain --name=default template:${{ matrix.template }}
202206

203207
- name: "Initialize VM"
204208
run: |
205209
set -eux -o pipefail
206210
limactl cp -r . default:/tmp/runc
207-
lima sudo /tmp/runc/script/setup_host_fedora.sh
211+
lima sudo /tmp/runc/script/setup_host.sh
208212
209213
- name: "Show guest info"
210214
run: |
@@ -232,6 +236,8 @@ jobs:
232236
run: ssh -tt lima-default sudo -i make -C /tmp/runc localintegration
233237

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

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

script/setup_host_fedora.sh

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

0 commit comments

Comments
 (0)