Skip to content

ci(setup): unify CI on flake provisioning, drop the ad-hoc uv pin - #801

Merged
c-vigo merged 1 commit into
devfrom
feature/720-unify-ci-flake-provisioning
Jul 3, 2026
Merged

c-vigo merged 1 commit into
devfrom
feature/720-unify-ci-flake-provisioning

Conversation

@c-vigo

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

Copy link
Copy Markdown
Contributor

Summary

Closes the version-drift #720 was filed for — but by deletion rather than by automating a sync.

Investigation showed CI already provisioned the toolchain from the flake for the image/test jobs (setup-env's provision-via-flake mode). The drift lived only in the other mode: the ad-hoc path hardcoded a second uv version (0.11.23) that had to be kept in lockstep with the flake's overlaid pkgs.uv.version. (Concretely, they had already drifted — the flake currently resolves uv 0.11.19.)

This makes setup-env flake-only: every job installs Nix + Cachix and enters the dev-shell, so CI and local nix develop run the identical toolchain from a single source (flake.lock). The literal pin is gone; the uv version now flows solely from the flake.

Changes

  • setup-env action — remove the provision-via-flake toggle and the ad-hoc install steps (astral-sh/setup-uv ×2 with the 0.11.23 pin, actions/setup-python, taiki-e/install-action for just, the taplo curl, bats-action); drop the now-dead install-python/python-version/install-just/install-taplo/install-bats inputs and the unused uv-version output. Keep the host-integration steps (podman setuid, Node.js, devcontainer CLI) and the UV_PYTHON_DOWNLOADS_JSON_URL forwarding that pre-commit's manylinux hooks depend on.
  • Callers — the 4 composite actions drop provision-via-flake/tool flags now provided by the flake; the lightweight ad-hoc callers (ci.yml security jobs, prepare-/promote-/release.yml orchestration) are wired to the warm vig-os Cachix cache.
  • security-scan.yml scan-nix-image — drops its duplicate direct Nix/Cachix setup and routes provisioning through setup-env (no double install; DRY).
  • Docs (NIX.md) + CHANGELOG updated.

Net +71 / −227.

Trade-off (accepted)

The lightweight security/release jobs now pull the warm Cachix closure instead of a ~5 s uv download, and the release-orchestration pipeline gains a dependency on Nix + the Cachix cache (mitigated: the closure is already warmed by nix-cachix.yml/build jobs, and cache.nixos.org is a fallback substituter).

Verification

  • grep for 0.11.23 / provision-via-flake / removed inputs → clean across .github.
  • pre-commit green on changed files (yamllint, check-action-pins, pymarkdown, agent-identity).
  • CI on this PR exercises the converted ci.yml jobs (python-security, security-scan, dependency-review) — confirm they hit the warm cache.
  • ⚠️ The prepare-/promote-/release.yml legs are event-gated (tags/release/dispatch) and cannot run on a feature-branch PR; they are verified structurally (identical shared action + YAML) and should be watched on the next release. release.yml vulnix-gate uses the same flake path already proven in build-and-test.

Notes

Non-testable CI config (no unit test; noted per the TDD standard). Downstream follow-up: #779 (flake-checks as CI Tier 0) is the natural next step once #791 lands.

Refs: #720

The setup-env composite action carried two provisioning paths behind a
provision-via-flake toggle: a flake path (used by the image/test jobs)
and an ad-hoc path (astral-sh/setup-uv + setup-python + curl-taplo + just
+ bats) used by the lightweight security and release-orchestration jobs.
The ad-hoc path hardcoded a second uv version (0.11.23) that had to be
kept in lockstep with the flake's overlaid pkgs.uv.version — the drift
#720 was filed to guard.

Resolve it by deletion rather than by automating a sync: make setup-env
flake-only (always install Nix + Cachix and enter the dev-shell), so CI
and local `nix develop` run the identical toolchain from a single source
(flake.lock). The provisioned uv version now flows solely from the flake;
the literal pin is gone.

- setup-env: remove the provision-via-flake toggle and the ad-hoc install
  steps; drop the now-dead install-python/python-version/install-just/
  install-taplo/install-bats inputs and the unused uv-version output;
  keep the host-integration steps (podman, Node.js, devcontainer CLI).
- Convert every remaining ad-hoc caller (ci.yml security jobs, prepare-/
  promote-/release orchestration) to the shared action and wire the warm
  vig-os Cachix cache (vars.CACHIX_CACHE / secrets.CACHIX_AUTH_TOKEN).
- security-scan.yml scan-nix-image: drop its duplicate direct Nix/Cachix
  setup and route provisioning through setup-env (no double install).
- Docs/CHANGELOG updated.

Non-testable CI config: no unit test; validated with yamllint +
check-action-pins and verified green in CI.

Refs: #720
@c-vigo

c-vigo commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

CI performance cost — measured, and why we're not optimizing further

Comparing this PR (flake provisioning) against the same dev base commit on the ad-hoc path (PR #800 run):

Job (converted) Baseline (ad-hoc) This PR (flake) Δ
Python Security Scan 16s 63s +47s
Dependency Review 15s 60s +45s
Security Scan 618s 640s +22s (~3.5%)

The cost is a flat ~+45s per converted job, entirely in the Set up environment step. Anatomy of that step (from the raw logs):

  • Install Nix: ~4s (fixed)
  • Configure Cachix: ~2s (fixed)
  • nix develop — eval + pull the full dev-shell closure: ~41s (382 store paths) ← dominant cost
  • uv sync (cpython 34 MiB + 46 pkgs): ~6s (needed regardless)

Two costs, and they diverge:

  • Wall-clock: ≈ unchanged. These jobs run in parallel and are nowhere near the critical path (Security Scan is Trivy-bound at ~640s). You don't wait longer for CI.
  • Runner-minutes: +~1.9 min/PR. The honest recurring cost — three jobs now spin up a Nix toolchain they didn't before. Event-gated release/promote/prepare jobs each gain ~+45s when they run (rare).

All numbers are warm-cache. A cold cache (e.g. right after a flake.lock bump before nix-cachix.yml re-warms) would be materially worse — cache health is the real lever, not the change itself.

"Lighter CI shell" option — evaluated and declined

The 41s pulls the full 27-tool dev-shell (claude-code, neovim + tree-sitter grammars, nodejs ×4, lazygit, ripgrep, ruff, bats, …) when these uv-only jobs need ~a dozen paths. A minimal devShells.ci (just uv + git/gh, same pkgs.uv → no drift reintroduced) would cut that ~41s to ~10s, saving ~1.5 runner-min/PR.

Not pursuing it. It's a billing optimization (not wall-clock), and it would re-add a setup-env shell toggle — the exact kind of surface #720 just removed — plus a second Cachix-warmed output and a parity surface, with a cold-build footgun if the new shell isn't warmed. ~2 runner-min/PR is minor; not worth re-fragmenting the single-toolchain path we just achieved. Noted here for the record in case runner-minutes ever become a real constraint.

@c-vigo
c-vigo merged commit d79113a into dev Jul 3, 2026
13 checks passed
@c-vigo
c-vigo deleted the feature/720-unify-ci-flake-provisioning branch July 3, 2026 06:31
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