Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions .github/workflows/build-iso-bootc-experimental.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Build Experimental bootc ISOs

# Experimental fisherman/bootcDirect ISO variant (resurrected from PR #61,
# reverted in #66; lives under bootc-iso/). Published as clearly-labeled
# workflow artifacts ONLY — deliberately NOT wired into the scheduled or
# production publish workflows or releases, so both installer paths can be
# compared side by side for a while.
on:
workflow_dispatch:
# Temporary: branch-scoped push trigger so the workflow can run before the
# file exists on main (workflow_dispatch only resolves default-branch
# workflows). Remove before merging.
push:
branches: [claude/resurrect-bootc-iso]
paths: ['bootc-iso/**', '.github/workflows/*bootc*.yml']

permissions:
contents: read
packages: read

jobs:
build:
name: Build ${{ matrix.target }} (experimental bootc)
runs-on: ubuntu-24.04
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
target: [bluefin, bluefin-lts]
defaults:
run:
working-directory: bootc-iso

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Free disk space
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
with:
tool-cache: true

- name: Install dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y just podman buildah mtools xorriso -qq

- name: Log in to GHCR
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | \
sudo podman login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Configure podman storage (intelligent driver selection)
run: bash scripts/configure_podman_storage.sh

- name: Build ISO
run: |
sudo mkdir -p /var/iso-build
sudo $(command -v just) installer_channel=stable compression=release \
output_dir=/var/iso-build iso-sd-boot ${{ matrix.target }}

- name: Rename ISO with experimental-bootc suffix
run: |
mkdir -p output
sudo mv "/var/iso-build/${{ matrix.target }}-live.iso" \
"output/${{ matrix.target }}-experimental-bootc-x86_64.iso"
sudo chown -R "$USER:$(id -gn)" output/
sha256sum "output/${{ matrix.target }}-experimental-bootc-x86_64.iso" \
> "output/${{ matrix.target }}-experimental-bootc-x86_64.iso-CHECKSUM"

- name: Upload ISO artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}-experimental-bootc-x86_64
path: |
bootc-iso/output/${{ matrix.target }}-experimental-bootc-x86_64.iso
bootc-iso/output/${{ matrix.target }}-experimental-bootc-x86_64.iso-CHECKSUM
if-no-files-found: error
retention-days: 14
compression-level: 0
210 changes: 210 additions & 0 deletions .github/workflows/test-luks-install-bootc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
name: LUKS Install End-to-End Test (bootc-iso, experimental)

# Experimental resurrection of the bootc-installer ISO builder from PR #61
# (reverted in #66). Lives entirely under bootc-iso/ and is dispatch-only —
# it must never run on pull_request or a schedule.
on:
workflow_dispatch:
# Weekly regression run (matches the cadence from the original #61) so
# LUKS install+unlock coverage does not rot between manual dispatches.
schedule:
- cron: '0 4 * * 1'
# Temporary: branch-scoped push trigger so the workflow can run before the
# file exists on main (workflow_dispatch only resolves default-branch
# workflows). Remove before merging.
push:
branches: [claude/resurrect-bootc-iso]
paths: ['bootc-iso/**', '.github/workflows/*bootc*.yml']

permissions:
issues: write
pull-requests: write
contents: write
actions: read

jobs:
luks-e2e:
name: LUKS E2E (${{ matrix.target }}, ${{ matrix.installer_channel }})
runs-on: ubuntu-24.04
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
installer_channel: [stable]
target: [bluefin, bluefin-lts]
defaults:
run:
working-directory: bootc-iso

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Ensure screenshots branch exists
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
run: |
if gh api "/repos/${REPO}/git/refs/heads/ci-screenshots" &>/dev/null; then
echo "ci-screenshots branch already exists"
else
echo "Creating ci-screenshots branch..."
DEFAULT=$(gh api "/repos/${REPO}" --jq '.default_branch')
SHA=$(gh api "/repos/${REPO}/git/refs/heads/${DEFAULT}" --jq '.object.sha')
gh api --method POST "/repos/${REPO}/git/refs" \
-f "ref=refs/heads/ci-screenshots" \
-f "sha=${SHA}"
echo "ci-screenshots branch created from ${DEFAULT}"
fi

- name: Free disk space
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
with:
tool-cache: true

- name: Install dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y \
just podman buildah mtools xorriso \
qemu-system-x86 ovmf socat sshpass \
imagemagick -qq

- name: Log in to GHCR
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | \
sudo podman login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Configure podman storage (intelligent driver selection)
run: bash scripts/configure_podman_storage.sh

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'

# Upstream fisherman main now natively supports direct-mode
# `bootc install --source-imgref containers-storage:` (the fix that
# previously lived only in the fix/overlay-driver-for-ostree-bootc-install
# fork branch), so build from main instead of the fork.
- name: Clone fisherman
run: |
git clone https://github.com/projectbluefin/fisherman.git \
--branch main \
--depth 1 \
/tmp/fisherman

- name: Build debug ISO
id: build
run: |
START=$(date +%s)
sudo mkdir -p /var/iso-build
sudo $(command -v just) debug=1 installer_channel=${{ matrix.installer_channel }} output_dir=/var/iso-build iso-sd-boot ${{ matrix.target }}
mkdir -p output
sudo cp /var/iso-build/*.iso output/ 2>/dev/null || true
sudo chown -R "$USER:$(id -gn)" output/
echo "duration=$(( $(date +%s) - START ))" >> "$GITHUB_OUTPUT"
ISO=$(ls output/*.iso 2>/dev/null | head -1)
echo "iso_size=$(stat -c%s "$ISO" 2>/dev/null || echo 0)" >> "$GITHUB_OUTPUT"

- name: Fix output directory ownership
run: sudo chown -R "$USER:$(id -gn)" output/ 2>/dev/null || true

- name: Run LUKS end-to-end test
id: luks_test
env:
FISHER_REPO: /tmp/fisherman/fisherman
run: |
START=$(date +%s)
just luks-test-qemu ${{ matrix.target }}
echo "duration=$(( $(date +%s) - START ))" >> "$GITHUB_OUTPUT"
continue-on-error: true

- name: Convert and publish screenshots
if: always()
continue-on-error: true
id: screenshots
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
RUN_ID: ${{ github.run_id }}
run: |
sudo chmod a+r /tmp/luks-screenshot-*.ppm /tmp/luks-unlock-snap.ppm 2>/dev/null || true

commit_png() {
local src_ppm="$1" label="$2" out_var="$3"
local png="/tmp/${label}.png"

convert "$src_ppm" "$png" 2>/dev/null || return 0
[[ -f "$png" ]] || return 0

local path_in_repo="luks-e2e/${RUN_ID}/${{ matrix.target }}/${{ matrix.installer_channel }}/${label}.png"
local existing_sha
existing_sha=$(gh api "/repos/${REPO}/contents/${path_in_repo}?ref=ci-screenshots" \
--jq '.sha' 2>/dev/null || echo "")

local b64_file
b64_file=$(mktemp)
base64 -w0 "$png" > "$b64_file"

jq -n \
--arg msg "LUKS E2E screenshot: ${label} (run ${RUN_ID})" \
--rawfile content "$b64_file" \
--arg branch "ci-screenshots" \
--arg sha "$existing_sha" \
'if $sha != "" then
{message: $msg, content: ($content | rtrimstr("\n")), branch: $branch, sha: $sha}
else
{message: $msg, content: ($content | rtrimstr("\n")), branch: $branch}
end' | \
gh api --method PUT "/repos/${REPO}/contents/${path_in_repo}" --input - > /dev/null

rm "$b64_file"
local url="https://raw.githubusercontent.com/${REPO}/ci-screenshots/${path_in_repo}"
echo "${out_var}=${url}" >> "$GITHUB_OUTPUT"
echo "Published ${label} → ${url}"
}

commit_png /tmp/luks-screenshot-live.ppm "live-boot" "live_url"
commit_png /tmp/luks-screenshot-plymouth.ppm "plymouth" "plymouth_url"
commit_png /tmp/luks-screenshot-final.ppm "final-boot" "final_url"

- name: Write job summary
if: always()
run: |
RESULT="${{ steps.luks_test.outcome }}"
CHANNEL="${{ matrix.installer_channel }}"
TARGET="${{ matrix.target }}"
ICON=$( [ "$RESULT" = "success" ] && echo "PASS" || echo "FAIL" )
{
echo "## ${ICON} LUKS End-to-End Test (${TARGET}, ${CHANNEL}) — ${RESULT}"
echo ""
echo "| Step | Value |"
echo "|------|-------|"
echo "| ISO size | $(numfmt --to=iec ${{ steps.build.outputs.iso_size }} 2>/dev/null || echo N/A) |"
echo "| Build time | ${{ steps.build.outputs.duration }}s |"
echo "| LUKS test time | ${{ steps.luks_test.outputs.duration }}s |"
} >> "$GITHUB_STEP_SUMMARY"

- name: Upload serial logs
if: always()
run: |
sudo chmod a+r /tmp/bluefin-qemu-*.log 2>/dev/null || true

- name: Upload serial logs artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: luks-e2e-serial-logs-${{ matrix.target }}-${{ matrix.installer_channel }}
path: |
/tmp/bluefin-qemu-live-serial.log
/tmp/bluefin-qemu-installed-serial.log
if-no-files-found: warn
retention-days: 14

- name: Fail if LUKS test failed
if: steps.luks_test.outcome == 'failure'
run: |
echo "::error::LUKS end-to-end test failed — see serial logs and screenshots above"
exit 1
104 changes: 104 additions & 0 deletions bootc-iso/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Bluefin live ISO installer image
#
# Build with:
# just container bluefin
#
# Three-stage build:
# 1. bluefin-ref — original Bluefin image (provides kernel modules)
# 2. initramfs-builder — Debian: builds a dmsquash-live initramfs against
# Bluefin's kernel modules in its native glibc environment
# 3. final — Bluefin: receives the rebuilt initramfs + live-env setup
#
# Bluefin is Fedora/ostree-based using GRUB2 for the installed system.
# The live ISO uses systemd-boot for ESP boot (installed in the final stage).
# The installed system's bootloader is controlled by fisherman/bootc-installer
# via images.json (grub2).
#
# The initramfs is built in a separate Debian stage so no cross-distro binary
# grafting is needed; only the initramfs.img output crosses the stage boundary.

# Base image — override to build bluefin-lts or other variants.
# Example: podman build --build-arg BASE_IMAGE=ghcr.io/ublue-os/bluefin-lts:latest ...
ARG BASE_IMAGE=ghcr.io/ublue-os/bluefin:stable

# ── Stage 1: Bluefin reference (kernel modules source) ───────────────────────
FROM ${BASE_IMAGE} AS bluefin-ref

# ── Stage 2: Debian — builds the dmsquash-live initramfs ─────────────────────
# Dracut runs natively in Debian against Bluefin's kernel modules.
# Only /tmp/initramfs.img crosses into the final stage.
FROM debian:sid AS initramfs-builder

RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
dracut \
dmsetup \
&& rm -rf /var/lib/apt/lists/*

# Import Bluefin's kernel module tree so dracut targets the correct kernel
COPY --from=bluefin-ref /usr/lib/modules /usr/lib/modules

# Add Bluefin-specific initramfs support for Ventoy/file-backed ISO boot.
COPY src/dracut/95bluefin-isofile /usr/lib/dracut/modules.d/95bluefin-isofile

RUN set -ex; \
kernel=$(ls /usr/lib/modules | sort -V | tail -1); \
echo "Building dmsquash-live initramfs for kernel ${kernel}"; \
# Check which optional drivers are available (el10 kernel may lack ntfs3).
NTFS3=""; test -f "/usr/lib/modules/${kernel}/kernel/fs/ntfs3/ntfs3.ko" && NTFS3="ntfs3"; \
DRACUT_NO_XATTR=1 dracut -v --force --zstd --reproducible --no-hostonly \
--add "dmsquash-live bluefin-isofile" \
--add-drivers "squashfs overlay loop iso9660 sr_mod cdrom sd_mod usb-storage xhci-pci exfat vfat fat ${NTFS3} ext4" \
/tmp/initramfs.img "${kernel}"; \
ls -lh /tmp/initramfs.img

# ── Stage 3: Final Bluefin live image ────────────────────────────────────────
ARG BASE_IMAGE
FROM ${BASE_IMAGE}

# Set to "dev" to pull the tuna-installer dev build (continuous-dev release)
# instead of the stable continuous build.
ARG INSTALLER_CHANNEL=stable
ENV INSTALLER_CHANNEL=${INSTALLER_CHANNEL}

# DEBUG=1 builds a debug ISO (installer only, SSH enabled).
ARG DEBUG=0
ENV DEBUG=${DEBUG}

# Filesystem for the installed system: btrfs (Bluefin stable) or xfs (Bluefin LTS).
# Override via: --build-arg FILESYSTEM=xfs
ARG FILESYSTEM=btrfs

# Install systemd-boot for the live ISO ESP (Bluefin ships GRUB2 for the
# installed system, but the live ISO needs a UEFI bootloader on the ESP image).
# systemd-boot-unsigned is the Fedora package; use rpm-ostree to layer it.
# fuse-overlayfs provides overlay-on-overlay for kernels without native support
# (e.g. CentOS Stream 10 in bluefin-lts — containers/storage needs it on
# overlayfs-based rootfs).
RUN rpm-ostree install --apply-live --allow-inactive systemd-boot-unsigned fuse-overlayfs \
&& rm -rf /var/cache/rpm-ostree

# Replace the OCI-mode initramfs with the dmsquash-live initramfs from stage 2
COPY --from=initramfs-builder /tmp/initramfs.img /tmp/initramfs.img
RUN kernel=$(ls /usr/lib/modules | sort -V | tail -1) && \
mv /tmp/initramfs.img "/usr/lib/modules/${kernel}/initramfs.img" && \
echo "Replaced initramfs for kernel ${kernel}"

# ── Flatpak install layer ─────────────────────────────────────────────────────
COPY src/flatpaks /tmp/flatpaks-list
RUN --mount=type=bind,source=src,target=/src \
--mount=type=cache,target=/var/cache/flatpak-dl,id=bluefin-flatpak \
/src/install-flatpaks.sh

# ── Live-environment configure layer ─────────────────────────────────────────
COPY src/ /tmp/src/
RUN chmod +x /tmp/src/configure-live.sh && /tmp/src/configure-live.sh

ARG BASE_IMAGE
ARG FILESYSTEM
# Patch installer configs to reference the actual base image + filesystem for this variant.
RUN sed -i "s|ghcr.io/ublue-os/bluefin:stable|${BASE_IMAGE}|g" \
/etc/bootc-installer/images.json \
/etc/bootc-installer/recipe.json && \
sed -i 's|"filesystem": "btrfs"|"filesystem": "${FILESYSTEM}"|g' \
/etc/bootc-installer/images.json
Loading
Loading