From b55256e5bbfbe28e47fd7c6c2918a2c314c64db8 Mon Sep 17 00:00:00 2001 From: Tony Hutter Date: Tue, 13 May 2025 14:43:35 -0700 Subject: [PATCH] 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 Reviewed-by: Tino Reichardt Signed-off-by: Tony Hutter Closes #17156 --- .github/workflows/scripts/qemu-3-deps-vm.sh | 26 +++++++++++++++++++++ .github/workflows/scripts/qemu-3-deps.sh | 15 +++++++++++- .github/workflows/zfs-qemu.yml | 17 ++++++++++++-- 3 files changed, 55 insertions(+), 3 deletions(-) diff --git a/.github/workflows/scripts/qemu-3-deps-vm.sh b/.github/workflows/scripts/qemu-3-deps-vm.sh index b74303791..b10bd4da3 100755 --- a/.github/workflows/scripts/qemu-3-deps-vm.sh +++ b/.github/workflows/scripts/qemu-3-deps-vm.sh @@ -4,6 +4,8 @@ # 3) install dependencies for compiling and loading # # $1: OS name (like 'fedora41') +# $2: (optional) Experimental Fedora kernel version, like "6.14" to +# install instead of Fedora defaults. ###################################################################### set -eu @@ -95,6 +97,25 @@ function tumbleweed() { echo "##[endgroup]" } +# $1: Kernel version to install (like '6.14rc7') +function install_fedora_experimental_kernel { + + our_version="$1" + sudo dnf -y copr enable @kernel-vanilla/stable + sudo dnf -y copr enable @kernel-vanilla/mainline + all="$(sudo dnf list --showduplicates kernel-*)" + echo "Available versions:" + echo "$all" + + # You can have a bunch of minor variants of the version we want '6.14'. + # Pick the newest variant (sorted by version number). + specific_version=$(echo "$all" | grep $our_version | awk '{print $2}' | sort -V | tail -n 1) + list="$(echo "$all" | grep $specific_version | grep -Ev 'kernel-rt|kernel-selftests|kernel-debuginfo' | sed 's/.x86_64//g' | awk '{print $1"-"$2}')" + sudo dnf install -y $list + sudo dnf -y copr disable @kernel-vanilla/stable + sudo dnf -y copr disable @kernel-vanilla/mainline +} + # Install dependencies case "$1" in almalinux8) @@ -133,6 +154,11 @@ case "$1" in # Fedora 42+ moves /usr/bin/script from 'util-linux' to 'util-linux-script' sudo dnf install -y util-linux-script || true + + # Optional: Install an experimental kernel ($2 = kernel version) + if [ -n "${2:-}" ] ; then + install_fedora_experimental_kernel "$2" + fi ;; freebsd*) freebsd diff --git a/.github/workflows/scripts/qemu-3-deps.sh b/.github/workflows/scripts/qemu-3-deps.sh index 184aed85b..267ae4ad3 100755 --- a/.github/workflows/scripts/qemu-3-deps.sh +++ b/.github/workflows/scripts/qemu-3-deps.sh @@ -3,12 +3,25 @@ # script on it. # # $1: OS name (like 'fedora41') +# $2: (optional) Experimental kernel version to install on fedora, +# like "6.14". ###################################################################### .github/workflows/scripts/qemu-wait-for-vm.sh vm0 + +# SPECIAL CASE: +# +# If the user passed in an experimental kernel version to test on Fedora, +# we need to update the kernel version in zfs's META file to allow the +# build to happen. We update our local copy of META here, since we know +# it will be rsync'd up in the next step. +if [ -n "${2:-}" ] ; then + sed -i -E 's/Linux-Maximum: .+/Linux-Maximum: 99.99/g' META +fi + scp .github/workflows/scripts/qemu-3-deps-vm.sh zfs@vm0:qemu-3-deps-vm.sh PID=`pidof /usr/bin/qemu-system-x86_64` -ssh zfs@vm0 '$HOME/qemu-3-deps-vm.sh' $1 +ssh zfs@vm0 '$HOME/qemu-3-deps-vm.sh' "$@" # wait for poweroff to succeed tail --pid=$PID -f /dev/null sleep 5 # avoid this: "error: Domain is already active" diff --git a/.github/workflows/zfs-qemu.yml b/.github/workflows/zfs-qemu.yml index d4578e40a..eb4616220 100644 --- a/.github/workflows/zfs-qemu.yml +++ b/.github/workflows/zfs-qemu.yml @@ -15,6 +15,11 @@ on: required: false default: false description: 'Test on CentOS 10 stream' + fedora_kernel_ver: + type: string + required: false + default: "" + description: "(optional) Experimental kernel version to install on Fedora (like '6.14' or '6.13.3-0.rc3')" concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} @@ -48,7 +53,15 @@ jobs: else os_selection="$FULL_OS" fi - os_json=$(echo ${os_selection} | jq -c) + + if [ ${{ github.event.inputs.fedora_kernel_ver }} != "" ] ; then + # They specified a custom kernel version for Fedora. Use only + # Fedora runners. + os_json=$(echo ${os_selection} | jq -c '[.[] | select(startswith("fedora"))]') + else + # Normal case + os_json=$(echo ${os_selection} | jq -c) + fi # Add optional runners if [ "${{ github.event.inputs.include_stream9 }}" == 'true' ]; then @@ -92,7 +105,7 @@ jobs: - name: Install dependencies timeout-minutes: 20 - run: .github/workflows/scripts/qemu-3-deps.sh ${{ matrix.os }} + run: .github/workflows/scripts/qemu-3-deps.sh ${{ matrix.os }} ${{ github.event.inputs.fedora_kernel_ver }} - name: Build modules timeout-minutes: 30