From bf604a1af2f0c2e5adbb2391a01bb5aac4e8b9c0 Mon Sep 17 00:00:00 2001 From: Defame1297 Date: Fri, 27 Nov 2026 13:38:09 +0000 Subject: [PATCH 1/2] docs(adr): run Molecule in its own controller image Record ADR 0003: Molecule runs in a molecule-controller image that bakes only Molecule's tools, from a requirements file and hash-pinned lock of its own, so a ci pin pull request no longer moves molecule.yml and runs no scenario. The ADR lists the files the implementation updates and the alternatives not taken. Assisted-by: Claude Code:claude-opus-5-5 --- docs/adr/0003-molecule-controller-image.md | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 docs/adr/0003-molecule-controller-image.md diff --git a/docs/adr/0003-molecule-controller-image.md b/docs/adr/0003-molecule-controller-image.md new file mode 100644 index 0000000..47c451b --- /dev/null +++ b/docs/adr/0003-molecule-controller-image.md @@ -0,0 +1,59 @@ +# 0003. Molecule runs in its own controller image, not the `ci` image + +Status: accepted + +## Context + +[ADR 0002](0002-self-built-ci-and-molecule-images.md) 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. About half of the `ci` pin pull requests 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-controller` image**, separate from `ci`. It bakes only what + Molecule needs: ansible-core, molecule, molecule-plugins, the Python packages of the Docker + connection, and the collections of `requirements.yml` and + `extensions/molecule/requirements.yml`. +- **Its Python packages come from a requirements file and hash-pinned lock of its own.** +- **`molecule.yml` pins it instead of `ci`**; Lint and Build keep `ci`. +- **It follows ADR 0002 otherwise:** built by `image.yml`, versioned by CI, pinned by + `@sha256:`, 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), `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](../../SECURITY.md#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_IMAGE` + bump 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. -- 2.43.0 From 04259751ad176257217da7e706cb00f446cfa67a Mon Sep 17 00:00:00 2001 From: Defame1297 Date: Fri, 27 Nov 2026 13:50:55 +0000 Subject: [PATCH 2/2] docs(adr): point ADR 0002 to ADR 0003 and sharpen 0003 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 --- docs/adr/0002-self-built-ci-and-molecule-images.md | 1 + docs/adr/0003-molecule-controller-image.md | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/adr/0002-self-built-ci-and-molecule-images.md b/docs/adr/0002-self-built-ci-and-molecule-images.md index f208c4a..3e58423 100644 --- a/docs/adr/0002-self-built-ci-and-molecule-images.md +++ b/docs/adr/0002-self-built-ci-and-molecule-images.md @@ -12,6 +12,7 @@ and pin updates. The choice is hard to undo once every workflow pins an image. - **We build our own images:** a `ci` image, and one Dockerfile per molecule image (one per Ubuntu release, and later the Debian 13 one). + Molecule's controller image is added by [ADR 0003](0003-molecule-controller-image.md). - **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 diff --git a/docs/adr/0003-molecule-controller-image.md b/docs/adr/0003-molecule-controller-image.md index 47c451b..dc39877 100644 --- a/docs/adr/0003-molecule-controller-image.md +++ b/docs/adr/0003-molecule-controller-image.md @@ -8,8 +8,8 @@ Status: accepted 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. About half of the `ci` pin pull requests were -Lint-only. Images are built only on push to `main`, so a bump and its pin never share a pull +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 @@ -39,7 +39,8 @@ bump of ansible-core or molecule there runs every scenario before it merges. Tod `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), `molecule.yml`, +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 -- 2.43.0