ci(release): fail closed and bind gates to the candidate artifact
Make a passing CI/release result mean the checks actually ran. - .forgejo/workflows/ci.yml is fail-closed: it provisions the pinned toolchain or fails, then runs one 'make ci' (fmt-check, clippy, workspace tests, VM-harness safety tests, release build, static installer build). - Pin stable Rust 1.93.1 in installer-rs/rust-toolchain.toml; run cargo gates with --locked for reproducible dependencies. - phoebus-release gates now records passed/failed/blocked/skipped/not_run (only passed is a pass), executes real host gate commands, and imports the existing VM-harness results.json instead of a competing harness. Gates with no automation are always blocked. - Bind gate reports and harness evidence to a candidate name+SHA-256 (--candidate; PHOEBUS_VM_ARTIFACT[_SHA256]); stale or unbound evidence is failed, never passed. - publish refuses unless the report is candidate-bound and all-passed, the manifest verifies the artifact and a detached signature verifies; atomic publish preserves and restores the previous release on failure. - vmsafety.Results records the verified artifact digest; 3 new Python tests. - 20 new Rust regression tests; ADR 0012 and docs updated. Verified locally: make ci (364 Rust tests, 19 harness tests, release and static builds) exit 0; static binary is static-pie linked. CI runner, VM and model gates remain unexecuted here.
This commit is contained in:
parent
b4935578ac
commit
1d37fbc1b8
16 changed files with 1946 additions and 183 deletions
|
|
@ -1,5 +1,13 @@
|
|||
# Forgejo Actions CI. Runs only once an Actions runner is registered with this
|
||||
# label (see docs/DEVELOPMENT.md). It mirrors the local quality gates.
|
||||
# Forgejo Actions CI.
|
||||
#
|
||||
# This workflow mirrors the local quality gates exactly and is deliberately
|
||||
# fail-closed: a required check that cannot run because a tool is missing fails
|
||||
# the job rather than printing "skipping". A green job therefore means every
|
||||
# listed check actually executed.
|
||||
#
|
||||
# The Rust toolchain is pinned in `installer-rs/rust-toolchain.toml`. The runner
|
||||
# must provide either `rustup` (which installs the pin) or a cargo/rustfmt/clippy
|
||||
# toolchain; the preflight below fails clearly otherwise.
|
||||
#
|
||||
# If your runner uses different labels, change `runs-on` accordingly.
|
||||
name: ci
|
||||
|
|
@ -9,32 +17,35 @@ on:
|
|||
branches: [main]
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: ci-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
test:
|
||||
quality-gates:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Rust format
|
||||
- name: Provision the pinned Rust toolchain
|
||||
run: |
|
||||
if command -v cargo >/dev/null 2>&1; then
|
||||
cd installer-rs && cargo fmt --all -- --check
|
||||
set -euo pipefail
|
||||
if command -v rustup >/dev/null 2>&1; then
|
||||
rustup show active-toolchain
|
||||
rustup component add rustfmt clippy
|
||||
rustup target add x86_64-unknown-linux-gnu
|
||||
elif command -v cargo >/dev/null 2>&1; then
|
||||
cargo --version
|
||||
cargo fmt --version
|
||||
cargo clippy --version
|
||||
else
|
||||
echo "cargo not installed on this runner; skipping"
|
||||
echo "ERROR: no Rust toolchain on this runner." >&2
|
||||
echo "Install rustup (recommended, honours the pinned toolchain) or" >&2
|
||||
echo "provide cargo with the rustfmt and clippy components, then retry." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Rust clippy
|
||||
run: |
|
||||
if command -v cargo >/dev/null 2>&1; then
|
||||
cd installer-rs && cargo clippy --workspace --all-targets
|
||||
else
|
||||
echo "cargo not installed on this runner; skipping"
|
||||
fi
|
||||
|
||||
- name: Rust test suite
|
||||
run: |
|
||||
if command -v cargo >/dev/null 2>&1; then
|
||||
cd installer-rs && cargo test --workspace
|
||||
else
|
||||
echo "cargo not installed on this runner; skipping"
|
||||
fi
|
||||
# One command for the whole gate set, identical to local development.
|
||||
- name: Quality gates (fmt, clippy, tests, harness tests, builds)
|
||||
run: make ci
|
||||
|
|
|
|||
5
.gitignore
vendored
5
.gitignore
vendored
|
|
@ -38,3 +38,8 @@ credentials
|
|||
installer/live/build/
|
||||
installer/live/*.iso
|
||||
installer/live/*.iso.sha256
|
||||
|
||||
# --- Release verification reports and logs (regenerated; not source) --------
|
||||
gate-report*.json
|
||||
gate-logs/
|
||||
*.minisig
|
||||
|
|
|
|||
27
Makefile
27
Makefile
|
|
@ -8,7 +8,10 @@
|
|||
|
||||
SHELL := /bin/bash
|
||||
|
||||
.PHONY: help context doctor test test-rust test-vm opencode-acceptance fmt fmt-check clippy check build static vm hooks commit publish backup forgejo-init public private protect release clean
|
||||
# The release tool produced by `make build`, used by `make release-gates`.
|
||||
RELEASE ?= installer-rs/target/release/phoebus-release
|
||||
|
||||
.PHONY: help context doctor test test-rust test-vm ci opencode-acceptance fmt fmt-check clippy check build static release-gates vm hooks commit publish backup forgejo-init public private protect release clean
|
||||
|
||||
help:
|
||||
@printf 'Phoebus OS targets:\n'
|
||||
|
|
@ -17,6 +20,8 @@ help:
|
|||
@printf ' make test run the Rust and VM-harness test suites\n'
|
||||
@printf ' make test-rust cargo test --workspace\n'
|
||||
@printf ' make test-vm python3 installer/tests/vm/test_vmsafety.py\n'
|
||||
@printf ' make ci every CI quality gate (fmt, clippy, tests, builds)\n'
|
||||
@printf ' make release-gates run the executable release gates (evidence report)\n'
|
||||
@printf ' make opencode-acceptance live-model acceptance (needs PHOEBUS_OPENCODE_LIVE_*)\n'
|
||||
@printf ' make fmt cargo fmt --all\n'
|
||||
@printf ' make check fmt-check + clippy + tests\n'
|
||||
|
|
@ -40,11 +45,15 @@ doctor:
|
|||
test: test-rust test-vm
|
||||
|
||||
test-rust:
|
||||
cd installer-rs && cargo test --workspace
|
||||
cd installer-rs && cargo test --workspace --locked
|
||||
|
||||
test-vm:
|
||||
python3 installer/tests/vm/test_vmsafety.py
|
||||
|
||||
# The complete set of required CI gates. Every target here must actually run;
|
||||
# the workflow fails the job if a prerequisite is missing rather than skipping.
|
||||
ci: fmt-check clippy test-rust test-vm build static
|
||||
|
||||
# A real-model acceptance run. Fails (BLOCKED) when the live server is not
|
||||
# configured, so it can never pass by silently not running.
|
||||
opencode-acceptance:
|
||||
|
|
@ -53,7 +62,7 @@ opencode-acceptance:
|
|||
exit 2; \
|
||||
fi
|
||||
cd installer-rs && PHOEBUS_OPENCODE_REQUIRE_LIVE=1 \
|
||||
cargo test -p phoebus-executor --test opencode_live -- --nocapture
|
||||
cargo test -p phoebus-executor --test opencode_live --locked -- --nocapture
|
||||
|
||||
fmt:
|
||||
cd installer-rs && cargo fmt --all
|
||||
|
|
@ -62,16 +71,22 @@ fmt-check:
|
|||
cd installer-rs && cargo fmt --all -- --check
|
||||
|
||||
clippy:
|
||||
cd installer-rs && cargo clippy --workspace --all-targets
|
||||
cd installer-rs && cargo clippy --workspace --all-targets --locked
|
||||
|
||||
check: fmt-check clippy test
|
||||
|
||||
build:
|
||||
cd installer-rs && cargo build --release -p phoebus-installer
|
||||
cd installer-rs && cargo build --release -p phoebus-installer --locked
|
||||
|
||||
static:
|
||||
cd installer-rs && RUSTFLAGS="-C target-feature=+crt-static" \
|
||||
cargo build --release -p phoebus-installer --target x86_64-unknown-linux-gnu
|
||||
cargo build --release -p phoebus-installer --target x86_64-unknown-linux-gnu --locked
|
||||
|
||||
# Run the executable release gates and write an evidence-bound report. Host
|
||||
# gates run here; VM/seat/model gates require their environment and are
|
||||
# recorded as blocked, never silently passed.
|
||||
release-gates: build
|
||||
$(RELEASE) gates --execute --output gate-report.json
|
||||
|
||||
hooks:
|
||||
scripts/setup-hooks.sh
|
||||
|
|
|
|||
|
|
@ -8,6 +8,27 @@ Format: Keep a Changelog. Dates are UTC.
|
|||
## Unreleased
|
||||
|
||||
### Added
|
||||
- **Fail-closed CI with a full gate set.** `.forgejo/workflows/ci.yml` now runs
|
||||
one command, `make ci` (fmt-check, clippy, workspace tests, VM-harness safety
|
||||
tests, release build, static installer build). It provisions the pinned
|
||||
toolchain or fails with a clear message; a missing Cargo/rustfmt/clippy is
|
||||
never reported as a pass. The toolchain is pinned in
|
||||
`installer-rs/rust-toolchain.toml` and dependencies are checked with
|
||||
`--locked`. See ADR 0012.
|
||||
- **Executable, evidence-bound release gates.** `phoebus-release gates` now
|
||||
records `passed`/`failed`/`blocked`/`skipped`/`not_run` (only `passed` is a
|
||||
pass), actually runs host gates, and imports evidence from the existing VM
|
||||
harness `results.json` (`--harness-results`) instead of a competing harness.
|
||||
`--candidate` binds the report to an artifact digest, and the harness records
|
||||
the digest it verified from `PHOEBUS_VM_ARTIFACT[_SHA256]`, so stale evidence
|
||||
is refused. Gates without automation (`no-model-recovery`,
|
||||
`updates-and-rollback`, `desktop-session`) are always `blocked`.
|
||||
- **Publication authorization.** `phoebus-release publish` refuses unless the
|
||||
report is bound to the exact candidate digest, every gate passed, the
|
||||
candidate matches its manifest, and a detached signature verifies. Check
|
||||
failures happen before the destination is touched, and `atomic_publish`
|
||||
restores the previous release if the final rename fails.
|
||||
|
||||
- **Real OpenCode agent-server adapter.** `phoebus-executor::opencode_client`
|
||||
implements the OpenCode session/message protocol over the project's curl
|
||||
transport and the `ModelTransport` trait, so the strict proposal parser,
|
||||
|
|
@ -34,6 +55,10 @@ Format: Keep a Changelog. Dates are UTC.
|
|||
selection (`ai.backend`) in canonical configuration.
|
||||
|
||||
### Security
|
||||
- **Release evidence cannot be replayed across builds.** A gate report and
|
||||
imported harness evidence are bound to a candidate name and SHA-256; a report
|
||||
for a different digest (or unbound evidence) fails rather than authorizing a
|
||||
publication.
|
||||
- **The mandatory-AI gate now requires a validated interaction.** Both the GUI
|
||||
bridge and the installer CLI refuse to install when only a provider name is
|
||||
configured; a successful, validated model interaction bound to the current
|
||||
|
|
|
|||
|
|
@ -230,10 +230,48 @@ prerequisites, and `make test`, `make check`, `make build`, `make static`,
|
|||
|
||||
## Continuous integration
|
||||
|
||||
`.forgejo/workflows/ci.yml` mirrors the local gates (`cargo fmt`, `cargo clippy`,
|
||||
`cargo test`). It runs only once a Forgejo Actions runner is registered for the
|
||||
repository; see Forgejo's documentation for `act_runner`. Until then, run
|
||||
`make test` before pushing.
|
||||
`.forgejo/workflows/ci.yml` runs the same checks as `make ci`:
|
||||
|
||||
```sh
|
||||
make ci # fmt-check, clippy, test-rust, test-vm, build, static
|
||||
```
|
||||
|
||||
The workflow is **fail-closed**: it provisions the pinned toolchain
|
||||
(`installer-rs/rust-toolchain.toml`) or fails with a clear message, so a missing
|
||||
Cargo/rustfmt/clippy is never reported as a pass. Dependencies are checked
|
||||
against the committed `Cargo.lock` (`--locked`).
|
||||
|
||||
It runs only once a Forgejo Actions runner is registered for the repository; see
|
||||
Forgejo's documentation for `act_runner`. Until then, run `make ci` before
|
||||
pushing. A runner that uses different labels needs its `runs-on` value updated.
|
||||
|
||||
## Release verification
|
||||
|
||||
`phoebus-release` writes an evidence-bound gate report and refuses to publish
|
||||
without one (ADR 0012):
|
||||
|
||||
```sh
|
||||
# Host gates run here; VM/seat/model gates are imported from existing harness
|
||||
# results and are `blocked` without evidence.
|
||||
make release-gates
|
||||
installer-rs/target/release/phoebus-release gates --execute \
|
||||
--candidate /path/phoebus-installer-amd64.iso \
|
||||
--harness-results /var/tmp/phoebus-vm
|
||||
|
||||
# Publication requires: a candidate-bound all-passed report, a matching
|
||||
# manifest, and a verified detached signature.
|
||||
installer-rs/target/release/phoebus-release publish \
|
||||
/path/phoebus-installer-amd64.iso /srv/releases/latest.iso \
|
||||
--gate-report gate-report.json --manifest /path/phoebus-release.json \
|
||||
--signature /path/phoebus-installer-amd64.iso.minisig
|
||||
```
|
||||
|
||||
Gate outcomes are `passed`, `failed`, `blocked`, `skipped` and `not_run`; only
|
||||
`passed` is a pass. A report for one artifact digest cannot authorize another
|
||||
(`--candidate` binds the report; the harness records the digest it verified from
|
||||
`PHOEBUS_VM_ARTIFACT[_SHA256]`). `no-model-recovery`, `updates-and-rollback` and
|
||||
`desktop-session` have no automated harness yet, so they stay explicitly
|
||||
`blocked` until one exists.
|
||||
|
||||
## Backups
|
||||
|
||||
|
|
@ -247,7 +285,6 @@ Restore with `git clone /path/to/phoebus-<stamp>.bundle phoebus_os`.
|
|||
|
||||
## Quality gates before commit
|
||||
|
||||
1. `make test` (`cd installer-rs && cargo test --workspace`)
|
||||
2. `cargo fmt --all -- --check` and `cargo clippy --workspace --all-targets`
|
||||
3. Update `docs/CHANGELOG.md` and `docs/STATUS.md` when behavior changes.
|
||||
4. Commit (see `docs/GIT-WORKFLOW.md`).
|
||||
1. `make ci` (the complete gate set the CI workflow runs)
|
||||
2. Update `docs/CHANGELOG.md` and `docs/STATUS.md` when behavior changes.
|
||||
3. Commit (see `docs/GIT-WORKFLOW.md`).
|
||||
|
|
|
|||
|
|
@ -117,11 +117,10 @@ a staged file is too large, then runs the fast tests.
|
|||
|
||||
1. scans staged files for secrets (`scripts/check-secrets.sh`);
|
||||
2. blocks staged `*.iso`, `*.qcow2` and files larger than 5 MiB;
|
||||
3. runs the fast Bash test suite.
|
||||
3. optionally runs the Rust suite (set `PHOEBUS_PRECOMMIT_RUST=1` to enable).
|
||||
|
||||
Bypass for a genuine emergency with `git commit --no-verify`, or set
|
||||
`SKIP_PHOEBUS_HOOKS=1`. Set `PHOEBUS_PRECOMMIT_RUST=1` to also run
|
||||
`cargo test --workspace` in the hook.
|
||||
`SKIP_PHOEBUS_HOOKS=1`.
|
||||
|
||||
## Repository settings and hardening
|
||||
|
||||
|
|
@ -136,13 +135,17 @@ Current state:
|
|||
`enable DEST` at a synced/remote folder for a genuinely off-box copy, since
|
||||
the only git remote is one VPS.
|
||||
|
||||
### CI runner (optional)
|
||||
### CI runner (recommended)
|
||||
|
||||
`.forgejo/workflows/ci.yml` mirrors the local gates but only runs once a
|
||||
Forgejo Actions runner is registered. Install `act_runner` on a machine,
|
||||
`.forgejo/workflows/ci.yml` runs `make ci` (fmt, clippy, workspace tests,
|
||||
VM-harness safety tests, release build, static installer build). It is
|
||||
fail-closed: if the runner lacks a Rust toolchain it fails the job rather than
|
||||
skipping checks, so a green result always means the checks ran. It runs once a
|
||||
Forgejo Actions runner is registered; install `act_runner` on a machine,
|
||||
register it (Site Administration -> Actions -> Runners, or
|
||||
`act_runner register --instance https://git.phoebus.club --token <TOKEN>`), and
|
||||
run it as a service. Until then, run `make test` before pushing.
|
||||
run it with a `rustup`-provisioned toolchain (or cargo + rustfmt + clippy).
|
||||
Until then, run `make ci` before pushing.
|
||||
|
||||
### Commit signing (optional)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,36 +3,43 @@
|
|||
Rolling note between work sessions. **Update this file before you finish**, then
|
||||
commit it. It should be short and current; use `git log` for detail.
|
||||
|
||||
- **Last updated:** this session (2026-09-22), OpenCode adapter.
|
||||
- **Current focus:** Implemented a real OpenCode agent-server adapter
|
||||
(`phoebus-executor::opencode_client`) that speaks the session/message protocol
|
||||
over curl and implements `ModelTransport`, wired into canonical config
|
||||
(`ai.backend = "opencode"`), the GUI ("OpenCode agent" + Test connection),
|
||||
the installer CLI (`--ai-backend opencode`, `--opencode-test`) and `sys ask`.
|
||||
The mandatory-AI gate now requires a validated interaction with invalidated
|
||||
state. The probe/transport were hardened (loopback/TLS policy, DNS pinning,
|
||||
status checks, auth), and the GUI harness gained exact-session and
|
||||
frontend-state assertions.
|
||||
- **Last updated:** this session (2026-09-22), CI and release verification
|
||||
hardening (branch `codex/harden-ci-release-verification`).
|
||||
- **Current focus:** Made CI and release verification mean what they claim.
|
||||
(1) `.forgejo/workflows/ci.yml` is fail-closed: it provisions the pinned
|
||||
toolchain or fails, and runs one `make ci` (fmt-check, clippy, workspace
|
||||
tests, VM-harness safety tests, release build, static installer build).
|
||||
`installer-rs/rust-toolchain.toml` pins stable 1.93.1; all cargo gates use
|
||||
`--locked`. (2) `phoebus-release` gate statuses are now
|
||||
`passed`/`failed`/`blocked`/`skipped`/`not_run` (only `passed` is a pass);
|
||||
host gates execute real commands; VM/seat/model gates import the existing VM
|
||||
harness `results.json` (`--harness-results`). (3) Gate reports and harness
|
||||
evidence are bound to a candidate name+SHA-256 (`--candidate`;
|
||||
`PHOEBUS_VM_ARTIFACT[_SHA256]`), so stale evidence cannot authorize another
|
||||
build. (4) `publish` refuses unless the report is candidate-bound and
|
||||
all-passed, the manifest verifies the artifact and a detached signature
|
||||
verifies; `atomic_publish` restores the previous release on failure.
|
||||
- **Last verified (this session):**
|
||||
- 336 Rust tests + 16 harness tests green; fmt/clippy clean.
|
||||
- Real inference through `opencode 1.18.32` with `deepseek-v4-flash`;
|
||||
`--opencode-test` → `{"phoebus":"ok"}`; the GUI bridge `ai_check` applied 8
|
||||
reviewed changes; `sys ask` proposed and ran a read-only action.
|
||||
- Auth: none → `authentication_required`, wrong → `authentication_rejected`,
|
||||
correct → `model_catalog` + successful inference. Plain http to a LAN host
|
||||
→ `insecure_transport`, exit 1, no request sent.
|
||||
- 7 real-HTTP integration tests (status, chunked multibyte, oversize,
|
||||
redirect, disconnect, auth) and 2 env-gated live tests.
|
||||
- GUI acceptance in a disposable VM: `gui-driver.py opencode` passed 17/17
|
||||
(selected OpenCode, entered the endpoint/model through the UI, real model
|
||||
response + validated proposal); `gui-driver.py gui` passed 25/25.
|
||||
ISO `sha256 4db98db3…`, static binary `sha256 72c2dcd0…`.
|
||||
- **Not yet verified this session:** the full graphical **installation** through
|
||||
OpenCode past the AI gate (disk/account/review/ERASE/install/detached boot),
|
||||
and a separate physical computer. The pinned manifest is `v1.18.31` while the
|
||||
tested binary is `1.18.32`. On this server use `deepseek-flash`; the model
|
||||
must match the server's catalog (the GUI default `deepseek-chat` does not
|
||||
exist on it).
|
||||
- 364 Rust tests + 19 harness tests green; `cargo fmt --all -- --check` and
|
||||
`cargo clippy --workspace --all-targets` clean (exit 0); `make ci` exit 0.
|
||||
- Release build and static installer build succeed; the static binary is
|
||||
`static-pie linked` (4.99 MB).
|
||||
- New regression tests (20 Rust + 3 Python) cover: absent prerequisites are
|
||||
`blocked`; a failed host gate is `failed` with diagnostics; explicit skips
|
||||
and `--only` are never passes; manual gates are `blocked`; stale or
|
||||
unbound harness evidence is `failed`; `publish` refuses on not-run gates,
|
||||
unbound/stale reports, missing manifest, manifest mismatch, missing or
|
||||
failing signature, and a failed publication leaves the previous release
|
||||
intact.
|
||||
- CLI smoke: `gates` (all `not_run`), `gates --execute --only rust-fmt`
|
||||
(executes and reports `passed`), harness-evidence import (`install`
|
||||
`passed`), and `publish` refusal on an unbound report.
|
||||
- **Not yet verified this session:** no Forgejo Actions runner is registered,
|
||||
so the workflow is unexecuted. The VM, graphical-seat and live-model gates
|
||||
are `blocked` here (no disposable VM/model in this environment).
|
||||
`no-model-recovery`, `updates-and-rollback` and `desktop-session` have no
|
||||
automated harness yet and are always `blocked`, so a full publication is not
|
||||
possible until they are automated (intentional: no false pass).
|
||||
- **Public repo:** <https://git.phoebus.club/phoebus/phoebus_os>
|
||||
(remote `origin`, SSH port 2222).
|
||||
|
||||
|
|
@ -55,11 +62,24 @@ commit it. It should be short and current; use `git log` for detail.
|
|||
5. **Physical-seat desktop**: run `phoebus-session` on a real VT/seat and check
|
||||
`phoebus-menu`, `phoebus-lock`, `phoebus-idle`, kitty, XWayland, the polkit
|
||||
agent, logout/reap and reboot (`docs/DEVELOPMENT.md`).
|
||||
6. **Release gates on a CI runner**: `phoebus-release gates --execute` and
|
||||
`publish` once a runner exists; no gate has executed.
|
||||
6. **Register a Forgejo Actions runner** and confirm `make ci` runs green
|
||||
there; no runner is registered, so `.forgejo/workflows/ci.yml` is
|
||||
unexecuted. `make ci` passes locally, but that is not CI verification.
|
||||
7. **Automate the three blocked release gates**: `no-model-recovery`,
|
||||
`updates-and-rollback` and `desktop-session` have no harness scenario yet,
|
||||
so they are always `blocked` and a full publication is impossible. Add
|
||||
harness modes (or reviewed manual evidence) and re-run
|
||||
`make release-gates`.
|
||||
|
||||
## Known blockers / risks
|
||||
|
||||
- **No Forgejo Actions runner is registered**, so `.forgejo/workflows/ci.yml`
|
||||
is unexecuted; `make ci` is green locally only. Registering an `act_runner`
|
||||
with a rustup toolchain is the external prerequisite (ADR 0012).
|
||||
- **A full release cannot be authorized yet**: `no-model-recovery`,
|
||||
`updates-and-rollback` and `desktop-session` have no automated harness, so
|
||||
the gate report is never all-passed. This is deliberate until they are
|
||||
automated.
|
||||
- No live DeepSeek/OpenAI key and no local model are available; the **full GUI
|
||||
install past the AI step** and two fresh-disk graphical installs are NOT
|
||||
verified (normal installation requires a connected model). The AI step is
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ more interesting. Status vocabulary: **Done**, **Partial**, **Next**, **Later**.
|
|||
| 11 | AI privilege and privacy architecture | Partial | typed actions + enforced privacy boundary + guided proposal review + OS-level sandbox (systemd-run hardening) + approval-bound resolved effects; live call/sandbox not VM-verified |
|
||||
| 12 | `sys` operations | Partial | history, enable/disable, inspect, install, prepare-updates VM-verified; `undo`, `undo status`, `ask` added (unit-tested, VM gate pending) |
|
||||
| 13 | Kernel optimization policy | Later | conservative fragments only; SAFE/OPTIMIZED/AGGRESSIVE selection exists |
|
||||
| 14 | ISO / release pipeline | Partial | manifest/verify/assemble-plan tooling; release gates, atomic publish and signing helpers added; no CI runner has executed a gate |
|
||||
| 14 | ISO / release pipeline | Partial | manifest/verify/assemble tooling; executable evidence-bound gates + publication authorization (ADR 0012); no CI runner has executed a gate |
|
||||
| 15 | Recovery environment | Later | recovery BLS entry generated; snapshot-based recovery entry written at install; full recovery image not built |
|
||||
| — | Rust TUI | Partial | ratatui UI with plan/ERASE and AI provider selection; not yet the default on all paths |
|
||||
| — | Graphical installer (welcome + wizard) | Partial | Quickshell/QML over the typed `--gui-bridge`; live graphical VM verified, including a detached install+boot; live AI call pending (ADR 0010) |
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ still not VM-verified.
|
|||
| Live desktop ISO (Mango + DMS) | yes | guards tested | graphical VM + GUI journey + detached boot | no |
|
||||
| Live welcome autostart + duplicate prevention | yes | guards tested | live graphical VM | no |
|
||||
| Welcome primary action keyboard-focus | yes | guards tested | live graphical VM | no |
|
||||
| VM harness disk safety + structured results | yes | yes (16 tests) | n/a | n/a |
|
||||
| VM harness disk safety + structured results + artifact binding | yes | yes (19 tests) | n/a | n/a |
|
||||
| Target disk revalidation before partition | yes | yes | no | n/a |
|
||||
| Bridge replay/concurrency + input bounds | yes | yes | no | n/a |
|
||||
| Provider transport endpoint/size hardening | yes | yes | no | n/a |
|
||||
|
|
@ -105,7 +105,10 @@ still not VM-verified.
|
|||
| OpenCode full graphical install | yes | yes | AI gate passed; install not run | n/a |
|
||||
| Mandatory AI requires a validated interaction | yes | yes | bridge + CLI | n/a |
|
||||
| GURU packaging (scoped keywords) | yes | yes | no (build/install unverified) | no |
|
||||
| Release gates + atomic publish | yes | yes | no | n/a |
|
||||
| Fail-closed CI (`make ci`, pinned toolchain) | yes | yes (`make ci` green locally) | no runner registered | n/a |
|
||||
| Executable release gates + evidence-bound publish | yes | yes | no (no VM/model here) | n/a |
|
||||
| Harness evidence import + stale-evidence refusal | yes | yes | no | n/a |
|
||||
| Atomic publish + previous-release preservation | yes | yes | no | n/a |
|
||||
| `sys` verbs | yes | yes | yes | no |
|
||||
| OpenCode pinned bootstrap | yes | yes | no | n/a |
|
||||
| Release manifest/verify | yes | yes | no | n/a |
|
||||
|
|
@ -160,9 +163,19 @@ still not VM-verified.
|
|||
the argv level) and fails closed without `systemd-run`; it has not been
|
||||
exercised in a VM. Only typed actions and the privacy boundary were previously
|
||||
enforced.
|
||||
- **Release automation** now has gates, a report, atomic publish and signing
|
||||
command helpers, but no gate has been executed by a configured CI runner; the
|
||||
report records unexecuted gates as `NotRun`.
|
||||
- **Release gates are executable and evidence-bound (ADR 0012).** `make ci`
|
||||
runs fmt/clippy/tests/harness-tests/builds and is fail-closed. `phoebus-release
|
||||
gates --execute` runs host gates and imports VM/seat/model evidence from the
|
||||
existing harness `results.json`; unexecuted, blocked or skipped gates are
|
||||
never passes. `publish` refuses unless the report is bound to the exact
|
||||
candidate digest, every gate passed, the manifest verifies the artifact and a
|
||||
detached signature verifies. **No CI runner is registered**, so the workflow
|
||||
itself is unexecuted; the VM, graphical-seat and live-model gates are
|
||||
**blocked** here (no disposable VM or model in this environment).
|
||||
`no-model-recovery`, `updates-and-rollback` and `desktop-session` have no
|
||||
automated harness yet and are always `blocked`, so a full release cannot be
|
||||
authorized until they are automated (or given reviewed manual evidence). That
|
||||
is intentional: no false pass.
|
||||
- The desktop transaction compiles heavily because desktop USE does not match
|
||||
the signed binhost (~26 min for the desktop set on 8 vCPUs in the test VM).
|
||||
The official Gentoo binhost is OpenRC/hardened, so a systemd system can only
|
||||
|
|
|
|||
78
docs/adr/0012-release-verification-and-publication.md
Normal file
78
docs/adr/0012-release-verification-and-publication.md
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
# ADR 0012: Release verification evidence and publication authorization
|
||||
|
||||
- **Status:** Accepted
|
||||
- **Date:** 2026-09-22
|
||||
|
||||
## Context
|
||||
|
||||
Two failure modes made a passing result meaningless:
|
||||
|
||||
1. **CI skipped required checks.** `.forgejo/workflows/ci.yml` wrapped every
|
||||
Rust step in `if command -v cargo; then ...; else echo "skipping"; fi`. A
|
||||
runner without Cargo reported green while running nothing.
|
||||
2. **Release gates did not execute and were not bound to an artifact.**
|
||||
`phoebus-release gates --execute` ran no command (there were no host gates,
|
||||
and every non-host gate was recorded `not_run`). `publish` accepted any
|
||||
report whose results were all `passed`, without checking that the report
|
||||
described the artifact being published, that the artifact matched its
|
||||
manifest, or that a signature had been verified. A stale report for an old
|
||||
build could therefore authorize a different one.
|
||||
|
||||
The project already has a disposable VM harness (`installer/tests/vm/*.py`)
|
||||
that writes structured `results.json`. A second, competing harness is not
|
||||
wanted.
|
||||
|
||||
## Decision
|
||||
|
||||
1. **CI is fail-closed.** The workflow provisions the pinned toolchain or fails
|
||||
with a clear message; it never treats a missing prerequisite as a pass. The
|
||||
whole required set is one command, `make ci`, so CI and local development run
|
||||
the same checks (fmt, clippy, workspace tests, VM-harness safety tests,
|
||||
release build, static installer build). The toolchain is pinned in
|
||||
`installer-rs/rust-toolchain.toml` and dependencies use the committed
|
||||
`Cargo.lock` (`--locked`).
|
||||
2. **Gate outcomes are distinct.** A gate is `passed`, `failed`, `blocked`,
|
||||
`skipped` or `not_run`; **only `passed` is a pass**. `blocked` means a
|
||||
prerequisite (VM, graphical seat, model, CI runner, or an automated command)
|
||||
is missing; `skipped` means an operator excluded it; `not_run` means
|
||||
execution was not requested.
|
||||
3. **Gates perform their advertised check.** Host gates run their real command
|
||||
through the command layer and record the exit status. VM/seat/model gates
|
||||
name the real harness scenario and are resolved from that harness's
|
||||
`results.json` (reusing the existing harness); with no evidence they are
|
||||
`blocked`. Gates whose automation does not exist yet have an empty command
|
||||
and can only ever be `blocked`.
|
||||
4. **Evidence is bound to the artifact.** `phoebus-release gates --candidate
|
||||
<file>` records the candidate's name and SHA-256 in the report; the harness
|
||||
records the digest it verified from `PHOEBUS_VM_ARTIFACT[_SHA256]`. Imported
|
||||
evidence whose digest differs from the candidate is reported as `failed`
|
||||
("stale evidence"), never passed.
|
||||
5. **Publication is authorized, not assumed.** `phoebus-release publish`
|
||||
refuses unless the report is bound to the exact candidate digest, every gate
|
||||
passed, the candidate matches its manifest entry, and a detached signature
|
||||
verifies. Check failures happen before the destination is touched.
|
||||
`atomic_publish` keeps `latest.iso.prev` and restores it if the final rename
|
||||
fails, so a failed or interrupted publication never removes the working
|
||||
release.
|
||||
|
||||
## Consequences
|
||||
|
||||
- A green CI job means the listed checks actually ran. There is no "skipping"
|
||||
path for a required check.
|
||||
- `make release-gates` writes a report that reflects reality. Because
|
||||
`no-model-recovery`, `updates-and-rollback` and `desktop-session` have no
|
||||
automated harness yet, they are always `blocked`, so a full release cannot be
|
||||
authorized until those checks are automated (or given reviewed manual
|
||||
evidence). This is deliberate: it is preferable to be unable to publish than
|
||||
to publish on a false pass.
|
||||
- The release report and per-gate logs are diagnostics, not source; they are
|
||||
gitignored, redacted with the environment redactor, and bounded in size.
|
||||
- The remaining external prerequisite is a registered Forgejo Actions runner;
|
||||
until one exists the workflow is unexecuted and is recorded as such.
|
||||
|
||||
## Status
|
||||
|
||||
Accepted and implemented. The gate engine, harness-evidence import, artifact
|
||||
binding and publication refusals are covered by unit tests; `make ci` passes
|
||||
locally. CI execution and VM/model gates remain unverified here (no runner, no
|
||||
disposable VM or model in this environment).
|
||||
|
|
@ -17,5 +17,6 @@ and link it here.
|
|||
| [0009](0009-mango-dankmaterialshell-desktop.md) | Mango + DankMaterialShell desktop option | Accepted |
|
||||
| [0010](0010-graphical-installer-frontend.md) | Graphical installer frontend and typed bridge | Accepted |
|
||||
| [0011](0011-opencode-connection-boundary.md) | OpenCode connection boundary | Accepted |
|
||||
| [0012](0012-release-verification-and-publication.md) | Release verification evidence and publication authorization | Accepted |
|
||||
|
||||
Format: Context / Decision / Consequences / Status.
|
||||
|
|
|
|||
|
|
@ -8,9 +8,11 @@ use std::process::ExitCode;
|
|||
|
||||
use clap::{Parser, Subcommand};
|
||||
use phoebus_core::VERSION;
|
||||
use phoebus_executor::{CommandSpec, ProcessRunner, RealRunner};
|
||||
use phoebus_installer::release::{
|
||||
artifact_for, atomic_publish, default_manifest_path, run_gates, sha256_file, sign_command,
|
||||
verify_signature_command, GateReport, ReleaseManifest,
|
||||
artifact_for, candidate_ref, default_manifest_path, publish_release, run_gates, sha256_file,
|
||||
sign_command, verify_signature_command, GateOptions, GateReport, HarnessEvidenceSet,
|
||||
MinisignVerifier, PublishRequest, ReleaseManifest, SystemGateExecutor,
|
||||
};
|
||||
|
||||
#[derive(Parser)]
|
||||
|
|
@ -51,22 +53,49 @@ enum Command {
|
|||
#[arg(long)]
|
||||
output: PathBuf,
|
||||
},
|
||||
/// Write the candidate gate report. `--execute` runs host gates; VM,
|
||||
/// graphical-seat and model gates need their environment and are recorded
|
||||
/// as not run otherwise.
|
||||
/// Write the candidate gate report.
|
||||
///
|
||||
/// Without `--execute` every gate is recorded as `not_run` and never as a
|
||||
/// pass. With `--execute`, host gates run their real commands; VM, seat and
|
||||
/// model gates are resolved from `--harness-results` when supplied, and are
|
||||
/// otherwise recorded as `blocked` (never silently passed).
|
||||
Gates {
|
||||
#[arg(long, default_value = "gate-report.json")]
|
||||
output: PathBuf,
|
||||
#[arg(long)]
|
||||
execute: bool,
|
||||
/// Bind the report to this candidate artifact's digest.
|
||||
#[arg(long)]
|
||||
candidate: Option<PathBuf>,
|
||||
/// Import VM-harness `results.json` files from this file or directory.
|
||||
#[arg(long)]
|
||||
harness_results: Option<PathBuf>,
|
||||
/// Record a gate as `skipped` (repeatable). A skipped gate is never a
|
||||
/// pass, so this cannot be used to authorize a publication.
|
||||
#[arg(long = "skip")]
|
||||
skip: Vec<String>,
|
||||
/// Run only these gates (repeatable); the rest are `skipped`.
|
||||
#[arg(long = "only")]
|
||||
only: Vec<String>,
|
||||
/// Directory for redacted per-gate failure logs.
|
||||
#[arg(long)]
|
||||
log_dir: Option<PathBuf>,
|
||||
},
|
||||
/// Publish a candidate atomically, refusing unless a passing gate report is
|
||||
/// supplied. The previous release is preserved.
|
||||
/// Publish a candidate atomically. Refuses unless the gate report is bound
|
||||
/// to the exact candidate digest, every gate passed, the manifest verifies
|
||||
/// the artifact and a detached signature verifies. The previous release is
|
||||
/// preserved.
|
||||
Publish {
|
||||
candidate: PathBuf,
|
||||
dest: PathBuf,
|
||||
#[arg(long)]
|
||||
gate_report: PathBuf,
|
||||
/// The manifest the candidate is verified against.
|
||||
#[arg(long)]
|
||||
manifest: Option<PathBuf>,
|
||||
/// The detached signature (`*.minisig`) for the candidate.
|
||||
#[arg(long)]
|
||||
signature: Option<PathBuf>,
|
||||
},
|
||||
/// Print the signing command for an artifact (key outside the repository).
|
||||
Sign { artifact: PathBuf, key: PathBuf },
|
||||
|
|
@ -86,6 +115,20 @@ fn main() -> ExitCode {
|
|||
}
|
||||
}
|
||||
|
||||
/// The short source commit the tool is running against, for evidence binding.
|
||||
fn git_commit() -> String {
|
||||
let spec = CommandSpec::new("release", "git-rev-parse", "git")
|
||||
.arg("rev-parse")
|
||||
.arg("--short")
|
||||
.arg("HEAD");
|
||||
RealRunner
|
||||
.execute(&spec)
|
||||
.ok()
|
||||
.filter(|output| output.success)
|
||||
.map(|output| output.stdout_lossy().trim().to_string())
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
fn run() -> std::result::Result<(), Box<dyn std::error::Error>> {
|
||||
match Cli::parse().command {
|
||||
Command::Manifest {
|
||||
|
|
@ -163,24 +206,65 @@ fn run() -> std::result::Result<(), Box<dyn std::error::Error>> {
|
|||
println!("{}", sha256_file(&file)?);
|
||||
Ok(())
|
||||
}
|
||||
Command::Gates { output, execute } => {
|
||||
let report = run_gates(execute);
|
||||
Command::Gates {
|
||||
output,
|
||||
execute,
|
||||
candidate,
|
||||
harness_results,
|
||||
skip,
|
||||
only,
|
||||
log_dir,
|
||||
} => {
|
||||
let bound = match &candidate {
|
||||
Some(path) => Some(candidate_ref(path)?),
|
||||
None => None,
|
||||
};
|
||||
let evidence = match &harness_results {
|
||||
Some(path) => Some(HarnessEvidenceSet::from_path(path)?),
|
||||
None => None,
|
||||
};
|
||||
let log_dir = log_dir.or_else(|| {
|
||||
Some(
|
||||
output
|
||||
.parent()
|
||||
.unwrap_or_else(|| std::path::Path::new("."))
|
||||
.join("gate-logs"),
|
||||
)
|
||||
});
|
||||
let options = GateOptions {
|
||||
execute,
|
||||
skip,
|
||||
only,
|
||||
candidate: bound,
|
||||
evidence: evidence.as_ref(),
|
||||
log_dir,
|
||||
git_commit: git_commit(),
|
||||
build_id: std::env::var("PHOEBUS_BUILD_ID").unwrap_or_default(),
|
||||
};
|
||||
let report = run_gates(&SystemGateExecutor, &options);
|
||||
report.save(&output)?;
|
||||
println!(
|
||||
"wrote {} ({} passed, {} not run)",
|
||||
output.display(),
|
||||
report
|
||||
.results
|
||||
.iter()
|
||||
.filter(|r| r.status == phoebus_installer::release::GateStatus::Passed)
|
||||
.count(),
|
||||
report.not_run()
|
||||
);
|
||||
println!("wrote {} ({})", output.display(), report.summary_line());
|
||||
for result in &report.results {
|
||||
println!(
|
||||
" {:<18} {:<8} {}",
|
||||
result.name,
|
||||
result.status.as_str(),
|
||||
result.detail
|
||||
);
|
||||
}
|
||||
if !execute {
|
||||
eprintln!(
|
||||
"note: gates were not executed; pass --execute on a configured runner \
|
||||
to run them"
|
||||
to run them. An unexecuted gate is never a pass."
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
if !report.all_passed() {
|
||||
return Err(format!(
|
||||
"candidate checks did not all pass ({})",
|
||||
report.summary_line()
|
||||
)
|
||||
.into());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -188,22 +272,22 @@ fn run() -> std::result::Result<(), Box<dyn std::error::Error>> {
|
|||
candidate,
|
||||
dest,
|
||||
gate_report,
|
||||
manifest,
|
||||
signature,
|
||||
} => {
|
||||
let report = GateReport::load(&gate_report)?;
|
||||
if !report.all_passed() {
|
||||
return Err(format!(
|
||||
"refusing to publish: {} gate(s) passed, {} not run \
|
||||
(run the gates on a configured runner and supply a passing report)",
|
||||
report
|
||||
.results
|
||||
.iter()
|
||||
.filter(|r| r.status == phoebus_installer::release::GateStatus::Passed)
|
||||
.count(),
|
||||
report.not_run()
|
||||
)
|
||||
.into());
|
||||
}
|
||||
atomic_publish(&candidate, &dest)?;
|
||||
let manifest = match &manifest {
|
||||
Some(path) => Some(ReleaseManifest::load(path)?),
|
||||
None => None,
|
||||
};
|
||||
let request = PublishRequest {
|
||||
candidate: &candidate,
|
||||
dest: &dest,
|
||||
report: &report,
|
||||
manifest: manifest.as_ref(),
|
||||
signature: signature.as_deref(),
|
||||
};
|
||||
publish_release(&request, &MinisignVerifier)?;
|
||||
println!("published {} -> {}", candidate.display(), dest.display());
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
10
installer-rs/rust-toolchain.toml
Normal file
10
installer-rs/rust-toolchain.toml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# Pinned stable Rust toolchain for reproducible builds and CI.
|
||||
#
|
||||
# This is a stable release, not a nightly: the project's stability policy
|
||||
# forbids release candidates and unstable defaults. Rustup-managed hosts will
|
||||
# use this automatically; the distribution toolchain ignores the file.
|
||||
[toolchain]
|
||||
channel = "1.93.1"
|
||||
profile = "minimal"
|
||||
components = ["rustfmt", "clippy"]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
|
@ -9,6 +9,7 @@ in CI, not only during a live install:
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
import socket
|
||||
import subprocess
|
||||
|
|
@ -16,9 +17,12 @@ import tempfile
|
|||
import threading
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from unittest import mock
|
||||
|
||||
import vmsafety
|
||||
from vmsafety import (
|
||||
ARTIFACT_ENV_NAME,
|
||||
ARTIFACT_ENV_SHA256,
|
||||
BLOCKED,
|
||||
FAIL,
|
||||
PASS,
|
||||
|
|
@ -166,6 +170,53 @@ class ResultsTests(unittest.TestCase):
|
|||
return Path(tmp.name)
|
||||
|
||||
|
||||
class ArtifactBindingTests(unittest.TestCase):
|
||||
"""The release tool binds evidence to a candidate digest; a harness run
|
||||
must record the artifact it verified, or a stale pass could be replayed."""
|
||||
|
||||
def _tmp_results(self):
|
||||
tmp = tempfile.NamedTemporaryFile(delete=False, suffix=".json")
|
||||
tmp.close()
|
||||
self.addCleanup(os.unlink, tmp.name)
|
||||
return Path(tmp.name)
|
||||
|
||||
def test_artifact_from_env_is_written(self):
|
||||
with mock.patch.dict(
|
||||
os.environ,
|
||||
{ARTIFACT_ENV_NAME: "phoebus.iso", ARTIFACT_ENV_SHA256: "abc123"},
|
||||
):
|
||||
results = Results("unit")
|
||||
results.pass_("one")
|
||||
# write() is what records the binding, so exercise it directly.
|
||||
path = results.write(self._tmp_results())
|
||||
data = json.loads(path.read_text())
|
||||
self.assertEqual(data["artifact"], {"name": "phoebus.iso", "sha256": "abc123"})
|
||||
|
||||
def test_artifact_absent_is_null(self):
|
||||
clean = {
|
||||
k: v
|
||||
for k, v in os.environ.items()
|
||||
if k not in (ARTIFACT_ENV_NAME, ARTIFACT_ENV_SHA256)
|
||||
}
|
||||
with mock.patch.dict(os.environ, clean, clear=True):
|
||||
results = Results("unit")
|
||||
results.pass_("one")
|
||||
data = json.loads(results.write(self._tmp_results()).read_text())
|
||||
self.assertIsNone(data["artifact"])
|
||||
|
||||
def test_explicit_binding_is_not_overridden_by_env(self):
|
||||
with mock.patch.dict(
|
||||
os.environ,
|
||||
{ARTIFACT_ENV_NAME: "env.iso", ARTIFACT_ENV_SHA256: "env-digest"},
|
||||
):
|
||||
results = Results("unit")
|
||||
results.bind_artifact("explicit.iso", "explicit-digest")
|
||||
data = json.loads(results.write(self._tmp_results()).read_text())
|
||||
self.assertEqual(
|
||||
data["artifact"], {"name": "explicit.iso", "sha256": "explicit-digest"}
|
||||
)
|
||||
|
||||
|
||||
class FakeQmpServer(threading.Thread):
|
||||
"""A tiny QMP server that records HMP commands and answers them."""
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,12 @@ NOT_RUN = "NOT RUN"
|
|||
|
||||
_TERMINAL = (PASS, FAIL, BLOCKED, SKIPPED)
|
||||
|
||||
# The candidate artifact a harness run is executed against. The release tool
|
||||
# binds a gate report to a specific digest; recording it here is what lets a
|
||||
# later verification step refuse stale evidence rather than trust any pass.
|
||||
ARTIFACT_ENV_NAME = "PHOEBUS_VM_ARTIFACT"
|
||||
ARTIFACT_ENV_SHA256 = "PHOEBUS_VM_ARTIFACT_SHA256"
|
||||
|
||||
|
||||
class UnsafeDiskError(Exception):
|
||||
"""A writable target violated the disposable-disk rules."""
|
||||
|
|
@ -81,10 +87,30 @@ class Results:
|
|||
self.scenario = scenario
|
||||
self.run_id = run_id or new_run_id(scenario)
|
||||
self.checks: list[Check] = []
|
||||
# The candidate artifact this run verifies (name + sha256), if known.
|
||||
self.artifact: dict | None = None
|
||||
if strict is None:
|
||||
strict = os.environ.get("PHOEBUS_VM_STRICT", "").lower() in ("1", "yes", "true")
|
||||
self.strict = bool(strict)
|
||||
|
||||
# -- candidate artifact binding ---------------------------------------
|
||||
def bind_artifact(self, name: str, sha256: str) -> dict:
|
||||
"""Record the candidate artifact (name + digest) this run verified."""
|
||||
self.artifact = {"name": name, "sha256": sha256}
|
||||
return self.artifact
|
||||
|
||||
def bind_artifact_from_env(self) -> dict | None:
|
||||
"""Bind from ``PHOEBUS_VM_ARTIFACT[_SHA256]`` when both are present.
|
||||
|
||||
The drivers call this through :meth:`write`, so a run always records the
|
||||
digest of the candidate it exercised (when the launcher supplied it).
|
||||
"""
|
||||
name = os.environ.get(ARTIFACT_ENV_NAME)
|
||||
sha256 = os.environ.get(ARTIFACT_ENV_SHA256)
|
||||
if name and sha256:
|
||||
return self.bind_artifact(name, sha256)
|
||||
return self.artifact
|
||||
|
||||
# -- recording ---------------------------------------------------------
|
||||
def _add(self, name: str, status: str, detail: str) -> Check:
|
||||
if status not in _TERMINAL:
|
||||
|
|
@ -148,12 +174,15 @@ class Results:
|
|||
def write(self, path: str | Path) -> Path:
|
||||
path = Path(path)
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
if self.artifact is None:
|
||||
self.bind_artifact_from_env()
|
||||
payload = {
|
||||
"scenario": self.scenario,
|
||||
"run_id": self.run_id,
|
||||
"strict": self.strict,
|
||||
"exit_code": self.exit_code(),
|
||||
"counts": self.counts(),
|
||||
"artifact": self.artifact,
|
||||
"checks": [c.to_dict() for c in self.checks],
|
||||
}
|
||||
path.write_text(json.dumps(payload, indent=2) + "\n")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue