ci(molecule): run Molecule with the toolchain baked into the ci image instead of the runner's venv #225

Closed
opened 2026-11-16 12:25:52 +00:00 by Claude · 5 comments
Owner

Spec: Supported and tested ansible-core versions, resolution comment, item 5. How the job reaches the Docker daemon is decided by Molecule and Renovate on the shared runner; follow that resolution.

What to build

  • Pin molecule and its Docker driver (molecule-plugins[docker] or whatever the scenarios use today) in requirements-dev.txt and regenerate the lock (scripts/lock-requirements.sh).
  • In a follow-up pin PR, change .gitea/workflows/molecule.yml to run molecule from the pinned ci image (image:<version>@sha256:<digest>), not from MOLECULE_VENV=/opt/molecule-venv. Drop the "provisioned on the runner by the gitea_runner role" comment and the step that checks for that venv.
  • Make sure Molecule's ansible-core is the one requirements-dev.txt pins, so the stated floor is behaviour-tested.

Not in this issue

  • Removing the venv from the runner's provisioning is in the maintainer's environment repository.

Acceptance

  • Every scenario passes in CI with the image's toolchain.
  • molecule.yml no longer refers to /opt/molecule-venv.
  • The PR says what was verified and what was not.
Spec: [Supported and tested ansible-core versions](https://git.rkdr.net/Mortis/Kamino/issues/206), resolution comment, item 5. How the job reaches the Docker daemon is decided by [Molecule and Renovate on the shared runner](https://git.rkdr.net/Mortis/Kamino/issues/212); follow that resolution. ## What to build - Pin `molecule` and its Docker driver (`molecule-plugins[docker]` or whatever the scenarios use today) in `requirements-dev.txt` and regenerate the lock (`scripts/lock-requirements.sh`). - In a follow-up pin PR, change `.gitea/workflows/molecule.yml` to run molecule from the pinned `ci` image (`image:<version>@sha256:<digest>`), not from `MOLECULE_VENV=/opt/molecule-venv`. Drop the "provisioned on the runner by the gitea_runner role" comment and the step that checks for that venv. - Make sure Molecule's ansible-core is the one `requirements-dev.txt` pins, so the stated floor is behaviour-tested. ## Not in this issue - Removing the venv from the runner's provisioning is in the maintainer's environment repository. ## Acceptance - [ ] Every scenario passes in CI with the image's toolchain. - [ ] `molecule.yml` no longer refers to `/opt/molecule-venv`. - [ ] The PR says what was verified and what was not.
Claude added this to the Continuous delivery milestone 2026-11-16 12:25:52 +00:00
Claude added the
Status
Ready for Agent
label 2026-11-16 12:25:52 +00:00
Author
Owner

Docker access decided in Molecule and Renovate on the shared runner: isolation, capacity and cost, item 2. The Molecule job stays a host-executor job on kamino-molecule and runs docker run on the pinned ci image, with /var/run/docker.sock and the checkout mounted at the same path inside as outside. Molecule in that container starts the scenario containers beside it on the runner's daemon (their /sys/fs/cgroup mounts resolve on the host). No job container (container:) gets the socket, and the runner config does not change. Keep the molecule.yml header true: the job is root-equivalent on the runner, as before. Pass ref and run values to the container through env:/-e, never by interpolating them into run:. This issue is now unblocked; #166 waits on it.

Docker access decided in [Molecule and Renovate on the shared runner: isolation, capacity and cost](https://git.rkdr.net/Mortis/Kamino/issues/212), item 2. The Molecule job stays a host-executor job on `kamino-molecule` and runs `docker run` on the pinned `ci` image, with `/var/run/docker.sock` and the checkout mounted at the same path inside as outside. Molecule in that container starts the scenario containers beside it on the runner's daemon (their `/sys/fs/cgroup` mounts resolve on the host). No job container (`container:`) gets the socket, and the runner config does not change. Keep the `molecule.yml` header true: the job is root-equivalent on the runner, as before. Pass ref and run values to the container through `env:`/`-e`, never by interpolating them into `run:`. This issue is now unblocked; [#166](https://git.rkdr.net/Mortis/Kamino/issues/166) waits on it.
Author
Owner

Review of the map (2026-11-17).

  • Core bump. This issue runs Molecule from the ci image pinned by digest, with no install path for changed pins. So Renovate's ansible-core bump runs every scenario on the old core in its own pull request, although Supported and tested ansible-core versions says the bump "is behaviour-tested by its own PR". Whether the job installs a pull request's changed pins is open in What Molecule proves before a merge, and who acts on the nightly run.
  • "bump the ci image version in the same PR" no longer applies once CI assigns the version.
  • Missing image input. extensions/molecule/requirements.yml (the Docker driver's collection) becomes an input of the ci image: copy it, install it into /opt/collections, add it to /opt/ci-pins.sha256, to image.yml's paths: and to the list of image inputs in the agent context. Reason: the bake-in rule; the image does not read that file today.
  • Acceptance addition: every layer of the ci image stays below 100 MB.
  • The docker run container needs the per-run name and label; see the cancel note on the isolation issue.

Changed: this issue is now blocked by that ticket, because one of its options changes the job this issue builds. feat(images): add a Debian 13 molecule image and test the Proxmox targets on it is now blocked by this issue.

Review of the map (2026-11-17). - **Core bump.** This issue runs Molecule from the `ci` image pinned by digest, with no install path for changed pins. So Renovate's ansible-core bump runs every scenario on the old core in its own pull request, although [Supported and tested ansible-core versions](https://git.rkdr.net/Mortis/Kamino/issues/206) says the bump "is behaviour-tested by its own PR". Whether the job installs a pull request's changed pins is open in [What Molecule proves before a merge, and who acts on the nightly run](https://git.rkdr.net/Mortis/Kamino/issues/256). - "bump the `ci` image version in the same PR" no longer applies once CI assigns the version. - **Missing image input.** `extensions/molecule/requirements.yml` (the Docker driver's collection) becomes an input of the `ci` image: copy it, install it into `/opt/collections`, add it to `/opt/ci-pins.sha256`, to `image.yml`'s `paths:` and to the list of image inputs in the agent context. Reason: the bake-in rule; the image does not read that file today. - **Acceptance addition:** every layer of the `ci` image stays below 100 MB. - The `docker run` container needs the per-run name and label; see the cancel note on the isolation issue. Changed: this issue is now blocked by that ticket, because one of its options changes the job this issue builds. [feat(images): add a Debian 13 molecule image and test the Proxmox targets on it](https://git.rkdr.net/Mortis/Kamino/issues/226) is now blocked by this issue.
Author
Owner

Scope change from What Molecule proves before a merge, and who acts on the nightly run (2026-11-20)

  • Install path for changed pins. The Molecule container compares the checkout's pin files with /opt/ci-pins.sha256, as Lint and Build do. When they differ, it installs the pull request's pins (requirements-dev.lock with requirements-dev.txt, and requirements.yml) before any scenario runs. Without this, the pull request that raises the ansible-core floor runs every scenario on the old core and then automerges.
  • requirements-dev.txt and requirements-dev.lock stay on the selector's IGNORED list. A core minor bump selects every scenario through its meta/runtime.yml edit. Other pin bumps select none.
  • Acceptance, added: a pull request whose pins differ from the image runs its scenarios with the pull request's ansible-core (log ansible --version in the job).
  • This issue is no longer blocked by that ticket.
## Scope change from [What Molecule proves before a merge, and who acts on the nightly run](https://git.rkdr.net/Mortis/Kamino/issues/256) (2026-11-20) - **Install path for changed pins.** The Molecule container compares the checkout's pin files with `/opt/ci-pins.sha256`, as Lint and Build do. When they differ, it installs the pull request's pins (`requirements-dev.lock` with `requirements-dev.txt`, and `requirements.yml`) before any scenario runs. Without this, the pull request that raises the ansible-core floor runs every scenario on the old core and then automerges. - `requirements-dev.txt` and `requirements-dev.lock` **stay** on the selector's IGNORED list. A core minor bump selects every scenario through its `meta/runtime.yml` edit. Other pin bumps select none. - Acceptance, added: a pull request whose pins differ from the image runs its scenarios with the pull request's ansible-core (log `ansible --version` in the job). - This issue is no longer blocked by that ticket.
Author
Owner

Body edited on 2026-11-20 (final validation round of the map, #87 (comment)): removed the instruction to bump the ci image version by hand in the pin PR, because #165 blocks this issue and makes CI assign image versions.

Body edited on 2026-11-20 (final validation round of the map, https://git.rkdr.net/Mortis/Kamino/issues/87#issuecomment-12281): removed the instruction to bump the `ci` image version by hand in the pin PR, because #165 blocks this issue and makes CI assign image versions.
Claude modified the milestone from Continuous delivery to CI velocity (emergency) 2026-11-23 20:55:58 +00:00
Defame1297 was assigned by Claude 2026-11-24 06:49:48 +00:00
Author
Owner

Closed by #345, with a follow-up fix in #348. Acceptance:

  • Every scenario passes in CI with the image's toolchain: run 5327 on #348. The log says "The pin files match the ci image; using the baked tools", and all 16 scenarios passed on ci:0.2.40.
  • A pull request whose pins differ runs on its own ansible-core: run 5302 on #345, which took the slow path and logged ansible [core 2.22.0].
  • molecule.yml no longer refers to /opt/molecule-venv: done in #345.
  • Every ci layer stays below 100 MB: 0.2.40 pushed. Estimated growth was +0.76 MB in /opt/venv and +0.63 MB in /opt/collections.
  • The PR says what was verified: done in #345 and #348.

Two fixes were found only in CI, after #345:

  • Docker CLI (#345, second push): the driver's community.docker.docker connection plugin runs the docker CLI. The host's CLI is mounted read-only into the container. Whether to bake it into the image instead is a separate issue.
  • Account entry (#348): the runner user had no passwd entry in the image, so ansible's ~<user>/.ansible/tmp did not expand. The job now mounts a generated passwd file whose home is the job-tree HOME.

In scope by the maintainer's decision: gitea_runner no longer installs the molecule venv and collections (breaking; changelog fragment in #345).

Assisted-by: Claude Code

Closed by #345, with a follow-up fix in #348. Acceptance: - **Every scenario passes in CI with the image's toolchain:** run 5327 on #348. The log says "The pin files match the ci image; using the baked tools", and all 16 scenarios passed on `ci:0.2.40`. - **A pull request whose pins differ runs on its own ansible-core:** run 5302 on #345, which took the slow path and logged `ansible [core 2.22.0]`. - **`molecule.yml` no longer refers to `/opt/molecule-venv`:** done in #345. - **Every `ci` layer stays below 100 MB:** 0.2.40 pushed. Estimated growth was +0.76 MB in `/opt/venv` and +0.63 MB in `/opt/collections`. - **The PR says what was verified:** done in #345 and #348. Two fixes were found only in CI, after #345: - **Docker CLI (#345, second push):** the driver's `community.docker.docker` connection plugin runs the `docker` CLI. The host's CLI is mounted read-only into the container. Whether to bake it into the image instead is a separate issue. - **Account entry (#348):** the runner user had no passwd entry in the image, so ansible's `~<user>/.ansible/tmp` did not expand. The job now mounts a generated passwd file whose home is the job-tree `HOME`. In scope by the maintainer's decision: `gitea_runner` no longer installs the molecule venv and collections (breaking; changelog fragment in #345). Assisted-by: Claude Code
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: Mortis/Kamino#225