2.5 KiB
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. 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
ciimage, 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.ymlneeds 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:
- With everything installed per run, Lint took about 82s and Build about 50s (24–25 October 2026). With the image, Lint takes about 33s and Build about 13s (3 to 17 November 2026).
- The cost: a
ciimage build takes about 4 minutes on the shared runner, and each new version also costs a pin pull request's CI.ciwent 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 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, and the Debian 13 image differs by more than a release tag anyway. Review keeps the files in step.