ADR 0002's image bullet now names ADR 0003 as the decision that adds Molecule's controller image; its decision is unchanged. ADR 0003 states the Lint-only share of ci pin pull requests as a count and lists the push paths of image.yml among the files the implementation updates. Assisted-by: Claude Code:claude-opus-5-5
3.4 KiB
0003. Molecule runs in its own controller image, not the ci image
Status: accepted
Context
ADR 0002 built one ci image that bakes every CI
tool, and Lint, Build and Molecule all pin it. A change to a tool only Lint uses (apm-cli,
antsibull-changelog, a pre-commit hook environment) publishes a new ci version, and its pin
pull request moves CI_IMAGE in molecule.yml. The scenario selector cannot tell what changed
inside an image, so it runs every scenario. 9 of 18 ci pin pull requests over two weeks
were Lint-only. Images are built only on push to main, so a bump and its pin never share a pull
request.
Decision
- Molecule runs in a
molecule-controllerimage, separate fromci. It bakes only what Molecule needs: ansible-core, molecule, molecule-plugins, the Python packages of the Docker connection, and the collections ofrequirements.ymlandextensions/molecule/requirements.yml. - Its Python packages come from a requirements file and hash-pinned lock of its own.
molecule.ymlpins it instead ofci; Lint and Build keepci.- It follows ADR 0002 otherwise: built by
image.yml, versioned by CI, pinned by<version>@sha256:<digest>, moved by Renovate. This adds to ADR 0002's set of images; the rest of ADR 0002 stands.
Reason
A ci pin pull request then touches only paths the selector ignores and runs no scenario. A
molecule-controller pin pull request still runs every scenario, which is right: it changes
Molecule's tools.
The cost: one more image and lock to maintain, its layers to estimate against the 100 MB limit, a hand-made first pin, and ansible-core pinned in two locks that must stay equal. A collection bump is an input of both images, so it publishes two versions and two pin pull requests.
The controller's requirements file and lock must not be on the selector's IGNORED list, so a
bump of ansible-core or molecule there runs every scenario before it merges. Today
requirements-dev.txt and requirements-dev.lock are on IGNORED, so such a bump selects no
scenario unless it edits meta/runtime.yml; this decision does not change that list.
The implementation updates: image.yml (matrix, and its push paths unless the new files live
under images/), molecule.yml,
scripts/run_molecule_in_ci_image.sh (its pin comparison reads the ci image's checksums),
scripts/check_image_versions.py, scripts/check_bot_pr_diff.py and
scripts/lock-requirements.sh (they know only requirements-dev.lock), their tests, the
pip-compile patterns in renovate.json, images/AGENTS.md (the consumer list, and "each
molecule image is one Ubuntu release"), the Molecule rules in .gitea/workflows/AGENTS.md,
docs/images/ (a new page, and ci.md, which names Molecule as a consumer), the ci
Dockerfile's description label, docs/contributing/setup.md if the clone's tools change, and the
Accepted risks entry "Pin bumps first behaviour-tested after
they merge", which counts on the ci pin pull request running every scenario.
Not done
- The selector classifies the packages a lock change moves, to decide whether a
CI_IMAGEbump matters: a heuristic package list inside a script that judges pull requests. - Status quo: every Lint-only tool change keeps costing a full Molecule run.
- Grouping pin pull requests only: adopted separately; it lowers the number of full runs but not the cause.