docs(adr): record self-built CI and molecule images, versioned by CI, pinned by version and digest #404

Merged
Defame1297 merged 4 commits from docs/167-image-adr into main 2026-11-26 21:45:57 +00:00
2 changed files with 74 additions and 0 deletions
Showing only changes of commit 288cea47a9 - Show all commits

No files matched your search

+23
View File
@@ -98,3 +98,26 @@ reduction. A later decision that accepts a risk adds an entry here.
already reaches every secret. There is no `renovate/*` push allowlist.
- **Trigger:** a token that can push here but cannot reach the secrets.
- **Planned reduction:** none for now.
### No Molecule run after a merge
- **Risk:** Molecule does not run on push to `main`
([ADR 0002](docs/adr/0002-self-built-ci-and-molecule-images.md)). Only the nightly full run
catches drift outside the tree (mirrors, images) or a scenario-selection mistake, and it is
the only run of the scenarios a pull request's diff did not select.
- **Why accepted:** "block on outdated branch" is on, so `main` only ever receives the tree its
pull request tested; no Molecule run on `main` has failed after its pull request passed.
- **Trigger:** a nightly run fails on a tree whose pull request passed.
- **Planned reduction:** none for now.
### Pin bumps first behaviour-tested after they merge
- **Risk:** Lint, Build and Molecule install a pull request's pins when they differ from the
image, so an image-input pull request is tested on its own pins. But a pin bump that selects
no Molecule scenario (every Python pin except an ansible-core minor bump, which edits
`meta/runtime.yml`) is first behaviour-tested by the `ci` pin pull request, after it has
merged.
- **Why accepted:** the `ci` pin pull request runs every scenario before the new image is used,
and running every scenario on every Python pin bump would cost about 10 minutes each.
- **Trigger:** a `ci` pin pull request fails Molecule because of a bumped pin.
- **Planned reduction:** none for now.
@@ -0,0 +1,51 @@
# 0002. Self-built CI and molecule images, versioned by CI, pinned by version and digest
Status: accepted
## Context
Every CI job runs on one shared runner. Installing the toolchain in each job is simple but slow:
Lint took about 82s and Build about 50s that way. Building our own images is faster but adds
machinery: Dockerfiles, an image build, version tags and pin updates. The choice is hard to undo
once every workflow pins an image.
## Decision
- **We build our own images:** a `ci` image, and one Dockerfile per molecule image (one per Ubuntu
release, and later the Debian 13 one).
- **The molecule images bake in everything except what a role installs itself.** The test
fixtures a scenario's `prepare.yml` needs are baked in. Packages a role installs are still
downloaded, because that install path is what the test exercises. A converge is not kept off
the network.
- **Consumers pin `<version>@sha256:<digest>`.**
- **CI assigns the patch version from the image's inputs.** A published tag is never moved.
- **The pin follows each build through Renovate.**
- **Molecule runs are isolated per run:** per-run container names and labels, and no shared
concurrency group. Molecule does not run on push to `main`. Raising the runner's capacity is a
separate change.
## Reason
We chose speed over simplicity, and the measured saving shows the trade:
- Lint takes about 33s with the image instead of about 82s, and Build about 13s instead of about
50s (measured 3 to 17 November 2026; an earlier measurement gave 15–25s for Lint and 10–25s for
Build).
- The cost: a `ci` image build takes about 4 minutes on the shared runner, and each new version
also costs a pin pull request's CI. `ci` went from 0.1.0 to 0.2.23 in three weeks, with 9
versions on 14–15 November.
Versions are assigned by CI, because a version a person has to remember to raise is one
somebody forgets. Pinning by digest means a consumer runs exactly the image a reviewer saw.
Molecule runs are isolated per run rather than queued in one concurrency group, because a
shared group cancels a waiting run and stalls the required check of that run's pull request.
The risks this leaves are in the [Accepted risks](../../SECURITY.md#accepted-risks) register:
no Molecule run after a merge, and pin bumps that are first behaviour-tested after they merge.
## Not done
- **One molecule Dockerfile with a release build argument:** it would need a matrix argument, a
Renovate regex manager for two digests and a pins check that reads build arguments. It would
save one file that review keeps in step anyway.