Skip to content

Commit

Permalink
feat(ci): Enable Docker Building, GHA Log Grouping (#2114)
Browse files Browse the repository at this point in the history
Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>
  • Loading branch information
m2Giles authored Jan 6, 2025
1 parent 216d7d3 commit 54d8022
Show file tree
Hide file tree
Showing 23 changed files with 229 additions and 110 deletions.
224 changes: 129 additions & 95 deletions Justfile

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions build_files/base/00-image-info.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

echo "::group:: ===$(basename "$0")==="

set -ouex pipefail

IMAGE_PRETTY_NAME="Bluefin"
Expand Down Expand Up @@ -51,3 +53,5 @@ fi

# Fix issues caused by ID no longer being fedora
sed -i "s/^EFIDIR=.*/EFIDIR=\"fedora\"/" /usr/sbin/grub2-switch-to-blscfg

echo "::endgroup::"
4 changes: 4 additions & 0 deletions build_files/base/01-build-fix.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/bash

echo "::group:: ===$(basename "$0")==="

set -eoux pipefail

# This script provides fixes to packages known to have caused build skew.
Expand Down Expand Up @@ -50,3 +52,5 @@ rpm-ostree override replace \
rpm-ostree override remove \
glibc32 \
|| true

echo "::endgroup::"
5 changes: 4 additions & 1 deletion build_files/base/02-install-copr-repos.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

#!/usr/bin/bash

echo "::group:: ===$(basename "$0")==="

set -eoux pipefail

# Add Staging repo
Expand All @@ -13,3 +14,5 @@ curl --retry 3 -Lo /etc/yum.repos.d/_copr_sentry-switcheroo-control_discrete.rep

# Add Nerd Fonts Repo
curl --retry 3 -Lo /etc/yum.repos.d/_copr_che-nerd-fonts-"$(rpm -E %fedora)".repo https://copr.fedorainfracloud.org/coprs/che/nerd-fonts/repo/fedora-"$(rpm -E %fedora)"/che-nerd-fonts-fedora-"$(rpm -E %fedora)".repo

echo "::endgroup::"
4 changes: 4 additions & 0 deletions build_files/base/03-install-kernel-akmods.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/bash

echo "::group:: ===$(basename "$0")==="

set -eoux pipefail

# Remove Existing Kernel
Expand Down Expand Up @@ -89,3 +91,5 @@ if [[ ${AKMODS_FLAVOR} =~ coreos ]]; then
depmod -a -v "${KERNEL}"
echo "zfs" > /usr/lib/modules-load.d/zfs.conf
fi

echo "::endgroup::"
4 changes: 4 additions & 0 deletions build_files/base/04-packages.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/bash

echo "::group:: ===$(basename "$0")==="

set -ouex pipefail

# build list of all packages requested for inclusion
Expand Down Expand Up @@ -49,3 +51,5 @@ if [[ "${#INSTALLED_EXCLUDED_PACKAGES[@]}" -gt 0 ]]; then
rpm-ostree override remove \
${INSTALLED_EXCLUDED_PACKAGES[@]}
fi

echo "::endgroup::"
4 changes: 4 additions & 0 deletions build_files/base/05-override-install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/bash

echo "::group:: ===$(basename "$0")==="

set -eoux pipefail

# Patched shells
Expand Down Expand Up @@ -56,3 +58,5 @@ mv -f /tmp/ublue-update.toml /usr/etc/ublue-update/ublue-update.toml
# Register Fonts
fc-cache -f /usr/share/fonts/ubuntu
fc-cache -f /usr/share/fonts/inter

echo "::endgroup::"
4 changes: 4 additions & 0 deletions build_files/base/07-base-image-changes.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/bash

echo "::group:: ===$(basename "$0")==="

set -ouex pipefail

# Remove desktop entries
Expand Down Expand Up @@ -51,3 +53,5 @@ glib-compile-schemas /usr/share/glib-2.0/schemas &>/dev/null

# Watermark for Plymouth
cp /usr/share/plymouth/themes/spinner/{silverblue-,}watermark.png

echo "::endgroup::"
4 changes: 4 additions & 0 deletions build_files/base/08-firmware.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/bash

echo "::group:: ===$(basename "$0")==="

set -eoux pipefail

mkdir -p /tmp/mediatek-firmware
Expand All @@ -9,3 +11,5 @@ xz --check=crc32 /tmp/mediatek-firmware/WIFI_MT7922_patch_mcu_1_1_hdr.bin
xz --check=crc32 /tmp/mediatek-firmware/WIFI_RAM_CODE_MT7922_1.bin
mv -vf /tmp/mediatek-firmware/* /usr/lib/firmware/mediatek/
rm -rf /tmp/mediatek-firmware

echo "::endgroup::"
3 changes: 3 additions & 0 deletions build_files/base/09-hwe-additions.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/bash

echo "::group:: ===$(basename "$0")==="

set -eoux pipefail

if [[ "${IMAGE_NAME}" =~ hwe ]]; then
Expand Down Expand Up @@ -74,3 +76,4 @@ pinctrl_alderlake
pinctrl_meteorlake
EOF

echo "::endgroup::"
4 changes: 4 additions & 0 deletions build_files/base/10-brew.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/bash

echo "::group:: ===$(basename "$0")==="

set -xeou pipefail

# Convince the installer we are in CI
Expand All @@ -14,3 +16,5 @@ curl --retry 3 -Lo /tmp/brew-install https://raw.githubusercontent.com/Homebrew/
chmod +x /tmp/brew-install
/tmp/brew-install
tar --zstd -cvf /usr/share/homebrew.tar.zst /home/linuxbrew/.linuxbrew

echo "::endgroup::"
4 changes: 4 additions & 0 deletions build_files/base/16-bootc.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/usr/bin/bash

echo "::group:: ===$(basename "$0")==="

if [ "$FEDORA_MAJOR_VERSION" -eq "40" ]; then
/usr/bin/bootupctl backend generate-update-metadata
fi

echo "::endgroup::"
4 changes: 4 additions & 0 deletions build_files/base/17-cleanup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/bash

echo "::group:: ===$(basename "$0")==="

set -eoux pipefail

# Setup Systemd
Expand Down Expand Up @@ -40,3 +42,5 @@ done
if [ -f /etc/yum.repos.d/fedora-coreos-pool.repo ]; then
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/fedora-coreos-pool.repo
fi

echo "::endgroup::"
13 changes: 8 additions & 5 deletions build_files/base/18-workarounds.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
#!/bin/sh
#!/usr/bin/bash

echo "::group:: ===$(basename "$0")==="

set -eoux pipefail

# alternatives cannot create symlinks on its own during a container build
if [[ -f /usr/bin/ld.bfd ]]; then
if [[ -f "/usr/bin/ld.bfd" ]]; then
ln -sf /usr/bin/ld.bfd /etc/alternatives/ld && ln -sf /etc/alternatives/ld /usr/bin/ld
fi


## Pins and Overrides
## Use this section to pin packages in order to avoid regressions
# Remember to leave a note with rationale/link to issue for each pin!
# Remember to leave a note with rationale/link to issue for each pin!
#
# Example:
#if [ "$FEDORA_MAJOR_VERSION" -eq "41" ]; then
# Workaround pkcs11-provider regression, see issue #1943
# rpm-ostree override replace https://bodhi.fedoraproject.org/updates/FEDORA-2024-dd2e9fb225
# rpm-ostree override replace https://bodhi.fedoraproject.org/updates/FEDORA-2024-dd2e9fb225
#fi

echo "::endgroup::"
4 changes: 4 additions & 0 deletions build_files/base/19-initramfs.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/bash

echo "::group:: ===$(basename "$0")==="

set -oue pipefail

if [[ "${AKMODS_FLAVOR}" == "surface" ]]; then
Expand All @@ -11,3 +13,5 @@ fi
QUALIFIED_KERNEL="$(rpm -qa | grep -P 'kernel-(|'"$KERNEL_SUFFIX"'-)(\d+\.\d+\.\d+)' | sed -E 's/kernel-(|'"$KERNEL_SUFFIX"'-)//')"
/usr/libexec/rpm-ostree/wrapped/dracut --no-hostonly --kver "$QUALIFIED_KERNEL" --reproducible -v --add ostree -f "/lib/modules/$QUALIFIED_KERNEL/initramfs.img"
chmod 0600 "/lib/modules/$QUALIFIED_KERNEL/initramfs.img"

echo "::endgroup::"
4 changes: 4 additions & 0 deletions build_files/dx/01-install-copr-repos-dx.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/bash

echo "::group:: ===$(basename "$0")==="

set -eoux pipefail

#incus, lxc, lxd
Expand Down Expand Up @@ -31,3 +33,5 @@ curl --retry 3 -Lo /etc/yum.repos.d/hikariknight-looking-glass-kvmfr-fedora-"${F
# Podman-bootc
curl --retry 3 -Lo /etc/yum.repos.d/gmaglione-podman-bootc-fedora-"${FEDORA_MAJOR_VERSION}".repo \
https://copr.fedorainfracloud.org/coprs/gmaglione/podman-bootc/repo/fedora-"${FEDORA_MAJOR_VERSION}"/gmaglione-podman-bootc-fedora-"${FEDORA_MAJOR_VERSION}".repo

echo "::endgroup::"
10 changes: 7 additions & 3 deletions build_files/dx/02-install-kernel-akmods-dx.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
#!/usr/bin/bash

echo "::group:: ===$(basename "$0")==="

set -ouex pipefail

sed -i 's@enabled=0@enabled=1@g' /etc/yum.repos.d/_copr_ublue-os-akmods.repo

# Fetch Kernel RPMS
skopeo copy --retry-times 3 docker://ghcr.io/ublue-os/"${AKMODS_FLAVOR}"-kernel:"$(rpm -E %fedora)"-"${KERNEL}" dir:/tmp/kernel-rpms
KERNEL_TARGZ=$(jq -r '.layers[].digest' < /tmp/kernel-rpms/manifest.json | cut -d : -f 2)
KERNEL_TARGZ=$(jq -r '.layers[].digest' </tmp/kernel-rpms/manifest.json | cut -d : -f 2)
tar -xvzf /tmp/kernel-rpms/"$KERNEL_TARGZ" -C /
mv /tmp/rpms/* /tmp/kernel-rpms/

if [[ -z "$(grep kernel-devel <<< $(rpm -qa))" ]]; then
if [[ -z "$(grep kernel-devel <<<$(rpm -qa))" ]]; then
rpm-ostree install /tmp/kernel-rpms/kernel-devel-*.rpm
fi

# Fetch AKMODS RPMS
skopeo copy --retry-times 3 docker://ghcr.io/ublue-os/akmods:"${AKMODS_FLAVOR}"-"$(rpm -E %fedora)"-"${KERNEL}" dir:/tmp/akmods
AKMODS_TARGZ=$(jq -r '.layers[].digest' < /tmp/akmods/manifest.json | cut -d : -f 2)
AKMODS_TARGZ=$(jq -r '.layers[].digest' </tmp/akmods/manifest.json | cut -d : -f 2)
tar -xvzf /tmp/akmods/"$AKMODS_TARGZ" -C /tmp/
mv /tmp/rpms/* /tmp/akmods/

# Install RPMS
rpm-ostree install /tmp/akmods/kmods/*kvmfr*.rpm

echo "::endgroup::"
4 changes: 4 additions & 0 deletions build_files/dx/03-packages-dx.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/bash

echo "::group:: ===$(basename "$0")==="

set -ouex pipefail

# build list of all packages requested for inclusion
Expand Down Expand Up @@ -53,3 +55,5 @@ if [[ "${#INSTALLED_EXCLUDED_PACKAGES[@]}" -gt 0 ]]; then
rpm-ostree override remove \
${INSTALLED_EXCLUDED_PACKAGES[@]}
fi

echo "::endgroup::"
4 changes: 4 additions & 0 deletions build_files/dx/04-override-install-dx.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/bash

echo "::group:: ===$(basename "$0")==="

set -eoux pipefail

curl --retry 3 -Lo /tmp/kind "https://github.com/kubernetes-sigs/kind/releases/latest/download/kind-$(uname)-amd64"
Expand All @@ -17,3 +19,5 @@ rm -rf /tmp/monaspace-font*

fc-cache -f /usr/share/fonts/monaspace
fc-cache --system-only --really-force --verbose

echo "::endgroup::"
4 changes: 4 additions & 0 deletions build_files/dx/09-cleanup-dx.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/bash

echo "::group:: ===$(basename "$0")==="

set -eoux pipefail

systemctl enable docker.socket
Expand Down Expand Up @@ -27,3 +29,5 @@ sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/_copr_ublue-os-akmods.repo
for i in /etc/yum.repos.d/rpmfusion-*; do
sed -i 's@enabled=1@enabled=0@g' "$i"
done

echo "::endgroup::"
13 changes: 8 additions & 5 deletions build_files/shared/build-base.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/bash

set -eoux pipefail
set -eou pipefail

echo "::group:: Copy Files"
# Make Alternatives Directory
mkdir -p /var/lib/alternatives

Expand All @@ -11,6 +12,7 @@ cp /ctx/packages.json /tmp/packages.json
cp /ctx/system_files/shared/etc/ublue-update/ublue-update.toml /tmp/ublue-update.toml
rsync -rvK /ctx/system_files/shared/ /
rsync -rvK /ctx/system_files/"${BASE_IMAGE_NAME}"/ /
echo "::endgroup::"

# Generate image-info.json
/ctx/build_files/base/00-image-info.sh
Expand Down Expand Up @@ -42,7 +44,6 @@ rsync -rvK /ctx/system_files/"${BASE_IMAGE_NAME}"/ /
# Install Brew
/ctx/build_files/base/10-brew.sh


## late stage changes

# Make sure Bootc works
Expand All @@ -58,9 +59,11 @@ rsync -rvK /ctx/system_files/"${BASE_IMAGE_NAME}"/ /
/ctx/build_files/base/19-initramfs.sh

# Clean Up
echo "::group:: Cleanup"
mv /var/lib/alternatives /staged-alternatives
/ctx/build_files/shared/clean-stage.sh
mkdir -p /var/lib && mv /staged-alternatives /var/lib/alternatives && \
mkdir -p /var/tmp && \
chmod -R 1777 /var/tmp
mkdir -p /var/lib && mv /staged-alternatives /var/lib/alternatives &&
mkdir -p /var/tmp &&
chmod -R 1777 /var/tmp
ostree container commit
echo "::endgroup::"
6 changes: 5 additions & 1 deletion build_files/shared/build-dx.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#!/usr/bin/bash

set -eoux pipefail
set -eou pipefail

echo "::group:: Copy Files"
# Make Alternatives Directory
mkdir -p /var/lib/alternatives

# Copy Files to Image
cp /ctx/packages.json /tmp/packages.json
rsync -rvK /ctx/system_files/dx/ /
echo "::endgroup::"

# Apply IP Forwarding before installing Docker to prevent messing with LXC networking
sysctl -p
Expand All @@ -31,9 +33,11 @@ sysctl -p
/ctx/build_files/dx/09-cleanup-dx.sh

# Clean Up
echo "::group:: Cleanup"
mv /var/lib/alternatives /staged-alternatives
/ctx/build_files/shared/clean-stage.sh
mkdir -p /var/lib && mv /staged-alternatives /var/lib/alternatives && \
mkdir -p /var/tmp && \
chmod -R 1777 /var/tmp
ostree container commit
echo "::endgroup::"
5 changes: 5 additions & 0 deletions build_files/shared/clean-stage.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#!/usr/bin/bash

echo "::group:: ===$(basename "$0")==="

set -eoux pipefail

shopt -s extglob

rm -rf /tmp/* || true
rm -rf /var/!(cache)
rm -rf /var/cache/!(rpm-ostree)

echo "::endgroup::"

0 comments on commit 54d8022

Please sign in to comment.