ci(molecule): run only the scenarios of the roles a pull request changes
A pull request now runs the scenarios of the roles it touches, none when it touches only paths no scenario reads, and everything for any other file, for every push to main and for manual dispatch. The job stays unconditional so Molecule can remain a required check. scripts/select_molecule_scenarios.py makes the choice and is run from the base branch's copy, so a pull request cannot edit its own rules. A changed role that exists but has no scenario fails instead of passing with nothing tested. The scenario loop no longer gives molecule the list as stdin, which a child could have drained, and fails when it ran fewer scenarios than were selected. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014uGZTNmHMc85bomfevwUDG
This commit is contained in:
1 parent
2721509cde
commit
4d330d41c7
5 files changed
+480
-20
No files matched your search
@@ -59,7 +59,12 @@ Single-context: `GLOSSARY.md` and `docs/adr/` at the root, both created lazily.
|
||||
checksums baked into the image: a PR that changes `requirements-dev.txt` or
|
||||
`.pre-commit-config.yaml` takes the slower path that installs the pinned tools.
|
||||
- Molecule runs on every same-repo pull request, Renovate's included (a new image is tested by its own pin
|
||||
pull request), with no path filter, so that it can be a required check. Fork pull requests are skipped.
|
||||
pull request), with no workflow path filter, so that it can be a required check. Fork pull requests are skipped.
|
||||
What a pull request runs is chosen by `scripts/select_molecule_scenarios.py`, run from the base branch's copy
|
||||
(a pull request cannot edit its own rules): only the scenarios of the roles it changes, none for a diff of
|
||||
only its IGNORED paths, a failure for a changed role with no scenario, and every scenario for any other file,
|
||||
for every push to `main` and for manual dispatch. A new file outside `roles/<role>/` runs everything until it
|
||||
is added to IGNORED, which is right only when no scenario reads it.
|
||||
- Molecule discovers `extensions/molecule/*/` and `roles/*/molecule/*/`. The `image-smoke`
|
||||
and `image-smoke-2604` scenarios test the molecule images themselves (24.04 and 26.04); a role scenario that
|
||||
must pass on both takes `image: ${MOLECULE_IMAGE}` or `${MOLECULE_IMAGE_2604}` per platform.
|
||||
|
||||
Reference in new issue
Block a user