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