Skip to content

Commit a76b33b

Browse files
committed
Add 'zfs-qemu-packages' workflow for RPM building
Add a new 'zfs-qemu-packages' GH workflow to manually build RPMs and test install 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 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 (http://download.zfsonlinux.org). Most developers will never need to use this workflow. It will be used by 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. Signed-off-by: Tony Hutter <[email protected]>
1 parent 3420571 commit a76b33b

14 files changed

+918
-406
lines changed

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

Lines changed: 9 additions & 0 deletions
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

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
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+
;;
132+
freebsd*)
133+
freebsd
134+
;;
135+
tumbleweed)
136+
tumbleweed
137+
;;
138+
ubuntu*)
139+
debian
140+
echo "##[group]Install Ubuntu specific"
141+
sudo apt-get install -yq linux-tools-common libtirpc-dev \
142+
linux-modules-extra-$(uname -r)
143+
if [ "$1" != "ubuntu20" ]; then
144+
sudo apt-get install -yq dh-sequence-dkms
145+
fi
146+
echo "##[endgroup]"
147+
echo "##[group]Delete Ubuntu OpenZFS modules"
148+
for i in $(find /lib/modules -name zfs -type d); do sudo rm -rvf $i; done
149+
echo "##[endgroup]"
150+
;;
151+
esac
152+
153+
# This script is used for checkstyle + zloop deps also.
154+
# Install only the needed packages and exit - when used this way.
155+
test -z "${ONLY_DEPS:-}" || exit 0
156+
157+
# Start services
158+
echo "##[group]Enable services"
159+
case "$1" in
160+
freebsd*)
161+
# add virtio things
162+
echo 'virtio_load="YES"' | sudo -E tee -a /boot/loader.conf
163+
for i in balloon blk console random scsi; do
164+
echo "virtio_${i}_load=\"YES\"" | sudo -E tee -a /boot/loader.conf
165+
done
166+
echo "fdescfs /dev/fd fdescfs rw 0 0" | sudo -E tee -a /etc/fstab
167+
sudo -E mount /dev/fd
168+
sudo -E touch /etc/zfs/exports
169+
sudo -E sysrc mountd_flags="/etc/zfs/exports"
170+
echo '[global]' | sudo -E tee /usr/local/etc/smb4.conf >/dev/null
171+
sudo -E service nfsd enable
172+
sudo -E service qemu-guest-agent enable
173+
sudo -E service samba_server enable
174+
;;
175+
debian*|ubuntu*)
176+
sudo -E systemctl enable nfs-kernel-server
177+
sudo -E systemctl enable qemu-guest-agent
178+
sudo -E systemctl enable smbd
179+
;;
180+
*)
181+
# All other linux distros
182+
sudo -E systemctl enable nfs-server
183+
sudo -E systemctl enable qemu-guest-agent
184+
sudo -E systemctl enable smb
185+
;;
186+
esac
187+
echo "##[endgroup]"
188+
189+
# Setup Kernel cmdline
190+
CMDLINE="console=tty0 console=ttyS0,115200n8"
191+
CMDLINE="$CMDLINE selinux=0"
192+
CMDLINE="$CMDLINE random.trust_cpu=on"
193+
CMDLINE="$CMDLINE no_timer_check"
194+
case "$1" in
195+
almalinux*|centos*|fedora*)
196+
GRUB_CFG="/boot/grub2/grub.cfg"
197+
GRUB_MKCONFIG="grub2-mkconfig"
198+
CMDLINE="$CMDLINE biosdevname=0 net.ifnames=0"
199+
echo 'GRUB_SERIAL_COMMAND="serial --speed=115200"' \
200+
| sudo tee -a /etc/default/grub >/dev/null
201+
;;
202+
ubuntu24)
203+
GRUB_CFG="/boot/grub/grub.cfg"
204+
GRUB_MKCONFIG="grub-mkconfig"
205+
echo 'GRUB_DISABLE_OS_PROBER="false"' \
206+
| sudo tee -a /etc/default/grub >/dev/null
207+
;;
208+
*)
209+
GRUB_CFG="/boot/grub/grub.cfg"
210+
GRUB_MKCONFIG="grub-mkconfig"
211+
;;
212+
esac
213+
214+
case "$1" in
215+
archlinux|freebsd*)
216+
true
217+
;;
218+
*)
219+
echo "##[group]Edit kernel cmdline"
220+
sudo sed -i -e '/^GRUB_CMDLINE_LINUX/d' /etc/default/grub || true
221+
echo "GRUB_CMDLINE_LINUX=\"$CMDLINE\"" \
222+
| sudo tee -a /etc/default/grub >/dev/null
223+
sudo $GRUB_MKCONFIG -o $GRUB_CFG
224+
echo "##[endgroup]"
225+
;;
226+
esac
227+
228+
# reset cloud-init configuration and poweroff
229+
sudo cloud-init clean --logs
230+
sleep 2 && sudo poweroff &
231+
exit 0

0 commit comments

Comments
 (0)