Skip to content

Verify mkosi reproducibility #29

Verify mkosi reproducibility

Verify mkosi reproducibility #29

Workflow file for this run

# SPDX-FileCopyrightText: © 2026 Phala Network <dstack@phala.network>
#
# SPDX-License-Identifier: Apache-2.0
name: Verify mkosi reproducibility
on:
workflow_dispatch:
concurrency:
group: mkosi-build-${{ github.ref }}
cancel-in-progress: true
env:
# These values were produced by two cache-disabled local builds. The job
# checks out this exact source revision so the embedded Git revision and
# SOURCE_DATE_EPOCH are identical. Refresh all three values together.
BASELINE_REVISION: 9af3d0441544775f1b70885b45032ffa12458d03
BARE_SHA256: 2b794097b61ec61cd47bae6d38d8a4b08a043b764c945742d0097d4ded40ca93
UKI_SHA256: 328ae1466f0e5c229dc4b0d984b2a7ec73f137541600cc0ae5671edf2f870d14
jobs:
cross-host:
name: Compare with local mkosi baseline
runs-on: ubuntu-latest
timeout-minutes: 360
permissions:
contents: read
steps:
# GitHub-hosted runners have enough CPU and memory for this build, but
# their preinstalled SDKs consume most of the available disk. Remove only
# those unused SDKs before checkout; the OS build itself remains hermetic.
- name: Reclaim runner disk space
run: |
sudo rm -rf \
/opt/ghc \
/opt/hostedtoolcache/CodeQL \
/usr/local/.ghcup \
/usr/local/lib/android \
/usr/local/share/boost \
/usr/share/dotnet
df -h /
- name: Checkout locally verified revision
uses: actions/checkout@v5
with:
ref: ${{ env.BASELINE_REVISION }}
fetch-depth: 0
- name: Set up Python for mkosi
uses: actions/setup-python@v6
with:
python-version: '3.13'
- name: Install pinned mkosi
run: |
python3 -m venv "$RUNNER_TEMP/mkosi-venv"
"$RUNNER_TEMP/mkosi-venv/bin/pip" install --disable-pip-version-check \
'mkosi @ git+https://github.com/systemd/mkosi.git@84af20892b61c8e177e391f997ded8b4cb5514f2'
echo "$RUNNER_TEMP/mkosi-venv/bin" >> "$GITHUB_PATH"
- name: Install mkosi host dependencies
run: |
mapfile -t dependencies < <(mkosi --directory os/mkosi dependencies)
sudo apt-get update
sudo apt-get install --yes --no-install-recommends "${dependencies[@]}"
- name: Build without component cache
env:
# ubuntu-latest currently provides four vCPUs and 16 GiB of RAM.
# Do not oversubscribe either the CPU or compiler memory.
JOBS: '4'
run: |
test -z "${DSTACK_DEV_CACHE_DIR:-}"
# GitHub-hosted Ubuntu runners restrict unprivileged user namespaces.
# Run mkosi as root instead of weakening the runner's AppArmor policy.
# Keep setup-python out of the build PATH because Ubuntu's lddtree
# expects the distro Python and its python3-pyelftools module.
ci_bin="$RUNNER_TEMP/mkosi-ci-bin"
mkdir -p "$ci_bin"
ln -s "$(command -v mkosi)" "$ci_bin/mkosi"
sudo --set-home env \
"PATH=$ci_bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \
"JOBS=$JOBS" \
./os/mkosi/build.sh image "$RUNNER_TEMP/mkosi-cross-host"
sudo chown -R "$USER:$USER" "$RUNNER_TEMP/mkosi-cross-host/out"
- name: Compare with local byte-for-byte baseline
run: |
cd "$RUNNER_TEMP/mkosi-cross-host/out/prod"
tar -xOf dstack-0.6.0.tar.gz dstack-0.6.0/sha256sum.txt
tar -xOf dstack-0.6.0.tar.gz dstack-0.6.0/metadata.json
sha256sum dstack-0.6.0.tar.gz dstack-0.6.0-uki.tar.gz \
| tee cross-host.sha256
printf '%s %s\n' "$BARE_SHA256" dstack-0.6.0.tar.gz \
| sha256sum --check --strict
printf '%s %s\n' "$UKI_SHA256" dstack-0.6.0-uki.tar.gz \
| sha256sum --check --strict
- name: Upload verification record
if: always()
uses: actions/upload-artifact@v4
with:
name: mkosi-cross-host-sha256
path: ${{ runner.temp }}/mkosi-cross-host/out/prod/cross-host.sha256
retention-days: 30