Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
a9915a8
test(ignition): fixture that writes a file and enables a unit
jeefy Sep 29, 2026
8fd798c
ci: classify pull requests that cannot change the image set
jeefy Sep 29, 2026
3d83ce2
fix(dogfood): honour DOGFOOD_PORT in dogfood-install.sh
jeefy Sep 29, 2026
8c1564e
feat(dogfood): assert tamper refusal and probe expectations
jeefy Sep 29, 2026
32a3286
ci(build): boot-test tamper refusal, HTTP boot, Ignition and A/B roll…
jeefy Sep 29, 2026
37edf30
docs(skills): CI boot coverage, build time and cache setup
jeefy Sep 29, 2026
e8eb21d
fix(dogfood): make DOGFOOD_TAMPER=sums test the signature, assert the…
jeefy Sep 29, 2026
5b5ba95
ci(build): version the update test sets 1.<run>.N
jeefy Sep 29, 2026
0f718b3
docs(skills): tamper reasons and update test versions
jeefy Sep 29, 2026
5c29f02
fix(dogfood): fail --check when Secure Boot is not enforced
jeefy Sep 29, 2026
02b55b3
ci(build): boot-test on Fedora's edk2 OVMF so Secure Boot is enforced
jeefy Sep 29, 2026
57d94a4
docs(skills): Secure Boot enforcement in boot-test and the OVMF pin
jeefy Sep 29, 2026
1e37fa0
ci(build): drop the BuildStream cache push
jeefy Sep 29, 2026
b93e88a
ci(build): run the build classifier from the PR's base revision
jeefy Sep 29, 2026
1dd8d09
docs(skills): the build classifier runs from the base revision
jeefy Sep 29, 2026
75824d2
Merge upstream/main into ci/boot-coverage-and-speed
jeefy Sep 29, 2026
41fe418
chore: merge upstream main into ci/boot-coverage-and-speed
jeefy Sep 29, 2026
0075489
fix(dogfood): strip OSC and DCS sequences before matching the tamper …
jeefy Sep 29, 2026
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
79 changes: 79 additions & 0 deletions .github/scripts/image-build-needed.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/usr/bin/env python3
"""Decide whether a pull request needs the image build and boot test.

Reads the PR's changed paths (one per line, renames listed under both names)
on stdin and prints ``true`` or ``false`` for the build workflow's `changes`
job, which runs this script from the PR's base revision. Only changes that
cannot reach the image set or the boot test skip the ~2 h build: docs,
Markdown outside the build inputs, unit/e2e tests and the workflows that run
them. Anything else, and anything under a build input root, builds; so does
any change to this classifier or to the build workflow, and an empty or
truncated list.
"""

import sys

# The gate itself: a change to either must be built and boot-tested before
# the base branch's classifier trusts it.
GATE_FILES = frozenset(
{
".github/scripts/image-build-needed.py",
".github/workflows/build.yml",
}
)

# Paths the build or the boot test consume. Always build, even for *.md.
BUILD_PREFIXES = (
"elements/",
"files/",
"include/",
"patches/",
"plugins/",
"scripts/",
"tests/fixtures/",
)

SKIP_PREFIXES = (
"docs/",
"tests/unit/",
"tests/e2e/",
)

SKIP_FILES = frozenset(
{
".github/scripts/docs-checks.py",
".github/workflows/docs-checks.yml",
".github/workflows/unit-tests.yml",
".github/workflows/track-junctions.yml",
".pre-commit-config.yaml",
"cliff.toml",
"LICENSE",
}
)

# GitHub's "list pull request files" API stops at 3000 files.
API_FILE_LIMIT = 3000


def needs_build(path: str) -> bool:
if path in GATE_FILES or path.startswith(BUILD_PREFIXES):
return True
if path.startswith(SKIP_PREFIXES) or path in SKIP_FILES or path.endswith(".md"):
return False
return True


def image_build_needed(paths: list[str]) -> bool:
if not paths or len(paths) >= API_FILE_LIMIT:
return True
return any(needs_build(p) for p in paths)


def main() -> int:
paths = [line.strip() for line in sys.stdin if line.strip()]
print("true" if image_build_needed(paths) else "false")
return 0


if __name__ == "__main__":
sys.exit(main())
143 changes: 140 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,51 @@ permissions:
contents: read

jobs:
# Pull requests that cannot change the image set or the boot test (docs,
# unit tests, other workflows; see .github/scripts/image-build-needed.py)
# skip the ~2 h build. A skipped job reports as passing, so `build` and
# `boot-test` can be required checks without blocking those PRs.
# The classifier runs from the base revision, never the PR head, so a PR
# cannot edit it to skip its own build; changes to it or to this workflow
# always build.
changes:
runs-on: ubuntu-26.04
timeout-minutes: 10
permissions:
contents: read
pull-requests: read # lists the pull request's changed files
outputs:
image: ${{ steps.decide.outputs.image }}
steps:
- name: Checkout the base revision's scripts
if: github.event_name == 'pull_request'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.base.sha }}
sparse-checkout: .github/scripts
persist-credentials: false

- name: Decide whether to build the image set
id: decide
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
set -euo pipefail
# Before the classifier exists on the base branch, build.
if [ "${GITHUB_EVENT_NAME}" != pull_request ] || [ ! -f .github/scripts/image-build-needed.py ]; then
echo "image=true" >> "$GITHUB_OUTPUT"
exit 0
fi
gh api --paginate "repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}/files" \
--jq '.[] | .filename, (.previous_filename // empty)' > "${RUNNER_TEMP}/changed.txt"
image="$(python3 .github/scripts/image-build-needed.py < "${RUNNER_TEMP}/changed.txt")"
echo "image=${image}" >> "$GITHUB_OUTPUT"
echo "Image build needed: ${image}"

build:
needs: changes
if: needs.changes.outputs.image == 'true'
runs-on: ubuntu-26.04
timeout-minutes: 300
outputs:
Expand Down Expand Up @@ -115,12 +159,43 @@ jobs:
if-no-files-found: error
retention-days: 1

# The A/B update and boot-counted rollback test needs two more image
# sets that sort above this one. Only the version differs, so each is a
# warm rebuild of the version-stamped elements. Not on main: these would
# be release-signed versions nobody publishes.
# 1.<run>.N, not 0.<run>.N: systemd-sysinstall's boot entry for the
# installed 0.<run> carries `version 1.0.<run>`, and systemd-boot would
# keep defaulting to it over a 0.<run>.N update. 1.<run>.N sorts above
# both and still below every release (YY.MM.<run>).
- name: Build the next and broken image sets
if: github.ref != 'refs/heads/main'
run: |
set -euo pipefail
just set-version "1.${GITHUB_RUN_NUMBER}.1"
just export-image dist/diskless-next
just set-version "1.${GITHUB_RUN_NUMBER}.2"
just export-image dist/diskless-broken

- name: Upload update test image sets
if: github.ref != 'refs/heads/main'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: image-update
path: |
dist/diskless-next/
dist/diskless-broken/
!dist/*/bluefin-server-installer_*.raw
if-no-files-found: error
retention-days: 1

# Secure Boot QEMU boots of the built images: diskless (network pull,
# dm-verity /usr, tmpfs root) and diskless -> systemd-sysinstall -> disk.
# dm-verity /usr, tmpfs root), refusal of a tampered image or manifest,
# UEFI HTTP boot, Ignition applying a config, and diskless ->
# systemd-sysinstall -> disk; off main also A/B update and rollback.
boot-test:
needs: build
runs-on: ubuntu-26.04
timeout-minutes: 60
timeout-minutes: 90
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand All @@ -134,19 +209,81 @@ jobs:
name: image
path: dist/diskless

- name: Download update test image sets
if: github.ref != 'refs/heads/main'
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: image-update
path: dist

# Ubuntu's OVMF (2025.11) rejects systemd-boot's PK enrollment with
# "Security violation", so the guests kept booting in setup mode with
# nothing verified. Use Fedora's edk2 build, pinned by checksum, which
# enrolls the keys; dogfood-diskless.sh now fails if Secure Boot is off.
- name: Install QEMU and OVMF
env:
OVMF_RPM_URL: https://kojipkgs.fedoraproject.org/packages/edk2/20260508/6.fc44/noarch/edk2-ovmf-20260508-6.fc44.noarch.rpm
OVMF_RPM_SHA256: 8b157ab2aa0cccccf021f43011308349147c76ae59550f52239ea50678dd0a5f
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y --no-install-recommends qemu-system-x86 ovmf
sudo apt-get install -y --no-install-recommends qemu-system-x86 libarchive-tools
sudo chmod 666 /dev/kvm
curl -fsSL --retry 3 -o "${RUNNER_TEMP}/edk2-ovmf.rpm" "${OVMF_RPM_URL}"
echo "${OVMF_RPM_SHA256} ${RUNNER_TEMP}/edk2-ovmf.rpm" | sha256sum -c -
mkdir -p "${RUNNER_TEMP}/ovmf"
bsdtar -xf "${RUNNER_TEMP}/edk2-ovmf.rpm" -C "${RUNNER_TEMP}/ovmf" \
./usr/share/edk2/ovmf/OVMF_CODE.secboot.fd ./usr/share/edk2/ovmf/OVMF_VARS.fd
echo "OVMF_CODE=${RUNNER_TEMP}/ovmf/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd" >> "$GITHUB_ENV"
echo "OVMF_VARS=${RUNNER_TEMP}/ovmf/usr/share/edk2/ovmf/OVMF_VARS.fd" >> "$GITHUB_ENV"

- name: Diskless boot
run: bash scripts/dogfood-diskless.sh dist/diskless --check

- name: Refuse a tampered image
env:
DOGFOOD_TAMPER: raw
run: bash scripts/dogfood-diskless.sh dist/diskless --check

- name: Refuse an unsigned manifest
env:
DOGFOOD_TAMPER: sums
run: bash scripts/dogfood-diskless.sh dist/diskless --check

- name: Ignition config from a credential
env:
DOGFOOD_IGNITION: tests/fixtures/ignition/apply-marker.ign
DOGFOOD_EXTRA_PROBE: tests/fixtures/ignition/apply-marker.probe
DOGFOOD_EXPECT: "PROBE ignition marker=applied unit=active enabled=enabled ran=yes"
run: bash scripts/dogfood-diskless.sh dist/diskless --check

- name: UEFI HTTP boot with bluefin-node.ign
env:
DOGFOOD_BOOT: http
DOGFOOD_NODE_IGN: tests/fixtures/ignition/apply-marker.ign
DOGFOOD_EXTRA_PROBE: tests/fixtures/ignition/apply-marker.probe
DOGFOOD_EXPECT: "PROBE ignition marker=applied unit=active enabled=enabled ran=yes"
run: bash scripts/dogfood-diskless.sh dist/diskless --check

- name: Install to disk and boot it
if: github.ref == 'refs/heads/main'
run: bash scripts/dogfood-install.sh dist/diskless

- name: Install, A/B update and boot-counted rollback
if: github.ref != 'refs/heads/main'
run: bash scripts/dogfood-install.sh dist/diskless dist/diskless-next dist/diskless-broken

- name: Upload boot logs
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: boot-test-logs
path: |
dist/*/dogfood-*.log
dist/dogfood-install/*.log
if-no-files-found: ignore
retention-days: 7

# Publishes the signed image set as a new, immutable GitHub Release and as
# an ORAS OCI artifact (one layer per file, tags <version> and latest).
# Only runs on pushes/dispatches to main, where the code is already
Expand Down
Loading