Skip to content

fix: gate container-mode CI runners behind an opt-in key - #2046

Merged
gerchowl merged 9 commits into
release/1.19.0from
bugfix/2045-container-runner-opt-in
Nov 4, 2026
Merged

gerchowl merged 9 commits into
release/1.19.0from
bugfix/2045-container-runner-opt-in

Conversation

@gerchowl

@gerchowl gerchowl commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Description

Implements the owner decision on #2045: container-mode consumers (devcontainer, both) use CI_RUNNER_* runners only after they opt in with the new .vig-os key DEVKIT_CI_CONTAINER_RUNNERS=true. Without the key, every lane stays on hosted ubuntu-26.04, as in 1.18.x. vars.CI_RUNNER_* also resolves organization variables, and an expression cannot tell an inherited org variable from a repo one. An org that sets them for a pool with no container runtime therefore broke every container-mode repo in it on adoption: the 1.19.0-rc3 smoke test failed at Initialize containers and at Scaffold Drift's docker run.

Into release/1.19.0, because this blocks release 1.19.0 (#2033).

Type of Change

  • fix -- Bug fix
  • test -- Adding or updating tests
  • docs -- Documentation only

Modifiers

  • Breaking change (!) -- This change breaks backward compatibility

Changes Made

One gate, in resolve-toolchain (assets/workspace/.github/actions/resolve-toolchain/action.yml)

  • Parses DEVKIT_CI_CONTAINER_RUNNERS with the shared KEY=VALUE reader. The file is never sourced. Any value other than true, false or empty is an ::error:: and exit 1, in every mode, before any runner output is written.
  • In devcontainer/both without true, the variable arm is skipped for every class. Each lane then gets the hosted default, so DEVKIT_CI_LANE_SIZES is ignored for placement, though it is still validated. The fork predicate still wins. The repo's own legacy DEVKIT_CI_RUNNER key keeps its 1.18.x meaning (see Notes).
  • When the gate ignores a visible variable on a non-foreign run, the resolver prints one ::notice:: that names CI_RUNNER_*, the mode and DEVKIT_CI_CONTAINER_RUNNERS=true, and gives the reason. The partial-setup notice and the opted-in-class warning do not fire, because nothing is placed. The private-repo notice and the legacy-key migration warning also name the key. Under the gate, the migration warning lists only variables that are really unset, and it no longer says "delete the key once the variables are set": the key keeps deciding every class until the repo opts in. Labels are never printed.
  • direnv/bare: unchanged.

devkit-upgrade.yml: its upgrade job runs install.sh --docker in every mode but direnv, so it needs a docker daemon. It now gets its runner from a new resolve-toolchain job (the same shape as sync-issues), not from vars.CI_RUNNER_SMALL directly. That job checks out the same ref: the upgrade rewrites (dev, or main after the trunk retarget), so the gate reads that branch's DEVKIT_MODE and opt-in key, not the default branch's. As with the key, a legacy DEVKIT_CI_RUNNER now places the upgrade job too; the consumer-matrix contract was updated to match. report also fires when resolve-toolchain fails (for example, an invalid key), because that failure skips upgrade.

init-workspace.sh: validates the key at the write path and writes it back on every upgrade. The legacy-key strip, decision (c)-1, now judges whether the key is inert with the gate applied. In a container mode without the opt-in, the variables place nothing, so the key is kept and a ci-runner-migration: line names the opt-in.

Template .vig-os: ships DEVKIT_CI_CONTAINER_RUNNERS= with a comment. Consumer matrix: the ci-runner cell runs mode both, so it now seeds DEVKIT_CI_CONTAINER_RUNNERS=true. That keeps it on the opted-in path and also exercises the write-back from start to finish.

Docs: ADR-site-agnostic-projects updates:

  • TL;DR.
  • §3 algorithm (gate G).
  • §4 inventory row.
  • §5: the old "already container-capable" assumption is replaced with the decision, why it was taken (org vars are inherited and indistinguishable), a placement table, and the known limit.
  • §6: a migration subsection and a PR-body row.
  • A dated amendment and the Consequences list.

docs/MIGRATION.md gets a new "Container-mode CI runners" section and a row for the key in the .vig-os key table (the SSoT). CHANGELOG has an entry under ## [1.19.0] - TBD → ### Fixed, and the mirror is synced.

Audit: jobs under assets/workspace/ that place on CI_RUNNER_*, DEVKIT_CI_RESOLVE_RUNNER or the resolver's runners/runner-json

Workflow Job Needs a container runtime in container mode? Runner after this PR
ci.yml resolve-toolchain No daemon: the image probe is docker login + docker manifest inspect, both client-side registry calls (they ran on a daemon-less pool in the rc3 smoke). It still needs a docker CLI direct expression (cannot use its own output)
ci.yml lint, test, commit-checks yes, container: gated runners.lint / .test / .small
ci.yml scaffold-drift yes, docker login/pull/run on the host gated runners.small
ci.yml devkit-staleness, summary no (shell/gh) gated runners.small (already on the output)
ci.yml → ci-extension.yml extension stock hook: no; a consumer's hook may gated runners.extension via runner-json input
ci.yml dependency-review — hosted literal
sync-issues.yml resolve-toolchain / sync probe only / yes container: direct / gated
sync-main-to-dev.yml resolve-toolchain / check, sync probe only / yes container: direct / gated
prepare-release.yml validate (the resolver) / prepare, open-pr, rollback probe only / yes container: direct / gated needs.validate.outputs.runners
prepare-hotfix.yml resolve-toolchain / validate, prepare, open-pr, rollback probe only / yes container: direct / gated
release.yml resolve-toolchain / rollback probe only / yes container: direct / gated
release-core.yml (via release.yml) validate, finalize, test yes container: gated inputs.runners (caller passes the resolver's runners)
release-publish.yml (via release.yml) publish yes container: gated inputs.runners
promote-release.yml resolve-toolchain / validate, promote, merge, cleanup, floating-tags probe only / yes container: direct / gated
abandon-release.yml resolve-toolchain / validate, abandon, unfreeze probe only / no (shell/gh, host toolchain) direct / gated (already on the output)
devkit-upgrade.yml resolve-toolchain (new) probe only direct
devkit-upgrade.yml upgrade yes, install.sh --docker (all modes but direnv) moved: gated runners.small
devkit-upgrade.yml report no (gh only) direct expression
prepare-release-extension.yml, release-extension.yml (seeded) extension no, stock no-op shell. The file is consumer-owned, so a consumer whose hook needs a runtime routes it itself direct expression
publish-release-extension.yml (seeded) resolve, publish no (gh / shell) direct expression
codeql.yml, scorecard.yml — — hosted literal

Composite actions: only resolve-toolchain touches docker (the client-side probe above). setup-devkit-toolchain and build-bundle run inside the job's own container or on the host, and do not drive a daemon themselves. devkit's own .github/ uses literal hosted labels and has no copy of the resolver, so there is nothing to keep in lockstep there.

tests/test_ci_container_runners.py::test_container_jobs_take_the_gated_runner derives the container-needing set from the workflows themselves: container: or services:, a docker:// or docker/* action, any docker/podman CLI subcommand (full-line shell comments excluded), compose, install.sh, or a local composite action (uses: ./…, resolved one level, including through a sub-path checkout such as ./.devkit-resolve/…) whose steps do any of these. It fails any such job whose runs-on is not the resolver's runners output, whether read directly from a resolver it needs: or through an inputs.runners that every caller fills from one. A future lane therefore cannot bypass the gate. The only exception is an explicit, commented allowlist of the nine resolver jobs (client-side registry probe, documented in ADR §5); a pinned test keeps each entry a resolver whose own definition needs no runtime besides that probe.

Changelog Entry

Fixed (under ## [1.19.0] - TBD)

  • Container-mode consumers opt in to CI_RUNNER_* runners (#2045)
    • New .vig-os key DEVKIT_CI_CONTAINER_RUNNERS (true | false, default false). In devcontainer/both mode, every lane stays on hosted ubuntu-26.04, as in 1.18.x, unless it is true; organization-level CI_RUNNER_* variables no longer move container lanes onto pools without a container runtime.
    • resolve-toolchain prints a notice naming the key when it ignores a visible variable, and rejects any other value; direnv/bare and fork PRs are unchanged.
    • devkit-upgrade resolves its installer runner through the same gate, and keeps a legacy DEVKIT_CI_RUNNER key until a container-mode repo opts in.

Testing

  • Tests pass locally (the touched suites; full suite in CI)
  • Manual testing performed

Manual Testing Details

  • The resolver matrix runs the action's real Bash over mode {devcontainer, both, direnv, bare} × key {absent, true, false} × vars {set, unset} × fork. A separate invalid-value matrix covers every mode × fork × vars. Further tests cover the notice text, quoting and whitespace parsing, the gated diagnostics, the private-repo notice, legacy-key parity and the static scan.
  • Bats (CI): the key persists across --force upgrades, invalid values are refused before any write, and the legacy key is kept in a gated container mode but stripped once the repo opts in.
  • Round 2 RED, before the stronger detector: 9 failed (services, buildx, docker info, docker push, podman image, three local-composite shapes, plus the shell-only-composite negative), e.g. assert _needs_runtime({'services': ...}) false and TypeError: _needs_runtime() got an unexpected keyword argument 'root'.
  • RED, before the implementation: 120 failed, 430 passed across test_ci_container_runners.py, test_ci_runner.py, test_vig_os_manifest.py and test_workflow_devkit_upgrade.py. Examples: assert ['self-hosted-small'] == ['ubuntu-26.04'], and devkit-upgrade.yml job 'upgrade' needs a container runtime but runs on "${{ … || vars.CI_RUNNER_SMALL || 'ubuntu-26.04' }}", not on the gated resolve-toolchain runners output (#2045).

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • I have updated CHANGELOG.md (the [1.19.0] section, because this targets the release branch) and pasted the entry above
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

  • Legacy DEVKIT_CI_RUNNER under the gate. The decision says "otherwise every lane runs on hosted ubuntu-26.04, as in 1.18.x", with the goal that no consumer breaks on upgrade. In 1.18.x the repo's own legacy key routed container-mode lanes on purpose. Honouring it is the 1.18.x behaviour, and it is the kind of explicit repo statement the decision asks for. Dropping it would silently move a self-hosted container-mode repo onto hosted runners, which fails on a billing-blocked org. So the gate ignores the inherited CI_RUNNER_* variables, not the legacy key. The legacy migration text and the upgrade strip both account for this, so following the migration never drops a repo onto hosted runners.
  • Known limit: what a self-hosted CI_RUNNER_* pool must provide, per mode. The gate is keyed on the delivery mode, as decided.
    • direnv: no docker at all. Since fix: realise direnv scaffold sources with flake prefetch #2040 the direnv Scaffold Drift step fetches the pin with nix flake prefetch, and the upgrade runs install.sh without a runtime; the pool needs nix, jq and rsync.
    • bare: ci.yml's Scaffold Drift (docker login/pull/run) and devkit-upgrade's upgrade (install.sh --docker) need a docker CLI and daemon. The gate does not apply in bare, so a bare repo whose pool has no container runtime still fails those two lanes. This needs its own issue (reported to the architect, not filed here).
    • devcontainer/both, gated: every lane is hosted, but the resolve-toolchain jobs still run on the direct vars.CI_RUNNER_SMALL || vars.DEVKIT_CI_RESOLVE_RUNNER expression and need a docker CLI (no daemon) for docker login / docker manifest inspect.
    • Documented in ADR §5 (Known limit) and MIGRATION.md (Container-mode CI runners).
  • In container modes, devkit-upgrade's new resolve job probes the image of the current pin, as every other resolve job in that repo does. The image cleanup deletes only untagged versions, so a pinned tag stays resolvable.

Refs: #2045

… composites

The gated-runner static scan must flag jobs with services:, any docker or
podman subcommand (buildx, push, info, image, ...) and local composite
actions whose own steps need a runtime. Fixture jobs for each shape fail
against the current detector.

Refs: #2045
…ner scan

The gated-runner static scan now treats a job as needing a container
runtime when it declares services:, invokes the docker or podman CLI with
any subcommand (full-line shell comments excluded), or calls a local
composite action (resolved one level, through a sub-path checkout) whose
steps do. The resolve-toolchain jobs it newly flags stay on the direct
runner expression by design (client-side registry probe): they are listed
in an explicit allowlist that is pinned to contain only resolvers with no
other runtime use.

Refs: #2045
Since #2040 the direnv Scaffold Drift step fetches the pin with nix flake
prefetch, so direnv needs no docker at all; only bare's Scaffold Drift and
upgrade need a docker CLI and daemon. Gated devcontainer/both repos still
run resolve-toolchain on the direct runner expression, which needs a
docker CLI for the image probe. Correct the ADR known limit and the
migration guide, describe the stronger runner scan, and say the opt-in key
is still validated in direnv/bare.

Refs: #2045
@gerchowl
gerchowl merged commit cedf165 into release/1.19.0 Nov 4, 2026
16 checks passed
@gerchowl
gerchowl deleted the bugfix/2045-container-runner-opt-in branch November 4, 2026 16:20
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