Skip to content

Commit 91bc626

Browse files
committed
Add 'zfs-qemu-packages' workflow for RPM building
Add a new 'zfs-qemu-packages' GH workflow for manually building RPMs and test installing ZFS RPMs from a yum repo. The workflow has a dropdown menu in the Github runners tab with two options: Build RPMs - Build release RPMs and tarballs and put them into an artifact ZIP file. The directory structure used in the ZIP file mirrors the ZFS yum repo. Test repo - Test install the ZFS RPMs from the ZFS repo. On Almalinux, this will do a DKMS and KMOD test install from both the regular and testing repos. On Fedora, it will do a DKMS install from the regular repo. All test install results will be displayed in the Github runner Summary page. Note that the workflow provides an optional text box where you can specify the full URL to an alternate repo. If left blank, it will install from the default repo from the zfs-release RPM. Most developers will never need to use this workflow. It is intended to be used by the ZFS admins for building and testing releases. This commit also modularizes many of the runner scripts so they can be used by both the zfs-qemu and zfs-qemu-packages workflows. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de> Signed-off-by: Tony Hutter <hutter2@llnl.gov> Closes #17005
1 parent acfd651 commit 91bc626

15 files changed

+917
-406
lines changed

.github/workflows/checkstyle.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
run: |
2020
# for x in lxd core20 snapd; do sudo snap remove $x; done
2121
sudo apt-get purge -y snapd google-chrome-stable firefox
22-
ONLY_DEPS=1 .github/workflows/scripts/qemu-3-deps.sh ubuntu22
22+
ONLY_DEPS=1 .github/workflows/scripts/qemu-3-deps-vm.sh ubuntu22
2323
sudo apt-get install -y cppcheck devscripts mandoc pax-utils shellcheck
2424
sudo python -m pipx install --quiet flake8
2525
# confirm that the tools are installed

.github/workflows/scripts/qemu-2-start.sh

+9
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,15 @@ sudo virt-install \
220220
--disk $DISK,bus=virtio,cache=none,format=$FORMAT,driver.discard=unmap \
221221
--import --noautoconsole >/dev/null
222222

223+
# Give the VMs hostnames so we don't have to refer to them with
224+
# hardcoded IP addresses.
225+
#
226+
# vm0: Initial VM we install dependencies and build ZFS on.
227+
# vm1..2 Testing VMs
228+
for i in {0..9} ; do
229+
echo "192.168.122.1$i vm$i" | sudo tee -a /etc/hosts
230+
done
231+
223232
# in case the directory isn't there already
224233
mkdir -p $HOME/.ssh
225234

+232
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
1+
#!/usr/bin/env bash
2+
3+
######################################################################
4+
# 3) install dependencies for compiling and loading
5+
#
6+
# $1: OS name (like 'fedora41')
7+
######################################################################
8+
9+
set -eu
10+
11+
function archlinux() {
12+
echo "##[group]Running pacman -Syu"
13+
sudo btrfs filesystem resize max /
14+
sudo pacman -Syu --noconfirm
15+
echo "##[endgroup]"
16+
17+
echo "##[group]Install Development Tools"
18+
sudo pacman -Sy --noconfirm base-devel bc cpio cryptsetup dhclient dkms \
19+
fakeroot fio gdb inetutils jq less linux linux-headers lsscsi nfs-utils \
20+
parted pax perf python-packaging python-setuptools qemu-guest-agent ksh \
21+
samba sysstat rng-tools rsync wget xxhash
22+
echo "##[endgroup]"
23+
}
24+
25+
function debian() {
26+
export DEBIAN_FRONTEND="noninteractive"
27+
28+
echo "##[group]Running apt-get update+upgrade"
29+
sudo apt-get update -y
30+
sudo apt-get upgrade -y
31+
echo "##[endgroup]"
32+
33+
echo "##[group]Install Development Tools"
34+
sudo apt-get install -y \
35+
acl alien attr autoconf bc cpio cryptsetup curl dbench dh-python dkms \
36+
fakeroot fio gdb gdebi git ksh lcov isc-dhcp-client jq libacl1-dev \
37+
libaio-dev libattr1-dev libblkid-dev libcurl4-openssl-dev libdevmapper-dev \
38+
libelf-dev libffi-dev libmount-dev libpam0g-dev libselinux-dev libssl-dev \
39+
libtool libtool-bin libudev-dev libunwind-dev linux-headers-$(uname -r) \
40+
lsscsi nfs-kernel-server pamtester parted python3 python3-all-dev \
41+
python3-cffi python3-dev python3-distlib python3-packaging \
42+
python3-setuptools python3-sphinx qemu-guest-agent rng-tools rpm2cpio \
43+
rsync samba sysstat uuid-dev watchdog wget xfslibs-dev xxhash zlib1g-dev
44+
echo "##[endgroup]"
45+
}
46+
47+
function freebsd() {
48+
export ASSUME_ALWAYS_YES="YES"
49+
50+
echo "##[group]Install Development Tools"
51+
sudo pkg install -y autoconf automake autotools base64 checkbashisms fio \
52+
gdb gettext gettext-runtime git gmake gsed jq ksh93 lcov libtool lscpu \
53+
pkgconf python python3 pamtester pamtester qemu-guest-agent rsync xxhash
54+
sudo pkg install -xy \
55+
'^samba4[[:digit:]]+$' \
56+
'^py3[[:digit:]]+-cffi$' \
57+
'^py3[[:digit:]]+-sysctl$' \
58+
'^py3[[:digit:]]+-packaging$'
59+
echo "##[endgroup]"
60+
}
61+
62+
# common packages for: almalinux, centos, redhat
63+
function rhel() {
64+
echo "##[group]Running dnf update"
65+
echo "max_parallel_downloads=10" | sudo -E tee -a /etc/dnf/dnf.conf
66+
sudo dnf clean all
67+
sudo dnf update -y --setopt=fastestmirror=1 --refresh
68+
echo "##[endgroup]"
69+
70+
echo "##[group]Install Development Tools"
71+
72+
# Alma wants "Development Tools", Fedora 41 wants "development-tools"
73+
if ! sudo dnf group install -y "Development Tools" ; then
74+
echo "Trying 'development-tools' instead of 'Development Tools'"
75+
sudo dnf group install -y development-tools
76+
fi
77+
78+
sudo dnf install -y \
79+
acl attr bc bzip2 cryptsetup curl dbench dkms elfutils-libelf-devel fio \
80+
gdb git jq kernel-rpm-macros ksh libacl-devel libaio-devel \
81+
libargon2-devel libattr-devel libblkid-devel libcurl-devel libffi-devel \
82+
ncompress libselinux-devel libtirpc-devel libtool libudev-devel \
83+
libuuid-devel lsscsi mdadm nfs-utils openssl-devel pam-devel pamtester \
84+
parted perf python3 python3-cffi python3-devel python3-packaging \
85+
kernel-devel python3-setuptools qemu-guest-agent rng-tools rpcgen \
86+
rpm-build rsync samba sysstat systemd watchdog wget xfsprogs-devel xxhash \
87+
zlib-devel
88+
echo "##[endgroup]"
89+
}
90+
91+
function tumbleweed() {
92+
echo "##[group]Running zypper is TODO!"
93+
sleep 23456
94+
echo "##[endgroup]"
95+
}
96+
97+
# Install dependencies
98+
case "$1" in
99+
almalinux8)
100+
echo "##[group]Enable epel and powertools repositories"
101+
sudo dnf config-manager -y --set-enabled powertools
102+
sudo dnf install -y epel-release
103+
echo "##[endgroup]"
104+
rhel
105+
echo "##[group]Install kernel-abi-whitelists"
106+
sudo dnf install -y kernel-abi-whitelists
107+
echo "##[endgroup]"
108+
;;
109+
almalinux9|centos-stream9|centos-stream10)
110+
echo "##[group]Enable epel and crb repositories"
111+
sudo dnf config-manager -y --set-enabled crb
112+
sudo dnf install -y epel-release
113+
echo "##[endgroup]"
114+
rhel
115+
echo "##[group]Install kernel-abi-stablelists"
116+
sudo dnf install -y kernel-abi-stablelists
117+
echo "##[endgroup]"
118+
;;
119+
archlinux)
120+
archlinux
121+
;;
122+
debian*)
123+
echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections
124+
debian
125+
echo "##[group]Install Debian specific"
126+
sudo apt-get install -yq linux-perf dh-sequence-dkms
127+
echo "##[endgroup]"
128+
;;
129+
fedora*)
130+
rhel
131+
sudo dnf install -y libunwind-devel
132+
;;
133+
freebsd*)
134+
freebsd
135+
;;
136+
tumbleweed)
137+
tumbleweed
138+
;;
139+
ubuntu*)
140+
debian
141+
echo "##[group]Install Ubuntu specific"
142+
sudo apt-get install -yq linux-tools-common libtirpc-dev \
143+
linux-modules-extra-$(uname -r)
144+
if [ "$1" != "ubuntu20" ]; then
145+
sudo apt-get install -yq dh-sequence-dkms
146+
fi
147+
echo "##[endgroup]"
148+
echo "##[group]Delete Ubuntu OpenZFS modules"
149+
for i in $(find /lib/modules -name zfs -type d); do sudo rm -rvf $i; done
150+
echo "##[endgroup]"
151+
;;
152+
esac
153+
154+
# This script is used for checkstyle + zloop deps also.
155+
# Install only the needed packages and exit - when used this way.
156+
test -z "${ONLY_DEPS:-}" || exit 0
157+
158+
# Start services
159+
echo "##[group]Enable services"
160+
case "$1" in
161+
freebsd*)
162+
# add virtio things
163+
echo 'virtio_load="YES"' | sudo -E tee -a /boot/loader.conf
164+
for i in balloon blk console random scsi; do
165+
echo "virtio_${i}_load=\"YES\"" | sudo -E tee -a /boot/loader.conf
166+
done
167+
echo "fdescfs /dev/fd fdescfs rw 0 0" | sudo -E tee -a /etc/fstab
168+
sudo -E mount /dev/fd
169+
sudo -E touch /etc/zfs/exports
170+
sudo -E sysrc mountd_flags="/etc/zfs/exports"
171+
echo '[global]' | sudo -E tee /usr/local/etc/smb4.conf >/dev/null
172+
sudo -E service nfsd enable
173+
sudo -E service qemu-guest-agent enable
174+
sudo -E service samba_server enable
175+
;;
176+
debian*|ubuntu*)
177+
sudo -E systemctl enable nfs-kernel-server
178+
sudo -E systemctl enable qemu-guest-agent
179+
sudo -E systemctl enable smbd
180+
;;
181+
*)
182+
# All other linux distros
183+
sudo -E systemctl enable nfs-server
184+
sudo -E systemctl enable qemu-guest-agent
185+
sudo -E systemctl enable smb
186+
;;
187+
esac
188+
echo "##[endgroup]"
189+
190+
# Setup Kernel cmdline
191+
CMDLINE="console=tty0 console=ttyS0,115200n8"
192+
CMDLINE="$CMDLINE selinux=0"
193+
CMDLINE="$CMDLINE random.trust_cpu=on"
194+
CMDLINE="$CMDLINE no_timer_check"
195+
case "$1" in
196+
almalinux*|centos*|fedora*)
197+
GRUB_CFG="/boot/grub2/grub.cfg"
198+
GRUB_MKCONFIG="grub2-mkconfig"
199+
CMDLINE="$CMDLINE biosdevname=0 net.ifnames=0"
200+
echo 'GRUB_SERIAL_COMMAND="serial --speed=115200"' \
201+
| sudo tee -a /etc/default/grub >/dev/null
202+
;;
203+
ubuntu24)
204+
GRUB_CFG="/boot/grub/grub.cfg"
205+
GRUB_MKCONFIG="grub-mkconfig"
206+
echo 'GRUB_DISABLE_OS_PROBER="false"' \
207+
| sudo tee -a /etc/default/grub >/dev/null
208+
;;
209+
*)
210+
GRUB_CFG="/boot/grub/grub.cfg"
211+
GRUB_MKCONFIG="grub-mkconfig"
212+
;;
213+
esac
214+
215+
case "$1" in
216+
archlinux|freebsd*)
217+
true
218+
;;
219+
*)
220+
echo "##[group]Edit kernel cmdline"
221+
sudo sed -i -e '/^GRUB_CMDLINE_LINUX/d' /etc/default/grub || true
222+
echo "GRUB_CMDLINE_LINUX=\"$CMDLINE\"" \
223+
| sudo tee -a /etc/default/grub >/dev/null
224+
sudo $GRUB_MKCONFIG -o $GRUB_CFG
225+
echo "##[endgroup]"
226+
;;
227+
esac
228+
229+
# reset cloud-init configuration and poweroff
230+
sudo cloud-init clean --logs
231+
sleep 2 && sudo poweroff &
232+
exit 0

0 commit comments

Comments
 (0)