From 7d11d23294ea2575b1a13716cbce5d4c0b96d1b9 Mon Sep 17 00:00:00 2001 From: Defame1297 Date: Fri, 27 Nov 2026 15:20:18 +0000 Subject: [PATCH 1/2] ci: share a Molecule base config with prerun off and smart gathering Add .config/molecule/config.yml, which molecule merges under every scenario's molecule.yml. prerun is off: the CI wrapper already puts the checkout first on ANSIBLE_COLLECTIONS_PATH, so molecule's per-scenario reinstall of mortis.kamino into ANSIBLE_HOME is redundant. gathering is smart, so each host's facts are gathered once per playbook run instead of in every play. Add .config to build_ignore so scripts/check_tarball.py does not fail the build, and reword the Molecule rule and the two script comments that said molecule installs the collection into each scenario's ANSIBLE_HOME. Assisted-by: Claude Code:claude-opus-5-5 --- .config/molecule/config.yml | 9 +++++++++ .gitea/workflows/AGENTS.md | 7 ++++--- galaxy.yml | 1 + scripts/run_molecule_in_ci_image.sh | 4 ++-- scripts/run_molecule_scenarios.sh | 3 ++- 5 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 .config/molecule/config.yml diff --git a/.config/molecule/config.yml b/.config/molecule/config.yml new file mode 100644 index 0000000..573e2c3 --- /dev/null +++ b/.config/molecule/config.yml @@ -0,0 +1,9 @@ +--- +# Merged under every scenario's molecule.yml. prerun off: the CI wrapper puts this checkout +# first on ANSIBLE_COLLECTIONS_PATH, so molecule's per-scenario install is unused. +prerun: false +provisioner: + config_options: + defaults: + # Gather each host's facts once per playbook run, not in every play. + gathering: smart diff --git a/.gitea/workflows/AGENTS.md b/.gitea/workflows/AGENTS.md index 9250962..6cba7ac 100644 --- a/.gitea/workflows/AGENTS.md +++ b/.gitea/workflows/AGENTS.md @@ -85,9 +85,10 @@ issue. - **A role named in an include, import, play `roles:` entry or meta dependency is written out in full**, never bare or templated. *Why:* the selector finds dependent roles by their FQCN. *Held:* control: a selector test fails a bare or templated name. -- **Scenarios load `mortis.kamino` from the checkout, never from molecule's installed copy, so - `galaxy.yml` is on IGNORED.** *Why:* molecule installs the collection from `galaxy.yml` into - each scenario's `ANSIBLE_HOME`, which is not on `ANSIBLE_COLLECTIONS_PATH`, so its changes +- **Scenarios load `mortis.kamino` from the checkout, never from an installed copy, so + `galaxy.yml` is on IGNORED.** *Why:* the checkout is first on `ANSIBLE_COLLECTIONS_PATH` and the + shared base config `.config/molecule/config.yml` turns off molecule's install of the collection + (`prerun: false`), so changes to `galaxy.yml` (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 diff --git a/galaxy.yml b/galaxy.yml index f930b4d..57eb7cb 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -39,6 +39,7 @@ build_ignore: - apm_modules - .apm-local - .claude + - .config - .gitea - .gitignore - .pre-commit-config.yaml diff --git a/scripts/run_molecule_in_ci_image.sh b/scripts/run_molecule_in_ci_image.sh index b471a24..9ffe9c8 100755 --- a/scripts/run_molecule_in_ci_image.sh +++ b/scripts/run_molecule_in_ci_image.sh @@ -29,8 +29,8 @@ else fi ansible --version molecule --version -# The collection under test first; molecule also installs it into each scenario's ANSIBLE_HOME, -# which the run script keeps in the job tree. +# The collection under test first; molecule does not install it again (prerun is off in +# .config/molecule/config.yml). export ANSIBLE_COLLECTIONS_PATH="$AC_ROOT:${extra_collections}/opt/collections" # Facts are not injected as variables (deprecated in ansible-core 2.22, removal scheduled for 2.24, see #364), so a # role that reads a bare `ansible_` fails its scenario here instead of in a consumer's inventory. diff --git a/scripts/run_molecule_scenarios.sh b/scripts/run_molecule_scenarios.sh index da915f8..a3fac0a 100755 --- a/scripts/run_molecule_scenarios.sh +++ b/scripts/run_molecule_scenarios.sh @@ -1,7 +1,8 @@ #!/usr/bin/env bash # The Molecule workflow's "Run the scenarios" step: `molecule test` for each scenario directory on # stdin, MOLECULE_LANES (default 4) at a time, each with its own log and ANSIBLE_HOME under -# // (molecule reinstalls the collection there with --force). Exit 1 on a failure. +# // (no collection is installed there: .config/molecule/config.yml sets prerun false). +# Exit 1 on a failure. # # scripts/run_molecule_scenarios.sh < scenario-dirs set -euo pipefail -- 2.43.0 From 380d52cd13194156c06aab39583aeb3c182cddf4 Mon Sep 17 00:00:00 2001 From: Defame1297 Date: Fri, 27 Nov 2026 15:44:34 +0000 Subject: [PATCH 2/2] ci: turn on Ansible pipelining for Molecule scenarios Set connection.pipelining in the shared Molecule base config. Without it, every remote task over the community.docker.docker connection pays extra docker exec and docker cp calls to create a temp dir, copy the module in and clean up; with it, the module goes over stdin. The docker connection declares has_pipelining and has no pipelining option of its own, so core's global setting applies. No role or image sets requiretty. Closes #423 Assisted-by: Claude Code:claude-opus-5-5 --- .config/molecule/config.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.config/molecule/config.yml b/.config/molecule/config.yml index 573e2c3..4ea9b37 100644 --- a/.config/molecule/config.yml +++ b/.config/molecule/config.yml @@ -4,6 +4,10 @@ prerun: false provisioner: config_options: + connection: + # Pipe each module over stdin: without it every task pays extra docker exec and docker cp + # calls to make a temp dir, copy the module in and clean up. + pipelining: true defaults: # Gather each host's facts once per playbook run, not in every play. gathering: smart -- 2.43.0