docs: describe Molecule running in the molecule-controller image

The ci image's labels and doc, the consumer lists, the Molecule rules in
.gitea/workflows/AGENTS.md and the accepted risk on pin bumps in SECURITY.md said Molecule
runs in the ci image. They now name the molecule-controller image, its pin files and which
pin files select scenarios.

Closes #431

Assisted-by: Claude Code
This commit is contained in:
Defame1297 committed 2026-11-29 19:25:33 +00:00
1 parent 89bd579e87
commit 4db1a2b3c9
8 files changed
+44 -38

No files matched your search

+12 -7
View File
@@ -82,9 +82,10 @@ issue.
`mortis.kamino.<role>`, transitively), none for a diff of only IGNORED paths, a failure for a `mortis.kamino.<role>`, transitively), none for a diff of only IGNORED paths, a failure for a
changed role with no scenario, for a `.gitea/workflows/molecule.yml` diff of only comments changed role with no scenario, for a `.gitea/workflows/molecule.yml` diff of only comments
(outside `run:` scripts) or image pins the scenarios that name a changed `MOLECULE_IMAGE*` pin (outside `run:` scripts) or image pins the scenarios that name a changed `MOLECULE_IMAGE*` pin
(every scenario for `CI_IMAGE`, or when a shared molecule file names the pin), and every (every scenario for `CONTROLLER_IMAGE`, or when a shared molecule file names the pin), and every
scenario for any other file. *Why:* a full run takes scenario for any other file, `requirements-molecule.*` included; `requirements-dev.*`, and
the single runner slot for a long time. *Held:* control: the selector and its tests. `lint.yml` and `build.yml` with their `ci` pins, are on IGNORED. *Why:* a full run takes the
single runner slot for a long time. *Held:* control: the selector and its tests.
- **A role named in an include, import, play `roles:` entry or meta dependency is written out in - **A role named in an include, import, play `roles:` entry or meta dependency is written out in
full**, never bare or templated. *Why:* the selector finds dependent roles by their FQCN. full**, never bare or templated. *Why:* the selector finds dependent roles by their FQCN.
*Held:* control: a selector test fails a bare or templated name. *Held:* control: a selector test fails a bare or templated name.
@@ -127,10 +128,14 @@ issue.
`test_a_scenario_past_its_time_limit_fails_alone` and `test_a_scenario_past_its_time_limit_fails_alone` and
`test_the_default_time_limit_is_inside_the_job_timeout`, in the same file. `test_the_default_time_limit_is_inside_the_job_timeout`, in the same file.
- **Molecule tests the pull request's pins, as Lint and Build do.** It runs molecule in the pinned - **Molecule tests the pull request's pins, as Lint and Build do.** It runs molecule in the pinned
`ci` image and, when a pin file differs from `/opt/ci-pins.sha256`, installs the pull request's `molecule-controller` image ([ADR 0003](../../docs/adr/0003-molecule-controller-image.md)) and,
tools and the collections of `requirements.yml` and `extensions/molecule/requirements.yml` first. when a pin file differs from `/opt/molecule-pins.sha256`, installs the pull request's tools from
*Why:* a pull request that raises the ansible-core floor must run its scenarios on the new core `requirements-molecule.lock` and the collections of `requirements.yml` and
before it automerges. *Held:* control: the pin comparison in `molecule.yml`. `extensions/molecule/requirements.yml` first. A change to `requirements-molecule.txt` or
`requirements-molecule.lock` selects every scenario; `requirements-dev.*` pins only Lint's tools
and selects none. *Why:* a pull request that bumps ansible-core or molecule must run its
scenarios on them before it automerges. *Held:* control: the pin comparison in
`run_molecule_in_ci_image.sh`, and the selector's tests for which pin files select what.
- **Every scenario sets `scenario.test_sequence` to molecule's default minus both `destroy` - **Every scenario sets `scenario.test_sequence` to molecule's default minus both `destroy`
steps, with a role scenario's `check` right before and right after `converge`, names each steps, with a role scenario's `check` right before and right after `converge`, names each
platform `${KAMINO_RUN_ID:-local}-<name>` and labels it platform `${KAMINO_RUN_ID:-local}-<name>` and labels it
+12 -9
View File
@@ -113,13 +113,16 @@ reduction. A later decision that accepts a risk adds an entry here.
### Pin bumps first behaviour-tested after they merge ### Pin bumps first behaviour-tested after they merge
- **Risk:** Lint, Build and Molecule install a pull request's pins when they differ from the - **Risk:** Lint, Build and Molecule install a pull request's pins when they differ from their
image, so a pull request that changes an image input is tested on its own pins. But most pin image, and a change to `requirements-molecule.*`, `requirements.yml` or
bumps select no Molecule scenario: every Python pin except an ansible-core minor bump, which `extensions/molecule/requirements.yml` selects every Molecule scenario, so Molecule's own tools
edits `meta/runtime.yml`. Such a bump is first behaviour-tested after it has merged, by the and collections are tested before they merge. A change to the `molecule-controller` Dockerfile
pull request that moves the workflows to the new `ci` image. (its base image, uv or Python) selects none, because `images/` is on the selector's IGNORED
- **Why accepted:** that pull request runs every scenario before the new image is used, list; it is first behaviour-tested after it has merged, by the pull request that moves
and running every scenario on every Python pin bump would cost about 10 minutes each. `molecule.yml` to the new `molecule-controller` version. `requirements-dev.*` pins only Lint's
- **Trigger:** the pull request that moves the workflows to a new `ci` image fails Molecule and Build's tools, which no scenario runs.
because of a bumped pin. - **Why accepted:** that pull request runs every scenario before the new image is used, and the
Dockerfile's self-checks fail the build on `main` before any pin moves.
- **Trigger:** the pull request that moves `molecule.yml` to a new `molecule-controller` image
fails Molecule because of a changed image input.
- **Planned reduction:** none for now. - **Planned reduction:** none for now.
+7 -10
View File
@@ -1,7 +1,9 @@
# ci # ci
The **CI tooling image** of the [`mortis.kamino`](https://git.rkdr.net/mortis/kamino) Collection: everything the Lint, Build and The **CI tooling image** of the [`mortis.kamino`](https://git.rkdr.net/mortis/kamino) Collection: everything the Lint and Build
Molecule workflows used to install on each run is baked in, so a job only checks out the code and runs. workflows used to install on each run is baked in, so a job only checks out the code and runs. The Molecule workflow
runs in the [`molecule-controller`](molecule-controller.md) image instead
([ADR 0003](../adr/0003-molecule-controller-image.md)), so a tool bump only Lint uses selects no Molecule scenario.
## What is in it ## What is in it
@@ -59,25 +61,20 @@ jobs:
pre-commit run --all-files --show-diff-on-failure pre-commit run --all-files --show-diff-on-failure
``` ```
The Molecule job runs on the `kamino-molecule` runner, a host executor, so it starts the image itself with
`docker run`, as the runner user, with the Docker socket and the checkout mounted at the same path (molecule
hands the daemon paths in the checkout); `scripts/run_molecule_in_ci_image.sh` does the same pin check inside it.
Read `.gitea/workflows/molecule.yml` for the full command.
`/opt/ci-pins.sha256` lists the five pin files by their checkout-relative path, so `sha256sum -c` runs in the checkout root. When `/opt/ci-pins.sha256` lists the five pin files by their checkout-relative path, so `sha256sum -c` runs in the checkout root. When
the checkout's `requirements-dev.txt`, `requirements-dev.lock`, `requirements.yml`, `extensions/molecule/requirements.yml` and `.pre-commit-config.yaml` match, the baked tools and the checkout's `requirements-dev.txt`, `requirements-dev.lock`, `requirements.yml`, `extensions/molecule/requirements.yml` and `.pre-commit-config.yaml` match, the baked tools and
collections are used as they are, and Lint and Build cut the network by environment (proxy variables and collections are used as they are, and Lint and Build cut the network by environment (proxy variables and
`PIP_NO_INDEX`) for all but the script tests, so a tool that downloads at run time fails the job. When a pull request changes a pin the check fails and the job installs the pinned `PIP_NO_INDEX`) for all but the script tests, so a tool that downloads at run time fails the job. When a pull request changes a pin the check fails and the job installs the pinned
tools and collections itself for that run tools and collections itself for that run
(slower, same result), until the image is rebuilt from `main`. `lint.yml`, `build.yml`, `molecule.yml` and `gitea-release-key.yml` (slower, same result), until the image is rebuilt from `main`. `lint.yml`, `build.yml` and `gitea-release-key.yml`
are the real consumers. are the real consumers.
## Tags and pinning ## Tags and pinning
- `<version>` is semver, independent of the Collection's version. A published version is never moved or - `<version>` is semver, independent of the Collection's version. A published version is never moved or
rebuilt, so one digest belongs to exactly one version. `latest` is the newest version, for looking only. rebuilt, so one digest belongs to exactly one version. `latest` is the newest version, for looking only.
- Pin `ci:<version>@sha256:<digest>`; the digest decides what is pulled. Consumers: `lint.yml`, `build.yml`, - Pin `ci:<version>@sha256:<digest>`; the digest decides what is pulled. Consumers: `lint.yml`, `build.yml` and
`molecule.yml` and `gitea-release-key.yml`. `gitea-release-key.yml`.
- Renovate is configured to move the pins to a new version after the image is built on `main` (the rule is in - Renovate is configured to move the pins to a new version after the image is built on `main` (the rule is in
`renovate.json`; the first pin of a brand-new image is made by hand). `renovate.json`; the first pin of a brand-new image is made by hand).
+2 -2
View File
@@ -32,8 +32,8 @@ checkout). In the checkout root, run `sha256sum --quiet -c /opt/molecule-pins.sh
`requirements-molecule.lock`, `requirements.yml` or `extensions/molecule/requirements.yml`, install the pinned tools `requirements-molecule.lock`, `requirements.yml` or `extensions/molecule/requirements.yml`, install the pinned tools
and collections for that run first (slower, same result), until the image is rebuilt from `main`. and collections for that run first (slower, same result), until the image is rebuilt from `main`.
No workflow consumes it yet; the Molecule workflow still runs in the [`ci`](ci.md) image until its first pin is made `.gitea/workflows/molecule.yml` is its consumer: it pins the image as `CONTROLLER_IMAGE`, and
by hand. `scripts/run_molecule_in_ci_image.sh` runs the pin check inside it. Read the workflow for the full command.
## Tags and pinning ## Tags and pinning
+1 -1
View File
@@ -49,7 +49,7 @@ platforms:
systemd needs a writable cgroup (`cgroupns_mode: host`, the `/sys/fs/cgroup` mount and tmpfs on `/run`), the systemd needs a writable cgroup (`cgroupns_mode: host`, the `/sys/fs/cgroup` mount and tmpfs on `/run`), the
firewall tools need `NET_ADMIN`, AppArmor is left unconfined for the container (`apparmor=unconfined`), and firewall tools need `NET_ADMIN`, AppArmor is left unconfined for the container (`apparmor=unconfined`), and
nothing runs privileged. The docker driver needs molecule's docker plugin, which the ci image provides. nothing runs privileged. The docker driver needs molecule's docker plugin, which the molecule-controller image provides.
The scenario `extensions/molecule/image-smoke` tests this image against that contract (release, The scenario `extensions/molecule/image-smoke` tests this image against that contract (release,
systemd, packages, the `dbus` and `ssh` units, the Python bindings, `NET_ADMIN`). systemd, packages, the `dbus` and `ssh` units, the Python bindings, `NET_ADMIN`).
+1 -1
View File
@@ -50,7 +50,7 @@ platforms:
systemd needs a writable cgroup (`cgroupns_mode: host`, the `/sys/fs/cgroup` mount and tmpfs on `/run`), the systemd needs a writable cgroup (`cgroupns_mode: host`, the `/sys/fs/cgroup` mount and tmpfs on `/run`), the
firewall tools need `NET_ADMIN`, AppArmor is left unconfined for the container (`apparmor=unconfined`), and firewall tools need `NET_ADMIN`, AppArmor is left unconfined for the container (`apparmor=unconfined`), and
nothing runs privileged. The docker driver needs molecule's docker plugin, which the ci image provides. nothing runs privileged. The docker driver needs molecule's docker plugin, which the molecule-controller image provides.
The scenario `extensions/molecule/image-smoke-2604` tests this image against that contract (release, The scenario `extensions/molecule/image-smoke-2604` tests this image against that contract (release,
systemd, packages, the `dbus` and `ssh` units, the Python bindings, `NET_ADMIN`). systemd, packages, the `dbus` and `ssh` units, the Python bindings, `NET_ADMIN`).
+3 -3
View File
@@ -25,9 +25,9 @@ it to this repository's organisation in the Gitea registry as `<version>` and `l
publishes `<base>.N+1` when they differ. Edit `base:` by hand only for a minor or major. publishes `<base>.N+1` when they differ. Edit `base:` by hand only for a minor or major.
*Why:* a version a person must remember to raise is a version someone forgets. *Held:* *Why:* a version a person must remember to raise is a version someone forgets. *Held:*
control: the Images workflow assigns it (`next_image_version.py`, with its tests). control: the Images workflow assigns it (`next_image_version.py`, with its tests).
- **After the build pushes a new version, a second pull request moves the - **After the build pushes a new version, a second pull request moves its
`image:<version>@sha256:<digest>` pins in `lint.yml`, `build.yml`, `molecule.yml` and `image:<version>@sha256:<digest>` pins to it:** `ci` in `lint.yml`, `build.yml` and
`gitea-release-key.yml` to it.** Renovate opens it within minutes: the Images run's successful `gitea-release-key.yml`; `molecule-controller` and the `molecule-ubuntu*` images in `molecule.yml`. Renovate opens it within minutes: the Images run's successful
completion starts a live Renovate run (`workflow_run` in `renovate.yml`). It changes no image completion starts a live Renovate run (`workflow_run` in `renovate.yml`). It changes no image
input, so it publishes nothing. A new image's first pin is a hand-made pull request, and a input, so it publishes nothing. A new image's first pin is a hand-made pull request, and a
major version is moved by hand. *Why:* consumers run exactly the digest a reviewer saw. major version is moved by hand. *Why:* consumers run exactly the digest a reviewer saw.
+6 -5
View File
@@ -1,5 +1,6 @@
# CI image for the Lint, Build and Molecule workflows of this Collection: every tool they used # CI image for the Lint and Build workflows of this Collection: every tool they used to install
# to install on each run is baked in, so a job only checks out the code and runs. # on each run is baked in, so a job only checks out the code and runs. Molecule runs in the
# molecule-controller image (ADR 0003).
# #
# Built by .gitea/workflows/image.yml with kaniko (repository root as build context, # Built by .gitea/workflows/image.yml with kaniko (repository root as build context,
# because the pin files below are copied in) and pushed, never on pull requests, to # because the pin files below are copied in) and pushed, never on pull requests, to
@@ -177,16 +178,16 @@ FROM os AS final
ARG PYTHON_VERSION=3.14 ARG PYTHON_VERSION=3.14
LABEL org.opencontainers.image.title="ci" \ LABEL org.opencontainers.image.title="ci" \
org.opencontainers.image.description="CI tooling image for the mortis.kamino Ansible Collection: the Lint, Build and Molecule workflows run in it, so a job only checks out the code and runs. It bakes in ansible-core, ansible-lint, pre-commit with every hook environment of the repository, antsibull-changelog, galaxy-importer, reuse, molecule with its Docker driver, proxmoxer, the collections of requirements.yml and extensions/molecule/requirements.yml, git, shellcheck, Python 3.11, 3.13 and the version of .python-version (the tools in /opt/venv run on it) next to the distribution python3 and primed ansible-test sanity virtualenvs. Pin it by tag and digest, as a job container or with docker run; it has no Node, so clone with git." \ org.opencontainers.image.description="CI tooling image for the mortis.kamino Ansible Collection: the Lint and Build workflows run in it, so a job only checks out the code and runs; Molecule runs in the molecule-controller image. It bakes in ansible-core, ansible-lint, pre-commit with every hook environment of the repository, antsibull-changelog, galaxy-importer, reuse, molecule with its Docker driver, proxmoxer, the collections of requirements.yml and extensions/molecule/requirements.yml, git, shellcheck, Python 3.11, 3.13 and the version of .python-version (the tools in /opt/venv run on it) next to the distribution python3 and primed ansible-test sanity virtualenvs. Pin it by tag and digest, as a job container or with docker run; it has no Node, so clone with git." \
org.opencontainers.image.source="https://git.rkdr.net/mortis/kamino" \ org.opencontainers.image.source="https://git.rkdr.net/mortis/kamino" \
org.opencontainers.image.url="https://git.rkdr.net/mortis/kamino" \ org.opencontainers.image.url="https://git.rkdr.net/mortis/kamino" \
org.opencontainers.image.documentation="https://git.rkdr.net/mortis/kamino/src/branch/main/docs/images/ci.md" \ org.opencontainers.image.documentation="https://git.rkdr.net/mortis/kamino/src/branch/main/docs/images/ci.md" \
org.opencontainers.image.licenses="GPL-3.0-or-later" \ org.opencontainers.image.licenses="GPL-3.0-or-later" \
org.opencontainers.image.authors="Defame1297 and contributors" \ org.opencontainers.image.authors="Defame1297 and contributors" \
org.opencontainers.image.base.name="ubuntu:26.04" \ org.opencontainers.image.base.name="ubuntu:26.04" \
net.rkdr.mortis.purpose="CI tooling image for the mortis.kamino Ansible Collection: the Lint, Build and Molecule workflows run in it, so a job only checks out the code and runs." \ net.rkdr.mortis.purpose="CI tooling image for the mortis.kamino Ansible Collection: the Lint and Build workflows run in it, so a job only checks out the code and runs." \
net.rkdr.mortis.contents="Ubuntu 26.04, /opt/venv (ansible-core, ansible-lint, pre-commit, antsibull-changelog, galaxy-importer, reuse, molecule, molecule-plugins[docker], proxmoxer), /opt/collections (community.general, ansible.posix, community.proxmox, community.docker), /opt/pre-commit hook environments, ansible-test sanity venvs, python3 (distribution), python3.11, python3.13, python<PYTHON_VERSION> (the one of /opt/venv), git, shellcheck, /opt/ci-pins.sha256" \ net.rkdr.mortis.contents="Ubuntu 26.04, /opt/venv (ansible-core, ansible-lint, pre-commit, antsibull-changelog, galaxy-importer, reuse, molecule, molecule-plugins[docker], proxmoxer), /opt/collections (community.general, ansible.posix, community.proxmox, community.docker), /opt/pre-commit hook environments, ansible-test sanity venvs, python3 (distribution), python3.11, python3.13, python<PYTHON_VERSION> (the one of /opt/venv), git, shellcheck, /opt/ci-pins.sha256" \
net.rkdr.mortis.usage="Lint and Build: job container on the kamino-docker runner, git.rkdr.net/mortis/ci:version@sha256:digest with PRE_COMMIT_HOME set to /opt/pre-commit. Molecule (host executor, kamino-molecule runner): docker run as the runner user, with the Docker socket and the checkout mounted at the same path. In both, run sha256sum -c /opt/ci-pins.sha256 in the checkout root and install the pinned tools and collections when a pull request changed them, else use /opt/venv/bin and ANSIBLE_COLLECTIONS_PATH=/opt/collections. See the documentation label." net.rkdr.mortis.usage="Lint and Build: job container on the kamino-docker runner, git.rkdr.net/mortis/ci:version@sha256:digest with PRE_COMMIT_HOME set to /opt/pre-commit. Run sha256sum -c /opt/ci-pins.sha256 in the checkout root and install the pinned tools and collections when a pull request changed them, else use /opt/venv/bin and ANSIBLE_COLLECTIONS_PATH=/opt/collections. See the documentation label."
ENV PIP_DISABLE_PIP_VERSION_CHECK=1 \ ENV PIP_DISABLE_PIP_VERSION_CHECK=1 \
PRE_COMMIT_HOME=/opt/pre-commit \ PRE_COMMIT_HOME=/opt/pre-commit \