Gitea runs each matrix entry as its own task, so build-image.yaml's `max-parallel: 1` never serialized the two editions -- both builds started at once on the fedora:host runner and corrupted each other's global anaconda/livemedia-creator state (/mnt/sysroot, /mnt/sysimage, loop and device-mapper devices), surfacing as bootctl failing with "Couldn't find EFI system partition" even though the dish's EFI partition was fine. build-image.sh now takes a host-wide flock around livemedia-creator, and under the lock first clears any stale mount/dm/loop device a previously failed build left behind. Verified on the runner: both editions launched concurrently now run serially under the lock and build successfully. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
111 lines
3.4 KiB
YAML
111 lines
3.4 KiB
YAML
name: build-image
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags: ["v*.*.*"]
|
|
|
|
# Builds raw disk images of the two default-tier editions (see
|
|
# cook/recipes_manifest.yaml) with build-image.sh, i.e.
|
|
# `livemedia-creator --no-virt --make-disk`. Other tiers (guest, experimental)
|
|
# are built on demand with `./build-image.sh --tier <tier>`.
|
|
#
|
|
# The build job runs on the registered `fedora:host` runner (a Fedora VM, jobs
|
|
# run as root), not in a container: --make-disk needs real loop devices and a
|
|
# live systemd-udevd. The runner needs lorax-lmc-novirt, qemu-img, make,
|
|
# python3-pip, pykickstart and xz installed.
|
|
|
|
jobs:
|
|
validate:
|
|
runs-on: fedora
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
container:
|
|
image: git.phyllo.me/devops/fedora-runner-image:latest
|
|
|
|
steps:
|
|
- uses: https://git.phyllo.me/devops/checkout@v5
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install Python deps
|
|
run: pip install -r cook/requirements.txt
|
|
|
|
- name: Generate, lint, and validate dishes
|
|
run: |
|
|
cd cook
|
|
make all
|
|
|
|
build-image:
|
|
needs: validate
|
|
runs-on: fedora
|
|
strategy:
|
|
fail-fast: false
|
|
# NB: Gitea runs every matrix entry as its own task, so `max-parallel`
|
|
# does not serialize them; build-image.sh takes a host-wide flock instead.
|
|
matrix:
|
|
include:
|
|
- edition: phyllomeos
|
|
root_size: 16384
|
|
- edition: phyllomeos-headless
|
|
root_size: 8192
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
env:
|
|
# /tmp is a small tmpfs on the runner; livemedia-creator writes the whole
|
|
# disk image under $TMPDIR
|
|
TMPDIR: /var/tmp
|
|
|
|
steps:
|
|
- uses: https://git.phyllo.me/devops/checkout@v5
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Check runner prerequisites
|
|
run: |
|
|
missing=0
|
|
for tool in livemedia-creator qemu-img make pip xz sudo; do
|
|
command -v "$tool" >/dev/null || { echo "missing on runner: $tool"; missing=1; }
|
|
done
|
|
[ -e /dev/loop-control ] || { echo "missing on runner: /dev/loop-control"; missing=1; }
|
|
[ "$missing" = 0 ] || exit 1
|
|
|
|
- name: Install Python deps
|
|
run: pip install -r cook/requirements.txt
|
|
|
|
- name: Build raw image
|
|
run: |
|
|
# Editions are named "<edition>_<values...>.cfg"; the trailing "_" keeps
|
|
# "phyllomeos" from matching "phyllomeos-headless".
|
|
(cd cook && make all)
|
|
dish="$(basename "$(ls cook/dishes/${{ matrix.edition }}_*.cfg)" .cfg)"
|
|
echo "DISH=$dish" >> "$GITHUB_ENV"
|
|
./build-image.sh --dish "$dish" --root-size ${{ matrix.root_size }}
|
|
xz -T0 "build/$dish.img"
|
|
|
|
- name: Upload image and kickstart as artifact
|
|
if: github.ref == 'refs/heads/main'
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ matrix.edition }}
|
|
path: |
|
|
build/${{ env.DISH }}.img.xz
|
|
cook/dishes/${{ env.DISH }}.cfg
|
|
if-no-files-found: error
|
|
|
|
- name: Publish image and kickstart as release
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
uses: https://git.phyllo.me/devops/action-gh-release@v2
|
|
with:
|
|
files: |
|
|
build/${{ env.DISH }}.img.xz
|
|
cook/dishes/${{ env.DISH }}.cfg
|
|
draft: false
|
|
prerelease: false
|
|
|
|
- name: Clean up build products
|
|
if: always()
|
|
run: rm -rf build /var/tmp/lmc-result.*
|