ci(molecule): stop selecting every scenario on pull requests that do not need it #338

Closed
opened 2026-11-23 20:55:53 +00:00 by Claude · 2 comments
Owner

Problem

From 2 to 23 Nov, 45 of 243 pull request Molecule runs selected every scenario. They took 576 of 2081 runner-minutes, about 28% of all CI time. Every job shares one runner slot, so these runs also hold back every other pull request's Lint and Build.

scripts/select_molecule_scenarios.py selects every scenario for any changed path that is not under roles/<role>/, not an extension scenario and not on IGNORED. This fails safe by design. The paths that still select everything are:

  • .gitea/workflows/molecule.yml, including the Molecule image pin
  • scripts/run_molecule_scenarios.sh
  • any script not listed on IGNORED
  • requirements.yml and extensions/molecule/requirements.yml
  • meta/, galaxy.yml and plugins/

It is not yet known which of these paths caused the 45 runs. The selector writes its reason as a ::notice:: line in each job log.

Out of scope:

  • push-to-main and nightly runs (#166)
  • runner capacity (#243)
  • the speed of each scenario

Proposal

  1. Measure. For every pull request run since 2026-11-02 that selected every scenario, read the path that caused it from the selector notice, and count the runs per path.

  2. Narrow by evidence. Add to IGNORED the paths that no scenario reads. Likely candidates are scripts that neither molecule.yml nor run_molecule_scenarios.sh calls.

  3. Decide, maintainer. Some changes affect the test setup itself: molecule.yml, run_molecule_scenarios.sh, the requirements files and the Molecule image pin. For these, choose between:

    • keeping the full selection, or
    • running a fixed canary subset on the pull request and relying on the nightly full run.

    This touches what Molecule proves (#256). After #166 lands, the nightly run is the only full run on main.

Acceptance criteria

  • A comment on this issue lists, for each path, how many full-selection pull request runs it caused since 2026-11-02.
  • Every path added to IGNORED is shown to be read by no scenario (grep of molecule.yml, run_molecule_scenarios.sh and roles/*/molecule/) and has a test case in tests/scripts/. python3 -m unittest discover -s tests/scripts passes.
  • The decision on setup-wide changes is recorded as a comment here, and in .gitea/workflows/AGENTS.md if it changes a rule.
  • One week after merge, the share of pull request Molecule runner-minutes spent on full selections is measured again and compared with the 28% above.
## Problem From 2 to 23 Nov, 45 of 243 pull request Molecule runs selected every scenario. They took 576 of 2081 runner-minutes, about 28% of all CI time. Every job shares one runner slot, so these runs also hold back every other pull request's Lint and Build. `scripts/select_molecule_scenarios.py` selects every scenario for any changed path that is not under `roles/<role>/`, not an extension scenario and not on `IGNORED`. This fails safe by design. The paths that still select everything are: - `.gitea/workflows/molecule.yml`, including the Molecule image pin - `scripts/run_molecule_scenarios.sh` - any script not listed on `IGNORED` - `requirements.yml` and `extensions/molecule/requirements.yml` - `meta/`, `galaxy.yml` and `plugins/` It is not yet known which of these paths caused the 45 runs. The selector writes its reason as a `::notice::` line in each job log. Out of scope: - push-to-main and nightly runs (#166) - runner capacity (#243) - the speed of each scenario ## Proposal 1. **Measure.** For every pull request run since 2026-11-02 that selected every scenario, read the path that caused it from the selector notice, and count the runs per path. 2. **Narrow by evidence.** Add to `IGNORED` the paths that no scenario reads. Likely candidates are scripts that neither `molecule.yml` nor `run_molecule_scenarios.sh` calls. 3. **Decide, maintainer.** Some changes affect the test setup itself: `molecule.yml`, `run_molecule_scenarios.sh`, the requirements files and the Molecule image pin. For these, choose between: - keeping the full selection, or - running a fixed canary subset on the pull request and relying on the nightly full run. This touches what Molecule proves (#256). After #166 lands, the nightly run is the only full run on `main`. ## Acceptance criteria - [ ] A comment on this issue lists, for each path, how many full-selection pull request runs it caused since 2026-11-02. - [ ] Every path added to `IGNORED` is shown to be read by no scenario (grep of `molecule.yml`, `run_molecule_scenarios.sh` and `roles/*/molecule/`) and has a test case in `tests/scripts/`. `python3 -m unittest discover -s tests/scripts` passes. - [ ] The decision on setup-wide changes is recorded as a comment here, and in `.gitea/workflows/AGENTS.md` if it changes a rule. - [ ] One week after merge, the share of pull request Molecule runner-minutes spent on full selections is measured again and compared with the 28% above.
Claude added this to the CI velocity (emergency) milestone 2026-11-23 20:55:53 +00:00
Claude added the Kind/EnhancementKind/Testing
Priority
High
2
Status
Needs Triage
labels 2026-11-23 20:55:53 +00:00
Author
Owner

Triage: step 3 decided, scope amended

Decision (maintainer): a pull request that changes the Molecule setup itself (.gitea/workflows/molecule.yml including the Molecule image pin, scripts/run_molecule_scenarios.sh, requirements.yml, extensions/molecule/requirements.yml) keeps selecting every scenario. No canary subset.

Reason: these files change what every scenario runs on, and with push-to-main Molecule gone (#166) the nightly run is the only full run on main; a canary would let a break merge and show up only overnight. Revisit if the step-1 count shows these paths cause most of the full-selection runs.

This keeps the current behaviour, so it changes no rule in .gitea/workflows/AGENTS.md; acceptance criterion 3 is met by this comment. These paths must not be added to IGNORED.

Scope change: acceptance criterion 4 (re-measure one week after merge) moves to a follow-up issue, since it cannot be done in the pull request. This issue is done when criteria 1 and 2 are met.

Assisted-by: Claude Code

## Triage: step 3 decided, scope amended **Decision (maintainer):** a pull request that changes the Molecule setup itself (`.gitea/workflows/molecule.yml` including the Molecule image pin, `scripts/run_molecule_scenarios.sh`, `requirements.yml`, `extensions/molecule/requirements.yml`) **keeps selecting every scenario**. No canary subset. *Reason:* these files change what every scenario runs on, and with push-to-main Molecule gone (#166) the nightly run is the only full run on `main`; a canary would let a break merge and show up only overnight. Revisit if the step-1 count shows these paths cause most of the full-selection runs. This keeps the current behaviour, so it changes no rule in `.gitea/workflows/AGENTS.md`; acceptance criterion 3 is met by this comment. These paths must **not** be added to `IGNORED`. **Scope change:** acceptance criterion 4 (re-measure one week after merge) moves to a follow-up issue, since it cannot be done in the pull request. This issue is done when criteria 1 and 2 are met. Assisted-by: Claude Code
Claude added
Status
Ready for Agent
and removed
Status
Needs Triage
labels 2026-11-24 11:20:52 +00:00
Defame1297 was assigned by Claude 2026-11-24 11:36:07 +00:00
Author
Owner

Step 1: full-selection pull request runs since 2026-11-02, by causing path. .gitea/workflows/molecule.yml 26 runs (246 min); galaxy.yml 22 (226); requirements.yml 1 (8); paths that are now on IGNORED 17 (211); CLAUDE.md (removed) 1. Total 67 runs, 703 min. Another 40 runs ended in a selector error and 25 logs were unreadable.

Step 2: every path that still selects every scenario is read by the run (the workflow, run_molecule_in_ci_image.sh, the requirements files, meta/runtime.yml, galaxy.yml), so nothing is added to IGNORED. test_anything_else_selects_everything already covers them.

Follow-up: galaxy.yml is the largest cause after the workflow itself, mostly release version bumps; narrowing it needs a content-aware rule, filed as #352. The re-measure is #351.

Closing: criteria 1 and 2 are met, criterion 3 by the triage comment above, criterion 4 moved to #351.

Assisted-by: Claude Code

**Step 1: full-selection pull request runs since 2026-11-02, by causing path.** `.gitea/workflows/molecule.yml` 26 runs (246 min); `galaxy.yml` 22 (226); `requirements.yml` 1 (8); paths that are now on `IGNORED` 17 (211); `CLAUDE.md` (removed) 1. Total 67 runs, 703 min. Another 40 runs ended in a selector error and 25 logs were unreadable. **Step 2:** every path that still selects every scenario is read by the run (the workflow, `run_molecule_in_ci_image.sh`, the requirements files, `meta/runtime.yml`, `galaxy.yml`), so nothing is added to `IGNORED`. `test_anything_else_selects_everything` already covers them. **Follow-up:** `galaxy.yml` is the largest cause after the workflow itself, mostly release version bumps; narrowing it needs a content-aware rule, filed as #352. The re-measure is #351. Closing: criteria 1 and 2 are met, criterion 3 by the triage comment above, criterion 4 moved to #351. Assisted-by: Claude Code
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: Mortis/Kamino#338