Skip to content
Merged
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
21 changes: 14 additions & 7 deletions .github/CI.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@ The Ubuntu job uses a disposable OpenPGP identity to publish a local
testing RPR and checks pacman install, update and signature rejection.
It assembles the system root, disk and online installer, then runs a
two-generation signed kernel upgrade and verifies boot confirmation,
module reload and fallback. The job uploads the exact media for smoke
tests and retains failing upgrade logs.
module reload and fallback. It applies the update once, then runs the
BIOS and UEFI checks concurrently on private disk overlays. Each firmware
boots the new kernel before the previous one, and attempts the unconfirmed
slot before checking automatic fallback on a separate overlay.

## Boot and status

BIOS and UEFI jobs download the same media, start the online installer
and boot the assembled system as systemd PID 1. The smoke checks cover
The Ubuntu job also boots the generated ISO and disk locally on BIOS and
UEFI in parallel. The smoke checks cover the online installer, systemd PID 1,
merged-usr, packages, ext4 and the ESP, core services and boot confirmation.
QEMU jobs retain serial logs and result records.
The job verifies the checksums around the smoke tests and uploads the tested
media once for download. QEMU serial logs and result records are available
as separate artifacts.

Select **CI result** as the required branch check. It reports every
required job and treats a missing or failed result as a failure.
Expand All @@ -38,8 +42,11 @@ required job and treats a missing or failed result as a failure.

A successful CI result for a push to `main` triggers the production publisher.
To retry from Actions, run **ReliefOS CI** on `main` with **publish_pages**
enabled. The workflow builds the verified commit, serializes production
deployments, and skips commits already deployed or superseded on `main`.
enabled. The publisher takes the tested unsigned packages and installer
tools from the same CI run and checks their commit and SHA-256 before use.
The publisher signs a production repository and assembles an ISO against
it. The workflow serializes deployments and skips commits already deployed
or superseded on `main`.

Configure the `github-pages` environment for `main` deployments. Set the
`RPR_SIGNING_FINGERPRINT` Actions variable to the primary fingerprint from
Expand Down
74 changes: 35 additions & 39 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ jobs:
tools/build/arch-rootfs{,-install}.sh tools/build/arch-guest-packages.sh \
tools/build/glibc-runtime-headers.sh userland/apps/installer/arch-online-install.sh \
system/installer/installer-session \
tools/build/arch-rpr-{sign,trust,kernel-check}.sh \
tools/build/arch-rpr-{sign,trust,kernel-check,package-check}.sh \
tests/integration/arch-{runtime,kernel,boot}-package.sh tests/integration/arch-boot-hook.sh \
tests/integration/arch-rpr-{testing,pacman}.sh \
tests/integration/arch-{kernel-prune,kernel-prune-container,systemd-boot,systemd-entry}.sh \
tests/integration/arch-kernel-upgrade{,-build}.sh
shellcheck scripts/ci/{restore-rpr,publish-pages}.sh
shellcheck scripts/ci/{pages-inputs,restore-rpr,publish-pages}.sh
/usr/bin/python3 -m unittest discover -s tools/tests -p 'test_ci*.py' -v

documentation:
Expand Down Expand Up @@ -138,6 +138,8 @@ jobs:
if: needs.changes.outputs.build == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 120
env:
ARCH_JOBS: '4'
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -219,16 +221,31 @@ jobs:
- name: Compose the BIOS and UEFI disk
if: matrix.host == 'ubuntu-24.04'
run: make O=out/ci-arch-root image-vmdk
- name: Boot the installer and installed system on BIOS and UEFI
if: matrix.host == 'ubuntu-24.04'
run: bash scripts/ci/smoke.sh out/ci-arch-root
- name: Verify signed kernel upgrades, module reload and boot fallback
if: matrix.host == 'ubuntu-24.04'
env:
ARCH_JOBS: '2'
RELIEFOS_QMP_DIR: ${{ runner.temp }}
TMPDIR: /dev/shm
run: bash tests/integration/arch-kernel-upgrade-build.sh out/ci-arch-root
- name: Record and upload the exact products for boot verification
if: matrix.host == 'ubuntu-24.04'
run: python3 tools/ci.py manifest --root out/ci-arch-root
run: bash tests/integration/arch-kernel-upgrade-build.sh out/ci-arch-root --parallel-firmwares
- name: Pack the verified release inputs
if: >-
matrix.host == 'ubuntu-24.04' && github.ref == 'refs/heads/main' &&
(github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.publish_pages))
id: pack_release
run: bash scripts/ci/pages-inputs.sh pack out/ci-arch-root "$RUNNER_TEMP/release-inputs"
- name: Upload the verified release inputs
if: steps.pack_release.outcome == 'success'
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: reliefos-release-inputs-${{ github.sha }}
path: ${{ runner.temp }}/release-inputs/
if-no-files-found: error
compression-level: 1
overwrite: true
retention-days: 7
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: matrix.host == 'ubuntu-24.04'
with:
Expand All @@ -240,6 +257,7 @@ jobs:
out/ci-arch-root/ci/manifest.json
if-no-files-found: error
compression-level: 0
overwrite: true
retention-days: 3
- name: Preserve signed upgrade evidence
if: ${{ !cancelled() && matrix.host == 'ubuntu-24.04' }}
Expand All @@ -248,45 +266,23 @@ jobs:
name: reliefos-arch-upgrade-${{ github.sha }}
path: out/ci-arch-root/ci/arch-kernel-upgrade
if-no-files-found: ignore
overwrite: true
retention-days: 3

smoke:
name: Arch products (${{ matrix.firmware }})
needs: arch_root
runs-on: ubuntu-24.04
timeout-minutes: 35
strategy:
fail-fast: false
matrix:
firmware: [bios, uefi]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Check out the ReliefNT boot probe source
run: git submodule update --init --depth 1 -- kernel/reliefnt
- uses: ./.github/actions/setup
with:
profile: smoke
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: reliefos-images-${{ github.sha }}
path: out/ci-arch-root
- name: Boot the online installer and installed system
env:
SMOKE_FIRMWARE: ${{ matrix.firmware }}
run: bash scripts/ci/smoke.sh out/ci-arch-root
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: ${{ !cancelled() }}
- name: Preserve BIOS and UEFI boot evidence
if: ${{ !cancelled() && matrix.host == 'ubuntu-24.04' }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: reliefos-boot-${{ matrix.firmware }}-${{ github.sha }}
path: out/ci-smoke/${{ matrix.firmware }}
name: reliefos-boot-${{ github.sha }}
path: |
out/ci-smoke/bios
out/ci-smoke/uefi
if-no-files-found: ignore
overwrite: true
retention-days: 3

ci:
name: CI result
needs: [changes, checks, documentation, regressions, arch_root, smoke]
needs: [changes, checks, documentation, regressions, arch_root]
if: always()
runs-on: ubuntu-24.04
timeout-minutes: 5
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/publish-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
url: ${{ steps.deployment.outputs.page_url }}
env:
ARCH_BASE_REGISTRY: docker.io
ARCH_JOBS: '2'
ARCH_JOBS: '4'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand Down Expand Up @@ -65,12 +65,19 @@ jobs:
python-version: '3.12'
cache: pip
cache-dependency-path: Documentation/requirements.txt
- name: Install Sphinx and build release packages
- name: Download the tested build inputs from this CI run
if: steps.current.outputs.publish == 'true'
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: reliefos-release-inputs-${{ github.sha }}
path: ${{ runner.temp }}/release-inputs
- name: Prepare the release environment and verify the build inputs
if: steps.current.outputs.publish == 'true'
shell: bash
run: |
python -m pip install -r Documentation/requirements.txt 'Sphinx==9.*'
bash scripts/ci/arch-host.sh ubuntu-24.04 out/production-pages
make O=out/production-pages fetch
bash scripts/ci/pages-inputs.sh restore out/production-pages "$RUNNER_TEMP/release-inputs"
- name: Sign the repository with the production subkey
if: steps.current.outputs.publish == 'true'
id: signed
Expand Down
4 changes: 2 additions & 2 deletions scripts/ci/arch-host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends docker-cli git
&& rm -rf /var/lib/apt/lists/*
DOCKERFILE
launcher=(docker run --rm -i --pull=never --user "$(id -u):$(id -g)"
--group-add "$(stat -c %g /var/run/docker.sock)" --env HOME=/tmp --env ARCH_BASE_REGISTRY
--group-add "$(stat -c %g /var/run/docker.sock)" --env HOME=/tmp --env ARCH_BASE_REGISTRY --env ARCH_JOBS
--mount 'type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock'
--mount "type=bind,src=$PWD,dst=$PWD" --workdir "$PWD" reliefos-ci-debian)
;;
*) printf 'unsupported CI host: %s\n' "$host" >&2; exit 2 ;;
esac
"${launcher[@]}" bash -eu -s -- "$output" <<'BUILD'
for goal in doctor fetch build; do
make O="$1" ARCH_JOBS=2 "$goal"
make O="$1" "$goal"
done
BUILD
36 changes: 36 additions & 0 deletions scripts/ci/pages-inputs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
# Transfer the tested unsigned packages and installer tools within this CI run.
set -euo pipefail
operation=${1:?pack or restore required}
output=$(realpath -e -- "${2:?Arch build output required}")
handoff=$(realpath -m -- "${3:?artifact directory required}")
commit=$(git rev-parse --verify HEAD)
fail() { printf 'pages-inputs: %s\n' "$*" >&2; exit 1; }
[[ ${GITHUB_SHA:-$commit} == "$commit" ]] || fail 'checkout differs from the workflow commit'
[[ -f $output/.reliefos-arch-root ]] || fail 'Arch build output is not initialized'

case $operation in
pack)
mkdir -p -- "$handoff"
cd -- "$output"
shopt -s nullglob
packages=(packages/arch/*.pkg.tar.zst)
pointers=(packages/arch/*-current)
(( ${#packages[@]} && ${#pointers[@]} )) || fail 'the package set is empty'
for file in "${packages[@]}" "${pointers[@]}"; do
[[ -s $file && -f $file && ! -L $file ]] || fail "invalid package input $file"
done
tar -cf "$handoff/inputs.tar" -- "${packages[@]}" "${pointers[@]}" \
host/bin/reliefos-kernel-tools grub-host/bin grub-host/lib/grub/i386-pc \
grub-efi/bin/grub-mkstandalone grub-efi/lib/grub/x86_64-efi
sha256sum < "$handoff/inputs.tar" > "$handoff/inputs.sha256"
printf '%s\n' "$commit" > "$handoff/source-commit"
;;
restore)
[[ $(<"$handoff/source-commit") == "$commit" ]] || fail 'build artifact belongs to a different commit'
digest=$(sha256sum < "$handoff/inputs.tar")
[[ $digest == "$(<"$handoff/inputs.sha256")" ]] || fail 'build artifact checksum mismatch'
tar -xf "$handoff/inputs.tar" --no-same-owner -C "$output"
;;
*) fail "unknown action $operation" ;;
esac
47 changes: 32 additions & 15 deletions scripts/ci/smoke.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,39 @@
#!/usr/bin/env bash
set -euo pipefail
root=${1:?verified artifact root required}
firmware=${SMOKE_FIRMWARE:-}
case "$firmware" in
bios) systemd_options=(--direct-root) ;;
uefi) systemd_options=() ;;
*) echo 'SMOKE_FIRMWARE must be bios or uefi' >&2; exit 2 ;;
root=${1:?local Arch build output required}
firmwares=${SMOKE_FIRMWARE:-both}
case "$firmwares" in
bios|uefi|both) ;;
*) echo 'SMOKE_FIRMWARE must be bios, uefi or both' >&2; exit 2 ;;
esac
python3 tools/ci.py verify --root "$root"
python3 tools/ci.py manifest --root "$root"
export RELIEFOS_QMP_DIR=${RUNNER_TEMP:-/tmp}
output=out/ci-smoke/$firmware
mkdir -p "$output"
probe=$output/systemd-compat-probe
mkdir -p out/ci-smoke
probe=out/ci-smoke/systemd-compat-probe
cc -static -O2 -Wall -Wextra -Werror \
kernel/reliefnt/tools/tests/systemd_compat_runtime_probe.c -o "$probe"
python3 tools/test_arch_installer_iso.py --iso "$root/images/reliefos-installer.iso" \
--firmware "$firmware" --output "$output/installer" --timeout 600
python3 tools/test_arch_systemd_qemu.py --disk "$root/images/reliefos.vmdk" \
--firmwares "$firmware" "${systemd_options[@]}" --output "$output/systemd" --timeout 600 \
--guest-check tests/integration/arch-systemd-compat.sh --guest-file "$probe"

boot_products() {
local firmware=$1 output=out/ci-smoke/$1
local -a systemd_options=()
if [[ $firmware == bios ]]; then systemd_options+=(--direct-root); fi
python3 tools/test_arch_installer_iso.py --iso "$root/images/reliefos-installer.iso" \
--firmware "$firmware" --output "$output/installer" --timeout 600
python3 tools/test_arch_systemd_qemu.py --disk "$root/images/reliefos.vmdk" \
--firmwares "$firmware" "${systemd_options[@]}" --output "$output/systemd" --timeout 600 \
--guest-check tests/integration/arch-systemd-compat.sh --guest-file "$probe"
}

status=0
if [[ $firmwares == both ]]; then
boot_products bios &
bios=$!
boot_products uefi &
uefi=$!
wait "$bios" || status=$?
wait "$uefi" || status=$?
else
boot_products "$firmwares"
fi
python3 tools/ci.py verify --root "$root"
exit "$status"
7 changes: 4 additions & 3 deletions tests/integration/arch-kernel-upgrade-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
# Build a second signed kernel generation for the real-disk upgrade gate.
set -euo pipefail
source_root=$(realpath -e -- "$(dirname -- "$0")/../..")
if (( $# != 1 )); then
printf 'usage: %s ARCH_OUTPUT\n' "$0" >&2
if (( $# < 1 || $# > 2 )) || [[ $# == 2 && $2 != --parallel-firmwares ]]; then
printf 'usage: %s ARCH_OUTPUT [--parallel-firmwares]\n' "$0" >&2
exit 2
fi
output=$(realpath -e -- "$1")
shift
[[ -f $output/.reliefos-arch-root && -f $output/images/reliefos.raw ]]
mkdir -p -- "$output/ci/arch-kernel-upgrade"
evidence=$(mktemp -d "$output/ci/arch-kernel-upgrade/run.XXXXXXXX")
Expand Down Expand Up @@ -59,4 +60,4 @@ test -s "$work/arch-kernel/stage/usr/lib/modules/$new_release/kernel/drivers/sto
python3 "$source_root/tools/test_arch_kernel_upgrade_qemu.py" \
--disk "$output/images/reliefos.raw" --snapshot "$work/rpr-testing/$snapshot" \
--fingerprint "$RPR_SIGNING_FINGERPRINT" --old-release "$old_release" --new-release "$new_release" \
--timeout 600 --output "$evidence/boot"
--timeout 600 --output "$evidence/boot" "$@"
18 changes: 11 additions & 7 deletions tests/integration/arch-systemd-entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,19 @@ set -euo pipefail
exec > /dev/console 2>&1
trap 'printf "[arch-test] failed line=%s status=%s\n" "$LINENO" "$?"' ERR

action=
for argument in $(</proc/cmdline); do
case $argument in
reliefos.test=*) action=${argument#reliefos.test=} ;;
esac
done

if [[ ${1-} != copied ]]; then
target=multi-user.target
if [[ -L /etc/systemd/system/display-manager.service ]]; then
# The package transaction and new-kernel checks exercise the desktop too.
# The remaining upgrade phases only require services and GRUB slot state.
if [[ $action != previous && $action != unconfirmed && $action != fallback &&
-L /etc/systemd/system/display-manager.service ]]; then
target=graphical.target
fi
systemctl start "$target"
Expand All @@ -19,12 +29,6 @@ fi

# The running script now lives on tmpfs, allowing the VirtIO module to unload.
umount /run/archcheck
action=
for argument in $(</proc/cmdline); do
case $argument in
reliefos.test=*) action=${argument#reliefos.test=} ;;
esac
done
case $action in
systemd)
bash /run/arch-fixture/check.sh
Expand Down
Loading