mirror of
https://github.com/containers/bootc.git
synced 2026-02-05 06:45:13 +01:00
A key thing for me is that the `Justfile` should be a one-stop shop for development of the project. It can't have everything but it should answer the basic questions of "how do I build and test this project". This aligns the recently added tmt-on-GHA flow a *bit* more closely with some of that. Biggest is to use the `just build-integration-test-image` as the canonical way to build a container image with our testing stuff in it; which uses our main Dockerfile Other cleanups: - Change test script to move into tests/tmt/ as a workaround for https://github.com/teemtee/tmt/pull/3037#issuecomment-3259585271 - Change the qemu logic to use SMBIOS credentials so we don't have to carry around both a disk image and a SSH key - Change qemu to use `-snapshot` so we can reuse disks - Change the scripts to accept data via argv[1] and not environment - Drop the hardcoded testing directory and use `target/` as a generic build artifact dir Signed-off-by: Colin Walters <walters@verbum.org>
103 lines
3.2 KiB
Bash
Executable File
103 lines
3.2 KiB
Bash
Executable File
#!/bin/bash
|
|
set -xeu
|
|
# I'm a big fan of nushell for interactive use, and I want to support
|
|
# using it in our test suite because it's better than bash. First,
|
|
# enable EPEL to get it.
|
|
|
|
# Ensure this is pre-created
|
|
mkdir -p -m 0700 /var/roothome
|
|
mkdir -p ~/.config/nushell
|
|
echo '$env.config = { show_banner: false, }' > ~/.config/nushell/config.nu
|
|
touch ~/.config/nushell/env.nu
|
|
|
|
. /usr/lib/os-release
|
|
case "${ID}-${VERSION_ID}" in
|
|
"centos-9")
|
|
dnf config-manager --set-enabled crb
|
|
dnf -y install epel-release epel-next-release
|
|
dnf -y install nu
|
|
;;
|
|
"rhel-9."*)
|
|
dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
|
|
dnf -y install nu
|
|
;;
|
|
"centos-10"|"rhel-10."*)
|
|
# nu is not available in CS10
|
|
td=$(mktemp -d)
|
|
cd $td
|
|
curl -kL "https://github.com/nushell/nushell/releases/download/0.103.0/nu-0.103.0-$(uname -m)-unknown-linux-gnu.tar.gz" --output nu.tar.gz
|
|
mkdir -p nu && tar zvxf nu.tar.gz --strip-components=1 -C nu
|
|
mv nu/nu /usr/bin/nu
|
|
rm -rf nu nu.tar.gz
|
|
cd -
|
|
rm -rf "${td}"
|
|
;;
|
|
"fedora-"*)
|
|
dnf -y install nu
|
|
;;
|
|
esac
|
|
|
|
# Extra packages we install
|
|
grep -Ev -e '^#' packages.txt | xargs dnf -y install
|
|
dnf clean all
|
|
|
|
# Cloud bits
|
|
cat <<KARGEOF >> /usr/lib/bootc/kargs.d/20-console.toml
|
|
kargs = ["console=ttyS0,115200n8"]
|
|
KARGEOF
|
|
# And cloud-init stuff
|
|
ln -s ../cloud-init.target /usr/lib/systemd/system/default.target.wants
|
|
|
|
# Stock extra cleaning of logs and caches in general (mostly dnf)
|
|
rm /var/log/* /var/cache /var/lib/{dnf,rpm-state,rhsm} -rf
|
|
# And clean root's homedir
|
|
rm /var/roothome/.config -rf
|
|
cat >/usr/lib/tmpfiles.d/bootc-cloud-init.conf <<'EOF'
|
|
d /var/lib/cloud 0755 root root - -
|
|
EOF
|
|
|
|
# Fast track tmpfiles.d content from the base image, xref
|
|
# https://gitlab.com/fedora/bootc/base-images/-/merge_requests/92
|
|
if test '!' -f /usr/lib/tmpfiles.d/bootc-base-rpmstate.conf; then
|
|
cat >/usr/lib/tmpfiles.d/bootc-base-rpmstate.conf <<'EOF'
|
|
# Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=771713
|
|
d /var/lib/rpm-state 0755 - - -
|
|
EOF
|
|
fi
|
|
if ! grep -q -r var/roothome/buildinfo /usr/lib/tmpfiles.d; then
|
|
cat > /usr/lib/tmpfiles.d/bootc-contentsets.conf <<'EOF'
|
|
# Workaround for https://github.com/konflux-ci/build-tasks-dockerfiles/pull/243
|
|
d /var/roothome/buildinfo 0755 - - -
|
|
d /var/roothome/buildinfo/content_manifests 0755 - - -
|
|
# Note we don't actually try to recreate the content; this just makes the linter ignore it
|
|
f /var/roothome/buildinfo/content_manifests/content-sets.json 0644 - - -
|
|
EOF
|
|
fi
|
|
|
|
# And add missing sysusers.d entries
|
|
if ! grep -q -r sudo /usr/lib/sysusers.d; then
|
|
cat >/usr/lib/sysusers.d/bootc-sudo-workaround.conf <<'EOF'
|
|
g sudo 16
|
|
EOF
|
|
fi
|
|
|
|
# dhcpcd
|
|
if rpm -q dhcpcd &>/dev/null; then
|
|
if ! grep -q -r dhcpcd /usr/lib/sysusers.d; then
|
|
cat >/usr/lib/sysusers.d/bootc-dhcpcd-workaround.conf <<'EOF'
|
|
u dhcpcd - 'Minimalistic DHCP client' /var/lib/dhcpcd
|
|
EOF
|
|
fi
|
|
cat >/usr/lib/tmpfiles.d/bootc-dhcpd.conf <<'EOF'
|
|
d /var/lib/dhcpcd 0755 root dhcpcd - -
|
|
EOF
|
|
rm -rf /var/lib/dhcpcd
|
|
fi
|
|
# dhclient
|
|
if test -d /var/lib/dhclient; then
|
|
cat >/usr/lib/tmpfiles.d/bootc-dhclient.conf <<'EOF'
|
|
d /var/lib/dhclient 0755 root root - -
|
|
EOF
|
|
rm -rf /var/lib/dhclient
|
|
fi
|