CI: Add optional patch level, fix hostname on F42

In the past there have been times when we need to generate new RPMs
for an existing ZFS release.  Typically this happens when a new RHEL
version comes out and the kernel symbols no longer match.  To get
users to auto-update we just bump the patch number.  For example, we
had to create zfs-2.1.13-1 for EL8.8 and zfs-2.1.13-2 for EL8.9.

This commit adds an optional patch level text box to the github
package builder runner.

In addition, this commit also uses `hostnamectl` instead of `hostname`
for F42+ compatibility, if available.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #17638
This commit is contained in:
Tony Hutter 2025-08-15 09:21:23 -07:00
parent 3f87c9c276
commit 9cf069b366
2 changed files with 32 additions and 4 deletions

View File

@ -5,12 +5,13 @@
# #
# Usage: # Usage:
# #
# qemu-4-build-vm.sh OS [--enable-debug][--dkms][--poweroff] # qemu-4-build-vm.sh OS [--enable-debug][--dkms][--patch-level NUM]
# [--release][--repo][--tarball] # [--poweroff][--release][--repo][--tarball]
# #
# OS: OS name like 'fedora41' # OS: OS name like 'fedora41'
# --enable-debug: Build RPMs with '--enable-debug' (for testing) # --enable-debug: Build RPMs with '--enable-debug' (for testing)
# --dkms: Build DKMS RPMs as well # --dkms: Build DKMS RPMs as well
# --patch-level NUM: Use a custom patch level number for packages.
# --poweroff: Power-off the VM after building # --poweroff: Power-off the VM after building
# --release Build zfs-release*.rpm as well # --release Build zfs-release*.rpm as well
# --repo After building everything, copy RPMs into /tmp/repo # --repo After building everything, copy RPMs into /tmp/repo
@ -21,6 +22,7 @@
ENABLE_DEBUG="" ENABLE_DEBUG=""
DKMS="" DKMS=""
PATCH_LEVEL=""
POWEROFF="" POWEROFF=""
RELEASE="" RELEASE=""
REPO="" REPO=""
@ -35,6 +37,11 @@ while [[ $# -gt 0 ]]; do
DKMS=1 DKMS=1
shift shift
;; ;;
--patch-level)
PATCH_LEVEL=$2
shift
shift
;;
--poweroff) --poweroff)
POWEROFF=1 POWEROFF=1
shift shift
@ -215,6 +222,10 @@ function rpm_build_and_install() {
run ./autogen.sh run ./autogen.sh
echo "##[endgroup]" echo "##[endgroup]"
if [ -n "$PATCH_LEVEL" ] ; then
sed -i -E 's/(Release:\s+)1/\1'$PATCH_LEVEL'/g' META
fi
echo "##[group]Configure" echo "##[group]Configure"
run ./configure --enable-debuginfo $extra run ./configure --enable-debuginfo $extra
echo "##[endgroup]" echo "##[endgroup]"
@ -328,7 +339,13 @@ fi
# almalinux9.5 # almalinux9.5
# fedora42 # fedora42
source /etc/os-release source /etc/os-release
if which hostnamectl &> /dev/null ; then
# Fedora 42+ use hostnamectl
sudo hostnamectl set-hostname "$ID$VERSION_ID"
sudo hostnamectl set-hostname --pretty "$ID$VERSION_ID"
else
sudo hostname "$ID$VERSION_ID" sudo hostname "$ID$VERSION_ID"
fi
# save some sysinfo # save some sysinfo
uname -a > /var/tmp/uname.txt uname -a > /var/tmp/uname.txt

View File

@ -32,6 +32,11 @@ on:
options: options:
- "Build RPMs" - "Build RPMs"
- "Test repo" - "Test repo"
patch_level:
type: string
required: false
default: ""
description: "(optional) patch level number"
repo_url: repo_url:
type: string type: string
required: false required: false
@ -78,7 +83,13 @@ jobs:
mkdir -p /tmp/repo mkdir -p /tmp/repo
ssh zfs@vm0 '$HOME/zfs/.github/workflows/scripts/qemu-test-repo-vm.sh' ${{ github.event.inputs.repo_url }} ssh zfs@vm0 '$HOME/zfs/.github/workflows/scripts/qemu-test-repo-vm.sh' ${{ github.event.inputs.repo_url }}
else else
.github/workflows/scripts/qemu-4-build.sh --repo --release --dkms --tarball ${{ matrix.os }} EXTRA=""
if [ -n "${{ github.event.inputs.patch_level }}" ] ; then
EXTRA="--patch-level ${{ github.event.inputs.patch_level }}"
fi
.github/workflows/scripts/qemu-4-build.sh $EXTRA \
--repo --release --dkms --tarball ${{ matrix.os }}
fi fi
- name: Prepare artifacts - name: Prepare artifacts