From 3414880d052148e681b7930e5b3d7c878aa87e0f Mon Sep 17 00:00:00 2001 From: Defame1297 Date: Wed, 2 Dec 2026 08:27:57 +0000 Subject: [PATCH] ci(molecule): rename the run script after the molecule-controller image scripts/run_molecule_in_ci_image.sh runs inside the molecule-controller image, not the ci image, so its name pointed readers at the wrong image. Its test file and class follow, and every reference is updated. ADR 0003 keeps the old name: it records what that change touched. main's selector sees the old and the new path (it diffs with --no-renames) and neither is on IGNORED, so this pull request runs every scenario through the renamed script of its own checkout. Assisted-by: Claude Code --- .gitea/workflows/AGENTS.md | 4 ++-- .gitea/workflows/molecule.yml | 2 +- docs/images/molecule-controller.md | 2 +- requirements.yml | 2 +- ...olecule_in_ci_image.sh => run_molecule_in_controller.sh} | 2 +- ...le_in_ci_image.py => test_run_molecule_in_controller.py} | 6 +++--- tests/scripts/test_run_molecule_scenarios.py | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) rename scripts/{run_molecule_in_ci_image.sh => run_molecule_in_controller.sh} (98%) rename tests/scripts/{test_run_molecule_in_ci_image.py => test_run_molecule_in_controller.py} (97%) diff --git a/.gitea/workflows/AGENTS.md b/.gitea/workflows/AGENTS.md index 6fab069..2abc3de 100644 --- a/.gitea/workflows/AGENTS.md +++ b/.gitea/workflows/AGENTS.md @@ -109,7 +109,7 @@ issue. (release versions, `build_ignore`) do not change what a scenario runs, and the Build check proves the collection builds; they had caused about a third of full pull request runs and their minutes (#338). *Held:* control: `scripts/check_scenarios_load_checkout.py`, which - `run_molecule_in_ci_image.sh` runs on the selected scenarios before they start, fails the run + `run_molecule_in_controller.sh` runs on the selected scenarios before they start, fails the run when the environment molecule gives `ansible-playbook` resolves `mortis.kamino` anywhere else, or when `prerun` is not off once the base config is merged as molecule's CLI merges it (a scenario turns it on, or the base config is moved or turns it on). @@ -148,7 +148,7 @@ issue. `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. + `run_molecule_in_controller.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` steps, with a role scenario's `check` right before and right after `converge`, names each platform `${KAMINO_RUN_ID:-local}-` and labels it diff --git a/.gitea/workflows/molecule.yml b/.gitea/workflows/molecule.yml index 6c56d92..63bafd9 100644 --- a/.gitea/workflows/molecule.yml +++ b/.gitea/workflows/molecule.yml @@ -220,7 +220,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 \ - "$CONTROLLER_IMAGE" scripts/run_molecule_in_ci_image.sh <<< "$SELECTED" + "$CONTROLLER_IMAGE" scripts/run_molecule_in_controller.sh <<< "$SELECTED" # A cancelled run can leave its containers running when the docker client is killed. - name: Remove this run's containers diff --git a/docs/images/molecule-controller.md b/docs/images/molecule-controller.md index fe9509f..d31a07c 100644 --- a/docs/images/molecule-controller.md +++ b/docs/images/molecule-controller.md @@ -33,7 +33,7 @@ checkout). In the checkout root, run `sha256sum --quiet -c /opt/molecule-pins.sh 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. +`scripts/run_molecule_in_controller.sh` runs the pin check inside it. Read the workflow for the full command. ## Tags and pinning diff --git a/requirements.yml b/requirements.yml index b0a0541..0dbbfe5 100644 --- a/requirements.yml +++ b/requirements.yml @@ -4,7 +4,7 @@ # against. One file feeds every consumer, so they cannot drift apart: # - the ci image (images/ci/Dockerfile) bakes it into /opt/collections for Lint; # - the molecule-controller image (images/molecule-controller/Dockerfile) bakes it for Molecule, -# and scripts/run_molecule_in_ci_image.sh installs it itself when a pull request changes it; +# and scripts/run_molecule_in_controller.sh installs it itself when a pull request changes it; # - scripts/dev-setup.sh installs it into .ansible/collections for local lint. # Renovate (renovate.json, ansible-galaxy manager) bumps these pins. collections: diff --git a/scripts/run_molecule_in_ci_image.sh b/scripts/run_molecule_in_controller.sh similarity index 98% rename from scripts/run_molecule_in_ci_image.sh rename to scripts/run_molecule_in_controller.sh index b246634..32b8a78 100755 --- a/scripts/run_molecule_in_ci_image.sh +++ b/scripts/run_molecule_in_controller.sh @@ -7,7 +7,7 @@ # writable for the runner user) and put them first, then check that the scenarios on stdin load this # checkout and run them. CI_BASE_PYTHON is a test seam. # -# AC_ROOT= scripts/run_molecule_in_ci_image.sh < scenario-dirs +# AC_ROOT= scripts/run_molecule_in_controller.sh < scenario-dirs set -euo pipefail selected="$(cat)" diff --git a/tests/scripts/test_run_molecule_in_ci_image.py b/tests/scripts/test_run_molecule_in_controller.py similarity index 97% rename from tests/scripts/test_run_molecule_in_ci_image.py rename to tests/scripts/test_run_molecule_in_controller.py index a77bace..a6af6f5 100644 --- a/tests/scripts/test_run_molecule_in_ci_image.py +++ b/tests/scripts/test_run_molecule_in_controller.py @@ -1,6 +1,6 @@ # SPDX-FileCopyrightText: Defame1297 and contributors # SPDX-License-Identifier: GPL-3.0-or-later -"""Tests for scripts/run_molecule_in_ci_image.sh with stub tools in place of the molecule-controller +"""Tests for scripts/run_molecule_in_controller.sh with stub tools in place of the molecule-controller image's. Run with: python3 -m unittest discover -s tests/scripts @@ -14,7 +14,7 @@ import tempfile import unittest REPO = pathlib.Path(__file__).resolve().parents[2] -SCRIPT = REPO / "scripts" / "run_molecule_in_ci_image.sh" +SCRIPT = REPO / "scripts" / "run_molecule_in_controller.sh" # Each stub appends its name, arguments and the paths it saw to STUB_LOG; STUB_FAIL_ fails it. STUB = """#!/usr/bin/env bash @@ -50,7 +50,7 @@ echo "runner args=$* path=$PATH acp=$ANSIBLE_COLLECTIONS_PATH" \\ @unittest.skipUnless(shutil.which("bash"), "bash is required") -class RunMoleculeInCiImageTest(unittest.TestCase): +class RunMoleculeInControllerTest(unittest.TestCase): def setUp(self): self.tmp = pathlib.Path(tempfile.mkdtemp(prefix="kamino-runci-")).resolve() self.addCleanup(shutil.rmtree, self.tmp, True) diff --git a/tests/scripts/test_run_molecule_scenarios.py b/tests/scripts/test_run_molecule_scenarios.py index d8981a0..8847f50 100644 --- a/tests/scripts/test_run_molecule_scenarios.py +++ b/tests/scripts/test_run_molecule_scenarios.py @@ -616,7 +616,7 @@ class WorkflowJobsTest(unittest.TestCase): self.assertEqual( step["env"]["SELECTED"], "${{ needs.select.outputs.scenarios }}" ) - self.assertIn('run_molecule_in_ci_image.sh <<< "$SELECTED"', step["run"]) + self.assertIn('run_molecule_in_controller.sh <<< "$SELECTED"', step["run"]) def test_the_result_runs_whatever_the_others_ended_as(self): job = self.JOBS["result"]