Skip to content

ci(cachix): make image-closure Cachix push first-class and blocking - #789

Merged
c-vigo merged 3 commits into
devfrom
feature/776-cachix-image-closure
Jul 1, 2026
Merged

c-vigo merged 3 commits into
devfrom
feature/776-cachix-image-closure

Conversation

@c-vigo

@c-vigo c-vigo commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Makes the devcontainer image closure push to the vig-os Cachix cache
first-class and blocking on the trusted paths (push to dev and releases),
so published images are guaranteed cache-backed and consumers substitute the
pinned closure instead of rebuilding it from source. Previously the image
closure only reached the cache incidentally (a non-blocking, discovery-only side
effect of cachix-action).

Changes

  • .github/actions/build-image/action.yml — new opt-in push-image-closure
    input (default false) plus a blocking nix path-info --recursive ./result | cachix push step, guarded on the flag and a non-empty auth token, so
    per-PR CI stays pull-only and fork PRs (no secret) never fail.
  • .github/workflows/release.yml — build-and-test opts in
    (push-image-closure: 'true') so released images are cache-backed; the
    vulnix-gate now also pushes the devcontainerImageEnv scan-target closure.
  • .github/workflows/nix-image.yml — the discovery build pushes each per-arch
    image closure as a blocking step (distinct from the still-non-blocking GHCR
    discovery tag push).
  • docs/NIX.md, docs/CONTAINER_SECURITY.md, CHANGELOG.md — document the
    cache-backed-published-image guarantee.
  • tests/test_workflow_cachix.py — YAML-shape tests asserting the closure
    push exists, is blocking (no continue-on-error) on the trusted paths, and is
    opt-in (so per-PR CI stays pull-only). TDD: added RED first, then GREEN.

Push-gating decision

Gated the new explicit push on an opt-in push-image-closure input (plus a
token-presence guard), rather than on token presence alone. Token-presence alone
would make internal-branch PR CI push on every run (internal PRs carry the
secret), violating "keep per-PR CI pull-only"; the explicit flag gives precise
control — only the trusted callers opt in. The token guard is belt-and-suspenders
so a trusted path without a token (or a fork) never fails.

Verification

  • pytest tests/test_workflow_cachix.py — 4 passed.
  • pre-commit ran on every commit (yamllint, ruff, pymarkdown, action-pin check,
    agent-identity guard, manifest sync) — all passed.
  • Could not execute the actual workflows (no runner/Cachix token here); the
    guarantee is asserted structurally by the new tests and by yamllint/action-pin
    checks. actionlint is not wired into this repo's pre-commit, so it was not run.

Refs: #776

c-vigo added 3 commits July 1, 2026 08:17
Make the devcontainer image-closure push to the vig-os Cachix cache
first-class and blocking on the trusted paths so published images are
guaranteed cache-backed and consumers substitute the closure instead of
rebuilding from source.

- build-image composite: new opt-in `push-image-closure` input (default
  false) plus a blocking `nix path-info --recursive | cachix push` step,
  guarded on the input and a non-empty auth token so per-PR CI stays
  pull-only and fork PRs (no secret) never fail.
- release build-and-test opts in (`push-image-closure: 'true'`) so
  released images are cache-backed; the vulnix-gate now also pushes the
  `devcontainerImageEnv` scan-target closure.
- nix-image discovery build pushes the per-arch image closure as a
  blocking step (distinct from the non-blocking GHCR tag push).

Refs: #776
State that published images are guaranteed cache-backed via the blocking
image-closure push on the trusted paths: a new "Image closures are
cache-backed too" section in docs/NIX.md, a note on the reproducibility
principle in docs/CONTAINER_SECURITY.md, and a CHANGELOG entry.

Refs: #776
@c-vigo
c-vigo merged commit a6717c9 into dev Jul 1, 2026
13 checks passed
@c-vigo
c-vigo deleted the feature/776-cachix-image-closure branch July 1, 2026 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant