diff --git a/.cirrus.yml b/.cirrus.yml index dba912fc..a11fd349 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -192,6 +192,9 @@ cache_images_task: - <<: *cache_image env: PACKER_BUILDS: "prior-fedora" + - <<: *cache_image + env: + PACKER_BUILDS: "fedora-netavark" - <<: *cache_image env: PACKER_BUILDS: "ubuntu" @@ -228,6 +231,7 @@ imgts_task: ubuntu-b${IMG_SFX} fedora-c${IMG_SFX} prior-fedora-c${IMG_SFX} + fedora-netavark-c${IMG_SFX} ubuntu-c${IMG_SFX} clone_script: &noop mkdir -p "${CIRRUS_WORKING_DIR}" # source is not needed script: "/usr/local/bin/entrypoint.sh" diff --git a/cache_images/fedora-netavark_packaging.sh b/cache_images/fedora-netavark_packaging.sh new file mode 100644 index 00000000..a9a96cbe --- /dev/null +++ b/cache_images/fedora-netavark_packaging.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +# This script is called from fedora_setup.sh and various Dockerfiles. +# It's not intended to be used outside of those contexts. It assumes the lib.sh +# library has already been sourced, and that all "ground-up" package-related activity +# needs to be done, including repository setup and initial update. + +set -e + +SCRIPT_FILEPATH=$(realpath "${BASH_SOURCE[0]}") +SCRIPT_DIRPATH=$(dirname "$SCRIPT_FILEPATH") +REPO_DIRPATH=$(realpath "$SCRIPT_DIRPATH/../") + +# shellcheck source=./lib.sh +source "$REPO_DIRPATH/lib.sh" + +msg "Updating/Installing repos and packages for $OS_REL_VER" + +bigto ooe.sh $SUDO dnf update -y + +INSTALL_PACKAGES=(\ + bats + bridge-utils + bzip2 + cargo + clippy + curl + dbus-daemon + findutils + firewalld + git + gzip + hostname + iproute + iptables + iputils + jq + kernel-modules + make + nftables + nmap-ncat + openssl + openssl-devel + policycoreutils + redhat-rpm-config + rpm-build + rsync + rust + rustfmt + sed + tar + time + xz + zip +) + +msg "Installing general build/test dependencies" +bigto $SUDO dnf install -y "${INSTALL_PACKAGES[@]}" + +msg "Installing netavark-specific toolchain dependencies" +export CARGO_HOME="/var/cache/cargo" # must match .cirrus.yml in netavark repo +$SUDO env CARGO_HOME=$CARGO_HOME cargo install mandown sccache + +# It was observed in F33, dnf install doesn't always get you the latest/greatest +lilto $SUDO dnf update -y diff --git a/cache_images/fedora_setup.sh b/cache_images/fedora_setup.sh index bf2cb5f5..2654844a 100644 --- a/cache_images/fedora_setup.sh +++ b/cache_images/fedora_setup.sh @@ -21,25 +21,36 @@ source "$REPO_DIRPATH/lib.sh" # for both VM and container image build workflows. req_env_vars PACKER_BUILD_NAME -bash $SCRIPT_DIRPATH/fedora_packaging.sh - -if ! ((CONTAINER)); then - msg "Enabling cgroup management from containers" - ooe.sh $SUDO setsebool -P container_manage_cgroup true +# shellcheck disable=SC2154 +if [[ "$PACKER_BUILD_NAME" =~ "netavark" ]]; then + bash $SCRIPT_DIRPATH/fedora-netavark_packaging.sh +else + bash $SCRIPT_DIRPATH/fedora_packaging.sh fi -# shellcheck disable=SC2154 -if ! ((CONTAINER)) && [[ "$PACKER_BUILD_NAME" =~ prior ]]; then - warn "Disabling CgroupsV2 kernel command-line option for systemd" - SEDCMD='s/^GRUB_CMDLINE_LINUX="(.*)"/GRUB_CMDLINE_LINUX="\1 systemd.unified_cgroup_hierarchy=0"/' - ooe.sh $SUDO sed -re "$SEDCMD" -i /etc/default/grub - # This is always a symlink to the correct location under /boot/... - ooe.sh $SUDO grub2-mkconfig -o $($SUDO realpath --physical /etc/grub2.cfg) - # This is needed to update the /boot/loader/entries/... file to match grub - # config (bug?). Discovered Jul 28, 2021 on newly build F33 images. Never - # a problem before this point :( - ooe.sh $SUDO grubby --grub2 --update-kernel=$($SUDO grubby --default-kernel) \ - --args="systemd.unified_cgroup_hierarchy=0" +# Only on VMs +if ! ((CONTAINER)); then + if [[ ! "$PACKER_BUILD_NAME" =~ netavark ]]; then + msg "Enabling cgroup management from containers" + ooe.sh $SUDO setsebool -P container_manage_cgroup true + else + msg "Setting up VM for netavark testing" + echo -e '# Added during VM Image build\nsctp' | + $SUDO tee /etc/modules-load.d/netavark_ci_sctp + fi + + if [[ "$PACKER_BUILD_NAME" =~ prior ]]; then + warn "Disabling CgroupsV2 kernel command-line option for systemd" + SEDCMD='s/^GRUB_CMDLINE_LINUX="(.*)"/GRUB_CMDLINE_LINUX="\1 systemd.unified_cgroup_hierarchy=0"/' + ooe.sh $SUDO sed -re "$SEDCMD" -i /etc/default/grub + # This is always a symlink to the correct location under /boot/... + ooe.sh $SUDO grub2-mkconfig -o $($SUDO realpath --physical /etc/grub2.cfg) + # This is needed to update the /boot/loader/entries/... file to match grub + # config (bug?). Discovered Jul 28, 2021 on newly build F33 images. Never + # a problem before this point :( + ooe.sh $SUDO grubby --grub2 --update-kernel=$($SUDO grubby --default-kernel) \ + --args="systemd.unified_cgroup_hierarchy=0" + fi fi nm_ignore_cni diff --git a/cache_images/gce.yml b/cache_images/gce.yml index d0e2891c..ac360b84 100644 --- a/cache_images/gce.yml +++ b/cache_images/gce.yml @@ -50,6 +50,11 @@ builders: name: 'prior-fedora' source_image_family: 'prior-fedora-base' + - <<: *gce_hosted_image + name: 'fedora-netavark' + source_image: 'fedora-b{{user `IMG_SFX`}}' + source_image_family: 'fedora-base' + provisioners: - type: 'shell' inline: @@ -60,7 +65,7 @@ provisioners: source: '{{ pwd }}/' destination: "/tmp/automation_images" - - only: ['fedora', 'prior-fedora'] + - only: ['fedora', 'prior-fedora', 'fedora-netavark'] type: 'shell' inline: - 'set -e'