[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:
@@ -38,8 +38,9 @@ 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. The build is reproducible: rebuild the tag and you get the same bytes
|
||||
(docs/verify.md tells you how).
|
||||
and the NAR hashes of the Nix build. Rebuild the pinned 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.]
|
||||
|
||||
## Five test layers
|
||||
|
||||
|
||||
+7
-4
@@ -22,15 +22,18 @@ 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) with the tag and commit; refuses a pin of another version | `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, and one made from other code than the tag's; publishes the pinned commit | `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`), and the build is reproducible: anyone
|
||||
rebuilds the tag and compares ([verify.md](verify.md)); the `verify-nix` pipeline does exactly that on every
|
||||
`v*` tag on the NixOS runner.
|
||||
NAR hashes instead (`ianitor-nix.json`, under the signed `SHA256SUMS`): anyone rebuilds the pinned 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"
|
||||
covers so far: the output derivations are rebuilt once and compared; their dependencies come from the binary
|
||||
cache. Nothing of it has run yet (no machine with Nix in phase 4); the first pin needs one.
|
||||
|
||||
The Rust tests are not in it: the edge, diff and ACME tests are Linux-only (ROADMAP §8.3) and the release builds
|
||||
nothing. They run in WSL2 and in the Nix build.
|
||||
|
||||
+21
-12
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user