ci(molecule): run Molecule in the molecule-controller image

Molecule ran in the ci image, so a ci pin bump for a tool only Lint uses selected every
scenario (ADR 0003). The workflow now pins molecule-controller 0.1.0 by digest as
CONTROLLER_IMAGE, the hand-made first pin the ADR calls for.

- The run script checks /opt/molecule-pins.sha256 and installs requirements-molecule.lock
  when a pull request changed a pin file.
- The selector reads CONTROLLER_IMAGE: a controller pin change selects every scenario; a ci
  pin bump touches only lint.yml and build.yml, which are on IGNORED, so it selects none.
- Tests show requirements-molecule.* selects every scenario and requirements-dev.* none.
- Renovate's molecule.yml regex matches CONTROLLER_IMAGE.

Closes #434

Assisted-by: Claude Code
This commit is contained in:
Defame1297 committed 2026-11-29 19:25:33 +00:00
1 parent 6e89e4d857
commit 89bd579e87
7 files changed
+58 -32

No files matched your search

+11 -9
View File
@@ -11,11 +11,12 @@ name: Molecule
# own workflow file. The boundaries are write access, which only trusted people have, and Gitea's
# approval gate on fork runs, which the fork rule in docs/contributing/reviewing.md keeps shut.
#
# molecule runs in the pinned ci image via `docker run` with the runner's Docker socket, so the
# scenario containers start beside it on the runner's daemon; the job tree is mounted at the same
# path, so the paths molecule hands the daemon resolve. Like Lint and Build, it installs the pull
# request's pins when they differ from the image's. The images are pinned by tag and digest: bump
# them here when image.yml publishes a new ci, molecule-ubuntu2404 or molecule-ubuntu2604 version.
# molecule runs in the pinned molecule-controller image via `docker run` with the runner's Docker
# socket, so the scenario containers start beside it on the runner's daemon; the job tree is mounted
# at the same path, so the paths molecule hands the daemon resolve. Like Lint and Build, it installs
# the pull request's pins when they differ from the image's. The images are pinned by tag and
# digest: bump them here when image.yml publishes a new molecule-controller, molecule-ubuntu2404 or
# molecule-ubuntu2604 version.
on: # yamllint disable-line rule:truthy
pull_request:
branches:
@@ -57,9 +58,10 @@ jobs:
# age past which the sweep step removes a run's containers; a script test holds the two equal.
timeout-minutes: 90
env:
# The tools and collections molecule runs with: the image Lint and Build use.
CI_IMAGE: >-
git.rkdr.net/mortis/ci:0.2.48@sha256:d1c6653255abf366462c0265d9372626d5b59095084fe74ae95b9ebe7414007d
# The tools and collections molecule runs with, apart from Lint's (ADR 0003), so a tool
# bump only Lint uses selects no scenario.
CONTROLLER_IMAGE: >-
git.rkdr.net/mortis/molecule-controller:0.1.0@sha256:d4ab16d58851eead751c8f0bada8edd76c9e5dcd5c2acaa1ac93c5f6035b29e2
# Used by the scenarios as `image: ${MOLECULE_IMAGE}`; set it the same way to run
# one locally.
MOLECULE_IMAGE: >-
@@ -163,7 +165,7 @@ jobs:
-v "$ac_root:$ac_root" -v "$ac_root/passwd:/etc/passwd:ro" -w "$PWD" \
-e "AC_ROOT=$ac_root" -e "HOME=$ac_root/home" -e "USER=$(id -un)" \
-e MOLECULE_IMAGE -e MOLECULE_IMAGE_2604 -e KAMINO_RUN_ID -e MOLECULE_LANES \
"$CI_IMAGE" scripts/run_molecule_in_ci_image.sh <<< "$selected"
"$CONTROLLER_IMAGE" scripts/run_molecule_in_ci_image.sh <<< "$selected"
# A cancelled run can leave its containers running when the docker client is killed.
- name: Remove this run's containers