Skip to content

Commit 06edf62

Browse files
committed
ci(os): verify mkosi output against local baseline
1 parent 4cbdffd commit 06edf62

1 file changed

Lines changed: 101 additions & 0 deletions

File tree

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# SPDX-FileCopyrightText: © 2026 Phala Network <dstack@phala.network>
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: mkosi cross-host reproducibility
6+
7+
on:
8+
workflow_dispatch:
9+
pull_request:
10+
paths:
11+
- '.github/workflows/mkosi-reproducibility.yml'
12+
- 'os/mkosi/**'
13+
- 'os/image/**'
14+
- 'os/common/rootfs/**'
15+
- 'dstack/**'
16+
17+
concurrency:
18+
group: mkosi-repro-${{ github.event.pull_request.number || github.ref }}
19+
cancel-in-progress: true
20+
21+
env:
22+
# These values were produced by two cache-disabled local builds. The job
23+
# checks out this exact source revision so the embedded Git revision is also
24+
# identical. Refresh all four values together when updating the baseline.
25+
BASELINE_REVISION: 4cbdffdfd70ce6b1add8962b1bcea30dc671de06
26+
SOURCE_DATE_EPOCH: '1784793184'
27+
BARE_SHA256: 7969920fcce2f868d5c967e5b8b114b9406e85900316039b9d47073afca52138
28+
UKI_SHA256: 4a4e6eb7587e0f02b24d37e7bb56b718f923af104d86151fa04045c7d63c8aa5
29+
30+
jobs:
31+
cross-host:
32+
name: Compare with local mkosi baseline
33+
runs-on: yocto-builder
34+
timeout-minutes: 90
35+
permissions:
36+
contents: read
37+
38+
steps:
39+
- name: Checkout locally verified revision
40+
uses: actions/checkout@v5
41+
with:
42+
ref: ${{ env.BASELINE_REVISION }}
43+
fetch-depth: 0
44+
45+
- name: Install host image assembly tools
46+
run: |
47+
sudo apt-get update
48+
sudo apt-get install --yes --no-install-recommends \
49+
build-essential ca-certificates cmake cpio cryptsetup-bin curl \
50+
dosfstools gdisk git jq libssl-dev mtools pax-utils pkg-config \
51+
python3-venv squashfs-tools systemd-ukify xz-utils zstd
52+
53+
- name: Install pinned mkosi and Rust/Go tools
54+
run: |
55+
python3 -m venv "$RUNNER_TEMP/mkosi-venv"
56+
"$RUNNER_TEMP/mkosi-venv/bin/pip" install --disable-pip-version-check \
57+
'mkosi==26'
58+
echo "$RUNNER_TEMP/mkosi-venv/bin" >> "$GITHUB_PATH"
59+
sudo ./os/mkosi/scripts/install-toolchains.sh \
60+
"$RUNNER_TEMP/toolchain-downloads"
61+
echo '/opt/dstack-toolchains/rust/bin' >> "$GITHUB_PATH"
62+
echo '/opt/dstack-toolchains/go/bin' >> "$GITHUB_PATH"
63+
64+
- name: Build pinned host measurement tools
65+
env:
66+
CARGO_HOME: ${{ runner.temp }}/cargo-home
67+
CARGO_TARGET_DIR: ${{ runner.temp }}/cargo-target
68+
run: |
69+
cargo install --locked \
70+
--git https://github.com/aws/NitroTPM-Tools \
71+
--rev d76d6eeebd4169b00a3c3af9858852d48f40e748 \
72+
--root "$RUNNER_TEMP/host-tools" nitro-tpm-pcr-compute
73+
cargo build --locked --release --manifest-path dstack/Cargo.toml \
74+
-p dstack-mr
75+
echo "$RUNNER_TEMP/host-tools/bin" >> "$GITHUB_PATH"
76+
echo "DSTACK_MR_BIN=$RUNNER_TEMP/cargo-target/release/dstack-mr" \
77+
>> "$GITHUB_ENV"
78+
79+
- name: Build without component cache
80+
env:
81+
JOBS: '64'
82+
run: |
83+
test -z "${DSTACK_DEV_CACHE_DIR:-}"
84+
./os/mkosi/build.sh image "$RUNNER_TEMP/mkosi-cross-host"
85+
86+
- name: Compare with local byte-for-byte baseline
87+
run: |
88+
cd "$RUNNER_TEMP/mkosi-cross-host/out/prod"
89+
printf '%s %s\n' "$BARE_SHA256" dstack-0.6.0.tar.gz \
90+
| sha256sum --check --strict
91+
printf '%s %s\n' "$UKI_SHA256" dstack-0.6.0-uki.tar.gz \
92+
| sha256sum --check --strict
93+
sha256sum dstack-0.6.0.tar.gz dstack-0.6.0-uki.tar.gz \
94+
> cross-host.sha256
95+
96+
- name: Upload verification record
97+
uses: actions/upload-artifact@v4
98+
with:
99+
name: mkosi-cross-host-sha256
100+
path: ${{ runner.temp }}/mkosi-cross-host/out/prod/cross-host.sha256
101+
retention-days: 30

0 commit comments

Comments
 (0)