[fabrica] Release pin (QC round 2): verifiers build the tagged commit (flake rev and docs); the commit the pin names is kept for the record, must hold the recorded source tree when present, and is published unchecked when absent

This commit is contained in:
2026-11-22 19:29:28 +01:00
parent ea1ec11cd1
commit 5023575680
5 changed files with 41 additions and 16 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ how it is run, not for a number.
## Verifiable, and signed
Every release is a `SHA256SUMS` signed through Custos with my release key, over the notes, screenshots of the UI,
and the NAR hashes of the Nix build. Rebuild the pinned commit and compare (docs/verify.md tells you how).
and the NAR hashes of the Nix build. Rebuild the tagged commit and compare (docs/verify.md tells you how).
[Before posting: say "reproducible" only once two independent builds have matched; until then, what is checked is
one rebuild of the output derivations, with dependencies from the binary cache.]
+2 -2
View File
@@ -22,13 +22,13 @@ are on every step's PATH).
| `check`, `test` | `svelte-check` and the vitest click smoke test of the web UI the shots show | |
| `notes` | `fabrica notes` (the range since the previous `v*` tag; the first release covers the whole history) | `target/notes/release-notes.md`, `release-notes.json` |
| `shots` | `node apps/web/scripts/shots.mjs` (below) | `target/aula/aula-<name>.png`, `aula.json` |
| `pin` | `node scripts/release-pin.mjs <version> <tag> <commit>`: the Nix pin committed before the tag (`.fabrica/nix/pin.json`, by `scripts/nix-pin.sh` on Linux); refuses a missing pin, a pin of another version, and one made from other code than the tag's; publishes the pinned commit | `target/nix/ianitor-nix.json` |
| `pin` | `node scripts/release-pin.mjs <version> <tag> <commit>`: the Nix pin committed before the tag (`.fabrica/nix/pin.json`, by `scripts/nix-pin.sh` on Linux); refuses a missing pin, a pin of another version, one made from other code than the tag's, and one naming a present commit of other code; publishes the tagged commit as the build reference | `target/nix/ianitor-nix.json` |
| `approve` | the run's Custos approval, before anything is published | |
| `publish` | the Gitea release of the tag: the notes, the shots, `aula.json` and `ianitor-nix.json`; `sums: domi-release` adds `SHA256SUMS` and `SHA256SUMS.minisig`; `release-notes.md` becomes the release's text | |
**The Nix build is pinned, not shipped.** The Windows runner has no Nix and Fabrica's `SHA256SUMS` covers only the
files of one `publish` step, so the release cannot carry a build made by the NixOS runner. It carries the build's
NAR hashes instead (`ianitor-nix.json`, under the signed `SHA256SUMS`): anyone rebuilds the pinned commit and
NAR hashes instead (`ianitor-nix.json`, under the signed `SHA256SUMS`): anyone rebuilds the tagged commit and
compares ([verify.md](verify.md)), and the `verify-nix` pipeline does that on every `v*` tag on the NixOS runner.
The `pin` step refuses a pin made from other code than the tag's (its source tree must match), which is the gate:
Fabrica pipelines cannot depend on one another, so `publish` cannot wait for `verify-nix`. What "reproducible"
+9 -6
View File
@@ -3,7 +3,7 @@
Every Ianitor release on Gitea (`vX.Y.Z`) carries `SHA256SUMS` and `SHA256SUMS.minisig`, signed through Custos by
the `domi-release` key, and among the files that `SHA256SUMS` lists, `ianitor-nix.json`: the commit the build was
made from and the NAR hash of every Nix output (`.#ianitor`, the two binaries; `.#ianitor-web`, the built UI).
Ianitor ships no binary download: you build that commit yourself (or your server does, through the NixOS module)
Ianitor ships no binary download: you build the tagged commit yourself (or your server does, through the NixOS module)
and check that you got exactly the bytes the release vouches for.
What is checked, and what is not yet: `scripts/nix-pin.sh` builds each output, then rebuilds the output derivation itself once more (`nix build --rebuild`) and refuses to pin it if the two differ; the dependencies come from the binary cache and are not rebuilt. The `verify-nix` pipeline does the same on the NixOS
@@ -32,8 +32,11 @@ sha256sum -c --ignore-missing SHA256SUMS # every downloaded file: OK
## 2. The build
`ianitor-nix.json` names the commit the hashes were built from (`commit`; the tag's own commit, `taggedCommit`,
differs from it at most by the pin file), the nixpkgs revision of its flake.lock, and the hashes:
`ianitor-nix.json` names the commit to build, `taggedCommit` (also in `flake`), the nixpkgs revision of its
flake.lock, and the hashes. `commit` is where `nix-pin.sh` ran, for the record: the release checks that the tagged
commit holds the same source (they differ at most by the pin file, which no package's source contains), and that
`commit` does too when it is present (`commitChecked`); a pin naming a commit that no longer exists is published
with `commitChecked: false`, and that is fine, because you build `taggedCommit`:
```json
{ "version": "1.0.0", "commit": "<40 hex>", "taggedCommit": "<40 hex>", "nixpkgs": "<40 hex>", "system": "x86_64-linux",
@@ -43,7 +46,7 @@ differs from it at most by the pin file), the nixpkgs revision of its flake.lock
Build that commit and compare (Linux with Nix and flakes; nothing from Ianitor's own caches is needed):
```sh
c=$(jq -r .commit ianitor-nix.json)
c=$(jq -r .taggedCommit ianitor-nix.json)
for a in ianitor ianitor-web; do
p=$(nix build "git+https://gitea.marek-novak.cz/mnovak/Ianitor.git?rev=$c#$a" --no-link --print-out-paths)
got=$(nix path-info --json "$p" | jq -r 'if type == "array" then .[0].narHash else .[].narHash end')
@@ -57,13 +60,13 @@ hash is the content. `nix build --rebuild` builds once more locally and fails if
On a server that uses the NixOS module, the running build is `services.ianitor.package`, normally
`ianitor.packages.x86_64-linux.ianitor` from the flake input pinned in the server's `flake.lock`: if that input's
`rev` is the release's commit, `nix path-info --json $(readlink -f /run/current-system/sw/bin/ianitor-edge | sed 's#/bin/.*##')`
`rev` is the release's `taggedCommit`, `nix path-info --json $(readlink -f /run/current-system/sw/bin/ianitor-edge | sed 's#/bin/.*##')`
gives the same NAR hash.
## What this does and does not prove
- **Proves:** the release's notes, screenshots and pin are the ones Mark approved and Custos signed; the code at the
pinned commit builds to exactly the pinned bytes, on any machine with the same nixpkgs (the flake.lock is part of
tagged commit builds to exactly the pinned bytes, on any machine with the same nixpkgs (the flake.lock is part of
the commit).
- **Does not prove:** that the code is good (that is the five test layers' job, ROADMAP §5), nor anything about the
Nix binary cache you build with: a substituted dependency is trusted as Nix trusts it. `nix build --rebuild` and