Plan: one VM per car, a scheduled release job

Status

Done (2026-11-10) — U1 only; U2–U5 superseded by plan ci-dev-loop (#3042)

Issues: #3029 is the plan issue (epic &122); U1 #3030, U2 #3031, U3 #3032, U4 #3033, U5 #3034. Related: #2968 (the shared 4xlarge pool), #3025 and #3026 (upstream fetches on fresh VMs), #3028 (an advisory MR check still joins the train), #2779 (the floating tag split), #3017 (release by retag). U2 closes #3028 and #3026 (unmerged, moot); U3 closes #2779 and #3017; U4 closes #3025 only if its tool-image pull goes (D4), else it stays. Branches: chore/ci-one-vm-car-u<N>. Tree: this plan is written against origin/main (2026-11-08), which carries plans ci-compile-once and ci-battery-ahead (--await-images, await_images.rs, --skip-unit, CRAIG_CHECK_FLAG, Stage::dials_the_stack). A checkout of an older branch lacks those names; read the paths below from main.

Erratum (2026-11-08): release-profile images carry no devstack features, so `ci release’s smoke (D3) brings up locally built devstack images, not the pushed release bytes; U3 settles whether the smoke builds a devstack-featured release variant or smokes the release images through a minimal profile.

A Design + Scope plan: GitLab owns tracking; the plan freezes when U1 starts. The maintainer chose this direction on 2026-11-08 after canopy adopted the same shape (its plan ci-one-vm-car, approved the same day; findings shared on the cicd channel, no shared components).

Context

The car today

A car runs six jobs across up to four VMs at once (.gitlab-ci.yml, .car-rules): ci-image → xtask → {check, build, docs, battery} → e2e. build pushes the tree’s devstack images to the registry under ci/<repo>:<tree>-<tag>; battery and e2e each bring a stack up on their own VM by pulling those images (ci devstack-up --await-images). Measured on 2026-11-08 (train pipeline 3041356027, the cook cache warm):

Job minutes slot what it does

ci-image

2.0

1

pulls or builds craig-ci

xtask

1.5

1

compiles xtask, craig-config-fetch, craig-seed

check

7.8

1 of 4

lint, clippy (on a train no unit)

build

12.6

2 of 4

the devstack images, pushed by digest

docs

2.3

3 of 4

Antora

battery

26.3

4 of 4

build-tests 10.0 (a 478 s inventory build and a 602 s re-exec), devstack-up 4.7 (151 s waiting for and pulling images), nextest 7.4, teardown

e2e

16.0

1

devstack-up (pull again), Playwright, aux

68.5 runner-minutes, about 34 minutes of wall once a slot is held, four slots at peak. On the shared pool (about 12 concurrent jobs, canopy’s train beside ours) the queue, not the work, set the pace on 2026-11-08: the head car’s first job waited 74 minutes for a slot at 07:00 UTC, and cars sat pending for most of the night.

What the shape costs beyond slots

  • Every job is a fresh VM, so every car fetches from upstream: the gitleaks release from GitHub (#3025), buildkit through the dependency proxy (#3026), the Hub bases. A GitHub 504 and a proxy rate limit each dropped cars on 2026-11-08.

  • The registry hand-off is plumbing with no other purpose: images --publish-digests, tree_image_refs, --await-images with its bounded wait, registry_probe, the cache/<group> BuildKit tags and --write-cache (xtask/src/cmd/ci/{images,buildx,await_images}.rs, plan ci-compile-once D3, plan ci-battery-ahead D1).

  • A car pushes to the registry under its own namespace, which is what #3008 was about; the maintainer closed that as over-engineering, and a car that pushes nothing closes the class without a rule.

  • docker-promote runs on every main merge (about 8.5 minutes a merge, release images rebuilt per merge). The release itself needs only the tag pipeline.

What stays true

  • cargo xtask validate already runs the whole battery on one machine in one order (ci::full_plan: lint, clippy, unit, images, devstack-up, build-tests, battery, e2e, aux), on one target directory, against a stack it builds and holds itself. The one-VM car is that plan on a 4xlarge, not a new pipeline.

  • The battery and e2e stages already run inside craig-tools on the project network (Stage::dials_the_stack), so a job that holds the stack can run them; nothing dials localhost.

  • The merge train stays the gate (ADR-086). A car still blocks on every stage; nothing becomes advisory.

Design

D1. One car, one job, one VM

The car DAG becomes ci-image → xtask → {car, docs}. ci-image and xtask stay as they are (the craig-ci toolchain image pulled by its input hash; the one xtask compile shipped as an artifact, with the docs' content lints). docs stays its own job: it runs in the Antora image (Node, Chromium, .antora), which craig-ci is not, and it needs no stack. car is one job on $CI_RUNNER_TAG, extends: [.xtask-bin, .test-results, .stack-teardown, .test-debuginfo], needs: [{job: xtask, artifacts: true}], running:

xtask ci car --json

ci car is a new CiCommand that runs full_plan(false, false) with CI’s stage settings, in this order and with these changes from today’s stages:

  1. lint, clippy, unit (today’s ci check; on a train still --skip-unit, the battery runs those tests).

  2. images --local: builds the devstack images into the VM’s own Docker daemon and pushes nothing. The BuildKit builder is the daemon’s default (docker driver, no craig-ci container builder, so no buildkit pull: #3026 is moot). The cook layer still lives in the image (ADR-039 § Amendment #3003), so the compile inside the build is the same as today’s; the registry cache import goes (D4).

  3. devstack-up --local: brings the stack up from the images just built (no --await-images, no pull). This is today’s local devstack-up path. The CI purge of a stack a previous job left on the VM (#2946: the 4xlarge reuses VMs) moves to the first step of ci car, before images --local, so a stale stack never holds a port or a volume while the build runs.

  4. build-tests runs after the stack is up, in craig-tools on the project network, once: the re-exec that today compiles the inventory twice (478 s then 602 s, the two argv shapes differing only by --network) collapses to one compile, because there is no stack-less phase to overlap.

  5. battery --profile ci-integration, e2e, aux, each as today.

Teardown is the job’s after_script, as .stack-teardown does today (container logs on failure, dev clean). The stage code is today’s: xtask/src/cmd/ci/{check,images,devstack_up,build_tests,battery,e2e,aux}.rs; ci car adds the command and the two --local flags, and takes nothing away until U4.

D2. Expected cost

Serial sum of today’s measured stages with the two removed waits: lint+clippy 7.8, images 12.6 (the build, no push), devstack-up about 2.2 (today’s 4.7 minus the 151 s image wait), build-tests about 8 (one compile, not two), nextest 7.4, e2e about 14 (today’s 16 minus its own devstack pull), aux about 1: about 53 minutes of wall and 53 runner-minutes on one slot, with docs (2.3) beside it on a second slot for its first three minutes. Against 68.5 runner-minutes over four slots and 34 minutes of wall today.

So a car is slower end to end by about 20 minutes and cheaper by about 13 runner-minutes, and the train runs up to three times as many cars at once on the same pool (two slots at peak, for three minutes, then one). The target is written as a bound, not a promise: U2’s first train run records the real table on the plan issue, and a car over 75 minutes of wall sends the plan back (§ Risks).

The job gets timeout: 2h, like .scheduled-stack, and interruptible: true.

D3. One release job, protected, scheduled

A new job release-build replaces docker-promote and sbom:

xtask ci release --json

It runs on three triggers and nowhere else: a tag ($CI_COMMIT_TAG), the weekly schedule ($CI_PIPELINE_SOURCE == "schedule", the existing "Weekly main" schedule 4540282), and when: manual on a main pipeline. It extends: [.xtask-bin, .stack-teardown], needs xtask only, timeout: 2h. Its stages, each a step with its own report:

  1. images --push: build the release-profile images (today’s docker-promote build, CARGO_PROFILE=release, the release cache group) and push them as :<sha8> (every run) and :<tag> (a tag run), moving :latest only on a tag run (this settles #2779 for the release job: :latest tracks releases; the weekly run gives a dated :<sha8> and nothing floating).

  2. sbom: xtask sbom and xtask changelog notes --images (the lines today’s sbom job runs, #3012/#3016), on every run; the artifact keeps expire_in: never on a tag run.

  3. smoke: devstack-up --local from the release images just built, then perf --profile smoke and security --phase public-api. A release that fails its own smoke publishes no Release.

Today’s release job stays as it is (the release-cli image, needs: [{job: release-build, artifacts: true}], rules: if $CI_COMMIT_TAG, the one release-cli create line with the notes and the job-based SBOM link, #3016): it cannot run in craig-ci, and a tag run whose release-build fails publishes nothing because its need is red.

Main’s per-merge pipeline therefore builds no release image. A deployer who wants a built image of a specific main commit runs the job by hand on that commit’s pipeline. The protected-variables question (#3015: an unprotected tag pipeline receives no CRAIG_CI_AGE_KEY) is unchanged by this plan; the maintainer left it as is on 2026-11-08, and secrets-policy keeps its own job and its own verdict.

D4. Retire the registry plumbing

Once U2 and U3 are on main, the following have no caller and go, with their tests and docs (paths on main):

  • xtask/src/cmd/ci/images.rs: --publish-digests, tree_image_refs, the images.json manifest; xtask/src/cmd/ci/await_images.rs whole, and devstack_up.rs’s `--await-images / --from-digests flags.

  • The BuildKit registry cache in xtask/src/cmd/ci/buildx.rs: --write-cache, the cache/<group> tags and their import, ensure_builder’s `craig-ci container builder (the daemon’s default builder is used instead), and registry_probe where only the cache used it. #3026’s mirror never lands (its branch closes unmerged).

  • tools/craig-tools in the registry (buildx::tools_input_hash and its push): the car builds craig-tools once per VM as validate does. If U2’s measurement shows that build costing more than two minutes per car, this item moves to the plan issue as a follow-up and the pull stays. #3025’s tool-image pull (craig-gitleaks, craig-devtools, in xtask/src/devtools.rs) is kept on the same condition: it is one fetch fewer than a GitHub download per car.

  • .gitlab-ci.yml: CRAIG_IMAGES_CACHE_FLAG, .stack-cache-writer, .main-cache-writer, .stack-rules (a plain MR’s manual stack jobs become its blocking car, D5), CRAIG_CHECK_FLAG (the train/MR difference is ci car’s one flag, `--skip-unit), and the docker-promote job.

What stays: ci-image and the craig-ci input hash (one toolchain image per toolchain, pulled by every job), xtask’s artifact (the release job and the leaf jobs still take it), the leaf jobs (`cargo-deny, secrets-policy, feature-matrix, fuzz-smoke, pentest, perf-load, perf-stress, cluster-tests, identity-multibackend, policy-drift, pages, stop_review) with their rules unchanged, except that the scheduled stacks switch from --await-images to --local (they build their own images on their own VM, as the car does).

D5. The plain MR pipeline

Today a plain MR runs check (advisory, #3028), docs, and the stack jobs by hand. Under this plan a plain MR runs car blocking whenever .car-rules’ `changes: match (the same list as today), so the train never admits a red car it could have seen (#3028 closes). A docs-only MR runs docs alone, as today. The cost is one slot for about 53 minutes per MR push, the same as a car; interruptible: true cancels a superseded push.

D6. What a developer sees

cargo xtask validate is unchanged. ci car is validate --profile full with CI’s reporting; the dry-run test that pins validate’s stage order to the DAG (`the_car_dag_runs_validate_fulls_stages_in_its_order) becomes the test that ci car’s plan is `full_plan. The pre-push hook is unchanged.

Scope

Five units, each an MR on the train, each with its own issue. U1 is the only one that can run before the pool frees.

Unit Delivers Proof

U1 (#3030, chore/ci-one-vm-car-u1)

ci car and ci release as CiCommand`s in `xtask/src/cmd/ci/mod.rs, running today’s stages locally (the purge first, images --local, devstack-up --local, one build-tests compile), behind no YAML change: cargo xtask ci car runs end to end on luchs.

Unit tests: ci car’s plan equals `full_plan(false, false) with the purge prepended; images --local passes no --push, --cache-from or --cache-to (an argv test); devstack-up --local reads no registry (the fake registry records no call); the build-tests argv is built once. One full local run of ci car recorded on the unit issue (stage table).

U2 (#3031, chore/ci-one-vm-car-u2)

.gitlab-ci.yml: the car DAG becomes ci-image → xtask → {car, docs}; check, build, battery and e2e go; .car-rules makes a plain MR’s car blocking (D5). The leaf jobs are untouched. Closes #3028; closes #3026 as moot.

Contract tests (xtask/src/cmd/ci/pipeline_tests.rs): the car jobs are exactly ci-image, xtask, car, docs; car has needs: [{job: xtask, artifacts: true}], timeout: 2h, interruptible: true, runs the one line, and blocks on an MR with matching changes; no job runs --await-images, --from-digests or --publish-digests; the YAML stays under 500 lines; the CI lint API passes; the DAG-order test becomes “ci car’s plan is `full_plan”. The first train run’s stage table and wall time recorded on the unit issue against D2’s bound.

U3 (#3032, chore/ci-one-vm-car-u3)

.gitlab-ci.yml: release-build (D3) replaces docker-promote and sbom; release needs it; the scheduled stacks switch to --local. Closes #2779 and #3017.

Contract tests: release-build runs only on a tag, the schedule or manual main; it is the only job whose script pushes; release needs it with artifacts; :latest moves only on a tag (a unit test over the push argv); the smoke stage runs before the push step returns success. One manual run on main recorded on the unit issue, with the pushed refs listed.

U4 (#3033, chore/ci-one-vm-car-u4)

Retire the plumbing (D4): code, tests, docs, the cache/ and ci/ registry repositories' documentation (the cleanup policy already deletes them). ADR-039 gains an amendment (the cache mount is local again on CI); ADR-086 is unchanged; plans ci-compile-once and ci-battery-ahead gain a dated erratum each pointing here. Closes #3025 if its pull goes (D4), else leaves it.

cargo xtask test green; no reference to await-images, from-digests, publish-digests, write-cache or cache/ remains outside the archive and the changelog (a grep in the MR description); quality budgets re-blessed downward.

U5 (#3034, chore/ci-one-vm-car-u5)

Docs: quality-gates.adoc § Battery stages, testing-reference.adoc § CI stages, deployment-guide.adoc § CI/CD and § Release images, known-issues.adoc § Landing an MR, each rewritten for the two-job car and the release job; CHANGELOG: one changelog.d/3029.changed.adoc fragment with the Ops clause (the release job’s triggers; :latest moves on tags only).

doc-pointer-integrity and mandatory-docs green; the Antora build green.

Out of scope: the compile cache between cars (canopy’s #3276 shape; CRAIG files its own issue once U2 has measured the cold compile, since the cook layer already caches dependencies inside the image build); the pool size (#2968); sccache in CI; any change to the pre-push hook or validate.

Risks

Risk Mode Mitigation Test

The car is slower than D2’s bound: the serial sum assumes today’s stage times hold on one VM.

fail-open (a slow car still merges)

U2’s first train run is the measurement; a car over 75 minutes of wall sends the plan back before U3. The likely saving: run lint/clippy concurrently with images inside the job (the stages share no target directory), which ci car can do without a YAML change.

the stage table on the U2 issue

A reused VM carries a stale stack or stale images (#2946).

fail-closed

the purge is ci car’s first step, before any build; `images --local tags by tree hash, so another tree’s image is never used.

a plan test: the purge step precedes images

The daemon’s own BuildKit lacks a feature the container builder had.

fail-closed (the build errors)

the release build needs --provenance=false --sbom=false and multi-stage targets, which the docker driver supports (moby 24+, craig-ci’s Docker CLI).

U1’s local run of both commands, before any YAML change

The weekly release run has no smoke baseline on a dedicated host.

silent (a noisy run could mask a regression)

the smoke stage judges against the perf verdict’s pressure window (xtask/src/perf_verdict.rs), as perf-load does; a run invalidated by pressure is reported INVALID, not passed, and on a tag the Release still publishes with that verdict in its notes.

the plan issue records the first three weekly results

A plain MR’s car blocks and costs a slot per push.

fail-closed

that is the point (#3028); interruptible: true bounds the waste. If the pool cannot carry it, D5 falls back to today’s advisory check plus the runbook’s pre-arm screen: one rule change, named here so it is not a redesign.

the U2 contract test on the rule

Serialisation drift between an in-process harness and a service path (canopy’s caution).

silent

CRAIG’s rules check and the craig-rules service share the evaluator crate; the e2e stage runs against the service and the battery against both, under the existing byte pins. No action; recorded so the next reader checks it.

the byte pins already in the battery

Decisions

  • One job, not two with a local hand-off. A two-job car (build on one VM, test on another) still needs the registry or an artifact of the images; the artifact is gigabytes per car. One job removes the hand-off entirely.

  • Release images rebuilt in the release job, not retagged from a car. Cars build devstack-profile images; the release needs release-profile bytes. #3017 (release by retag) closes as moot: there is no promoted :<sha8> from main to retag once docker-promote goes.

  • The scheduled run publishes :<sha8> and nothing floating. A weekly image with no release is a build for staging, not a release; :latest is what docker pull craig-cases gives a stranger, so it tracks tags only.

  • Keep ci-image separate. One toolchain image per toolchain, built once and pulled by every job, is cheap (2 minutes, mostly a pull) and lets every job, leaf jobs included, start from the same image.

  • Keep the leaf jobs where they are. They run on schedules and main, not on cars; moving them into ci car would make every car pay for them.

Edit this page · latest