Files
Kamino/docs/images/molecule-controller.md
T
Defame1297 4db1a2b3c9 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
2026-11-29 19:25:33 +00:00

4.0 KiB

molecule-controller

The Molecule controller image of the mortis.kamino Collection: the tools and collections Molecule runs with, and nothing Lint uses, so a tool bump that only Lint needs leaves this image alone (ADR 0003). It is the controller: the scenarios' target containers come from the molecule-ubuntu* images.

What is in it

Ubuntu 26.04 with:

  • Python tools in /opt/venv (on PATH; it runs on Python 3.14, the version of .python-version, from a baked copy and not from the distribution's python3), from requirements-molecule.lock (the hashed lock of requirements-molecule.txt, installed with pip install --require-hashes): ansible-core, molecule and molecule-plugins[docker] (the Docker driver, with the docker Python SDK). Its ansible-core is the one of requirements-dev.lock: check_image_versions.py pins fails when the two locks differ.
  • The collections the scenarios call in /opt/collections (ANSIBLE_COLLECTIONS_PATH is set to it): those of requirements.yml (community.general, ansible.posix, community.proxmox), which the roles call, and of extensions/molecule/requirements.yml (community.docker), which the Docker driver's own playbooks call.
  • python3, python3-venv and ca-certificates from the distribution. The image runs as root and sets no working directory.
  • /opt/molecule-pins.sha256: the checksums of the four pin files this image was built from.

It has no Docker CLI and no git: mount the host's Docker CLI and socket, and the checkout.

How to use it

On the kamino-molecule runner, a host executor, start it with docker run as the runner user, with the Docker socket, the host's Docker CLI and the checkout mounted at the same path (molecule hands the daemon paths in the checkout). In the checkout root, run sha256sum --quiet -c /opt/molecule-pins.sha256: when it passes, use /opt/venv/bin and /opt/collections as they are; when a pull request changed requirements-molecule.txt, 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.

.gitea/workflows/molecule.yml is its consumer: it pins the image as CONTROLLER_IMAGE, and scripts/run_molecule_in_ci_image.sh runs the pin check inside it. Read the workflow for the full command.

Tags and pinning

  • <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.
  • Pin molecule-controller:<version>@sha256:<digest>; the digest decides what is pulled.

How it is built and kept up to date

.gitea/workflows/image.yml builds it with kaniko (repository root as build context, because the pin files are copied in) on pushes to main that touch its inputs, never on a pull request, and publishes the next patch of the matrix's base: when its inputs differ from those of its newest published version. Its last build step checks itself: the tools run on the pinned Python at the locked versions, the Docker driver loads, every pinned collection is installed and the pin record verifies. It has no image-smoke scenario: the full Molecule run of its pin pull request proves it. The build prints the compressed size of each layer directory, and each pushed layer stays below 100 MB (Cloudflare's request limit).

Image metadata

The org.opencontainers.image.* labels (title, description, version, revision, created, source, documentation, licenses, authors) and net.rkdr.mortis.* labels (what it is for, what it contains, how to use it; the base image is base.name) are listed on the package page of the registry; version, revision and created are set by the build.

Source: https://git.rkdr.net/mortis/kamino, images/molecule-controller/Dockerfile. Licence: GPL-3.0-or-later.