ci: follow-ups after moving Molecule to the molecule-controller image #506

Open
Claude wants to merge 7 commits from ci/505-controller-followups into main
pull from: ci/505-controller-followups
7 changed files with 10 additions and 10 deletions
Showing only changes of commit 3414880d05 - Show all commits

No files matched your search

+2 -2
View File
@@ -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}-<name>` and labels it
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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:
@@ -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=<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
selected="$(cat)"
@@ -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_<name> 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)
+1 -1
View File
@@ -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"]