Skip to content

Commit a2bcf19

Browse files
committed
runners: Add option to install custom kernel on Fedora
Allow installing a custom kernel version from the Fedora experimental kernel repos onto the github runners. This is useful for testing if ZFS works against a newer kernel. Fedora has a number of repos with experimental kernel packages. This PR allows installs from kernels in these repos: @kernel-vanilla/stable @kernel-vanilla/mainline (https://fedoraproject.org/wiki/Kernel_Vanilla_Repositories) You will need to manually kick of a github runner to test with a custom kernel version. To do that, go to the github actions tab under 'zfs-qemu' and click the drop-down for 'run workflow'. In there you will see a text box to specify the version (like '6.14'). The scripts will do their best to match the version to the newest matching version that the repos support (since they're may be multiple nightly versions of, say, '6.14'). A full list of kernel versions can be seen in the dependency stage output if you kick off a manual run. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tino Reichardt <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes #17156 (cherry picked from commit b55256e)
1 parent 280c3c3 commit a2bcf19

File tree

3 files changed

+55
-3
lines changed

3 files changed

+55
-3
lines changed

.github/workflows/scripts/qemu-3-deps-vm.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# 3) install dependencies for compiling and loading
55
#
66
# $1: OS name (like 'fedora41')
7+
# $2: (optional) Experimental Fedora kernel version, like "6.14" to
8+
# install instead of Fedora defaults.
79
######################################################################
810

911
set -eu
@@ -95,6 +97,25 @@ function tumbleweed() {
9597
echo "##[endgroup]"
9698
}
9799

100+
# $1: Kernel version to install (like '6.14rc7')
101+
function install_fedora_experimental_kernel {
102+
103+
our_version="$1"
104+
sudo dnf -y copr enable @kernel-vanilla/stable
105+
sudo dnf -y copr enable @kernel-vanilla/mainline
106+
all="$(sudo dnf list --showduplicates kernel-*)"
107+
echo "Available versions:"
108+
echo "$all"
109+
110+
# You can have a bunch of minor variants of the version we want '6.14'.
111+
# Pick the newest variant (sorted by version number).
112+
specific_version=$(echo "$all" | grep $our_version | awk '{print $2}' | sort -V | tail -n 1)
113+
list="$(echo "$all" | grep $specific_version | grep -Ev 'kernel-rt|kernel-selftests|kernel-debuginfo' | sed 's/.x86_64//g' | awk '{print $1"-"$2}')"
114+
sudo dnf install -y $list
115+
sudo dnf -y copr disable @kernel-vanilla/stable
116+
sudo dnf -y copr disable @kernel-vanilla/mainline
117+
}
118+
98119
# Install dependencies
99120
case "$1" in
100121
almalinux8)
@@ -133,6 +154,11 @@ case "$1" in
133154

134155
# Fedora 42+ moves /usr/bin/script from 'util-linux' to 'util-linux-script'
135156
sudo dnf install -y util-linux-script || true
157+
158+
# Optional: Install an experimental kernel ($2 = kernel version)
159+
if [ -n "${2:-}" ] ; then
160+
install_fedora_experimental_kernel "$2"
161+
fi
136162
;;
137163
freebsd*)
138164
freebsd

.github/workflows/scripts/qemu-3-deps.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,25 @@
33
# script on it.
44
#
55
# $1: OS name (like 'fedora41')
6+
# $2: (optional) Experimental kernel version to install on fedora,
7+
# like "6.14".
68
######################################################################
79

810
.github/workflows/scripts/qemu-wait-for-vm.sh vm0
11+
12+
# SPECIAL CASE:
13+
#
14+
# If the user passed in an experimental kernel version to test on Fedora,
15+
# we need to update the kernel version in zfs's META file to allow the
16+
# build to happen. We update our local copy of META here, since we know
17+
# it will be rsync'd up in the next step.
18+
if [ -n "${2:-}" ] ; then
19+
sed -i -E 's/Linux-Maximum: .+/Linux-Maximum: 99.99/g' META
20+
fi
21+
922
scp .github/workflows/scripts/qemu-3-deps-vm.sh zfs@vm0:qemu-3-deps-vm.sh
1023
PID=`pidof /usr/bin/qemu-system-x86_64`
11-
ssh zfs@vm0 '$HOME/qemu-3-deps-vm.sh' $1
24+
ssh zfs@vm0 '$HOME/qemu-3-deps-vm.sh' "$@"
1225
# wait for poweroff to succeed
1326
tail --pid=$PID -f /dev/null
1427
sleep 5 # avoid this: "error: Domain is already active"

.github/workflows/zfs-qemu.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ on:
1515
required: false
1616
default: false
1717
description: 'Test on CentOS 10 stream'
18+
fedora_kernel_ver:
19+
type: string
20+
required: false
21+
default: ""
22+
description: "(optional) Experimental kernel version to install on Fedora (like '6.14' or '6.13.3-0.rc3')"
1823

1924
concurrency:
2025
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@@ -48,7 +53,15 @@ jobs:
4853
else
4954
os_selection="$FULL_OS"
5055
fi
51-
os_json=$(echo ${os_selection} | jq -c)
56+
57+
if [ ${{ github.event.inputs.fedora_kernel_ver }} != "" ] ; then
58+
# They specified a custom kernel version for Fedora. Use only
59+
# Fedora runners.
60+
os_json=$(echo ${os_selection} | jq -c '[.[] | select(startswith("fedora"))]')
61+
else
62+
# Normal case
63+
os_json=$(echo ${os_selection} | jq -c)
64+
fi
5265
5366
# Add optional runners
5467
if [ "${{ github.event.inputs.include_stream9 }}" == 'true' ]; then
@@ -92,7 +105,7 @@ jobs:
92105

93106
- name: Install dependencies
94107
timeout-minutes: 20
95-
run: .github/workflows/scripts/qemu-3-deps.sh ${{ matrix.os }}
108+
run: .github/workflows/scripts/qemu-3-deps.sh ${{ matrix.os }} ${{ github.event.inputs.fedora_kernel_ver }}
96109

97110
- name: Build modules
98111
timeout-minutes: 30

0 commit comments

Comments
 (0)