[fabrica] Release pin (QC M1): nix-pin.sh pins a clean commit and records it, its source tree and nixpkgs; release-pin.mjs refuses a pin whose source tree is not the tag's and publishes the pinned commit; docs say what is checked (one rebuild of the outputs) and that none of it has run yet

This commit is contained in:
2026-11-22 18:49:35 +01:00
parent 43a0dfdadc
commit b492ccf5f9
8 changed files with 140 additions and 59 deletions
+21 -12
View File
@@ -1,12 +1,15 @@
# Verifying a release
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 tag's commit and the
NAR hash of every Nix output (`.#ianitor`, the two binaries; `.#ianitor-web`, the built UI). Ianitor ships no
binary download: you build the tag yourself (or your server does, through the NixOS module) and check that you got
exactly the bytes the release vouches for. The build is reproducible: `scripts/nix-pin.sh` builds each output twice
from scratch and refuses to pin one whose bytes differ, and the `verify-nix` pipeline rebuilds every tag on the
NixOS runner and compares.
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)
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
runner for every tag. **None of this has run yet:** the first pin needs a Linux machine with Nix, and the
development machine has had none since phase 4 began, so no release so far carries a pin and nothing here is
shown reproducible across machines until two independent builds have matched.
## 1. The signature
@@ -29,10 +32,11 @@ sha256sum -c --ignore-missing SHA256SUMS # every downloaded file: OK
## 2. The build
`ianitor-nix.json` names the commit and the hashes:
`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:
```json
{ "version": "1.0.0", "commit": "<40 hex>", "system": "x86_64-linux",
{ "version": "1.0.0", "commit": "<40 hex>", "taggedCommit": "<40 hex>", "nixpkgs": "<40 hex>", "system": "x86_64-linux",
"outputs": { "ianitor": { "storePath": "/nix/store/…-ianitor-1.0.0", "narHash": "sha256-…" }, … } }
```
@@ -67,12 +71,17 @@ gives the same NAR hash.
## For Mark: making the pin before a tag
On a Linux machine with Nix (WSL2 Debian works), at the commit to be tagged:
On a Linux machine with Nix, at a clean commit, the last one before the tag:
```sh
scripts/nix-pin.sh # builds twice, writes .fabrica/nix/pin.json
scripts/nix-pin.sh # builds, rebuilds the outputs, writes .fabrica/nix/pin.json
git add .fabrica/nix/pin.json && git commit -m "[repo] Release: the Nix pin of X.Y.Z"
git tag vX.Y.Z # on that commit: it differs from the pinned one only by the pin
```
The pin lies outside every package's source, so the commit does not change what it pins. The `release` pipeline's
`pin` step refuses a pin of another version, so a forgotten pin stops the release before anything is published.
The pin records its commit and that commit's source tree (every tracked file but the pin itself). The `release`
pipeline's `pin` step (`scripts/release-pin.mjs`) refuses a missing pin, a pin of another version, and a pin whose
source tree is not the tagged commit's: so "pin at A, fixes land at B, tag B" stops the release before anything is
published, and the pin has to be made again at B. That check is the gate: Fabrica's pipelines cannot depend on
each other, so `publish` cannot wait for `verify-nix`, which runs on the same tag as an independent second
build.