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
This commit is contained in:
1 parent
08c589e910
commit
3414880d05
7 files changed
+10
-10
No files matched your search
@@ -109,7 +109,7 @@ issue.
|
|||||||
(release versions, `build_ignore`) do not change what a scenario runs, and the Build check
|
(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
|
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
|
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,
|
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
|
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).
|
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
|
`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
|
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
|
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`
|
- **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
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ jobs:
|
|||||||
-v "$ac_root:$ac_root" -v "$ac_root/passwd:/etc/passwd:ro" -w "$PWD" \
|
-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 "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 \
|
-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.
|
# A cancelled run can leave its containers running when the docker client is killed.
|
||||||
- name: Remove this run's containers
|
- name: Remove this run's containers
|
||||||
|
|||||||
@@ -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`.
|
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
|
`.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
|
## Tags and pinning
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
# against. One file feeds every consumer, so they cannot drift apart:
|
# 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 ci image (images/ci/Dockerfile) bakes it into /opt/collections for Lint;
|
||||||
# - the molecule-controller image (images/molecule-controller/Dockerfile) bakes it for Molecule,
|
# - 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.
|
# - scripts/dev-setup.sh installs it into .ansible/collections for local lint.
|
||||||
# Renovate (renovate.json, ansible-galaxy manager) bumps these pins.
|
# Renovate (renovate.json, ansible-galaxy manager) bumps these pins.
|
||||||
collections:
|
collections:
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
# writable for the runner user) and put them first, then check that the scenarios on stdin load this
|
# 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.
|
# checkout and run them. CI_BASE_PYTHON is a test seam.
|
||||||
#
|
#
|
||||||
# AC_ROOT=<dir holding ansible_collections> scripts/run_molecule_in_ci_image.sh < scenario-dirs
|
# AC_ROOT=<dir holding ansible_collections> scripts/run_molecule_in_controller.sh < scenario-dirs
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
selected="$(cat)"
|
selected="$(cat)"
|
||||||
+3
-3
@@ -1,6 +1,6 @@
|
|||||||
# SPDX-FileCopyrightText: Defame1297 and contributors
|
# SPDX-FileCopyrightText: Defame1297 and contributors
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# 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.
|
image's.
|
||||||
|
|
||||||
Run with: python3 -m unittest discover -s tests/scripts
|
Run with: python3 -m unittest discover -s tests/scripts
|
||||||
@@ -14,7 +14,7 @@ import tempfile
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
REPO = pathlib.Path(__file__).resolve().parents[2]
|
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_<name> fails it.
|
# Each stub appends its name, arguments and the paths it saw to STUB_LOG; STUB_FAIL_<name> fails it.
|
||||||
STUB = """#!/usr/bin/env bash
|
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")
|
@unittest.skipUnless(shutil.which("bash"), "bash is required")
|
||||||
class RunMoleculeInCiImageTest(unittest.TestCase):
|
class RunMoleculeInControllerTest(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.tmp = pathlib.Path(tempfile.mkdtemp(prefix="kamino-runci-")).resolve()
|
self.tmp = pathlib.Path(tempfile.mkdtemp(prefix="kamino-runci-")).resolve()
|
||||||
self.addCleanup(shutil.rmtree, self.tmp, True)
|
self.addCleanup(shutil.rmtree, self.tmp, True)
|
||||||
@@ -616,7 +616,7 @@ class WorkflowJobsTest(unittest.TestCase):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
step["env"]["SELECTED"], "${{ needs.select.outputs.scenarios }}"
|
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):
|
def test_the_result_runs_whatever_the_others_ended_as(self):
|
||||||
job = self.JOBS["result"]
|
job = self.JOBS["result"]
|
||||||
|
|||||||
Reference in new issue
Block a user