ci(molecule): start the longest scenarios first and pass the lane count in #461

Merged
Defame1297 merged 4 commits from ci/432-molecule-order-lanes into main 2026-11-28 15:02:01 +00:00
Owner

What and why

Part of #432 (does not close it: the 2- vs 4-lane comparison is still to do).

  • Longest first. scripts/run_molecule_scenarios.sh keeps a duration list per scenario directory, from the last full run, and starts scenarios longest first. An unlisted scenario starts first, and ties keep the selection order. The log groups still print in selection order.
  • Lane count. A lanes workflow_dispatch input reaches the run container through env: and -e MOLECULE_LANES, never interpolated in run:. An empty value falls back to the script's default of 4. The script already refuses anything but a positive integer.
  • Timing. .config/molecule/config.yml enables the ansible.posix.profile_tasks (summary only, top 20 tasks) and ansible.posix.timer callbacks. They are here for #432's measurement and for the follow-ups under #419 (#455–#460), which each have to state a measured saving; the job log had no per-task timing before.
  • The Molecule lanes rule in .gitea/workflows/AGENTS.md now covers the start order and the input.

Verified

  • python3 -m unittest discover -s tests/scripts: 298 tests pass. New tests cover the start order (derived from the list itself), that every listed path is a real scenario, that an empty lane count is accepted, and that the input reaches the scenario runner.
  • pre-commit run --all-files passes, and ansible-test sanity passed on push.
  • CI run 6363 is green: all 19 scenarios pass. The four longest scenarios finish first, so they started first. Each playbook run prints the task recap and its run time.
  • The full Molecule job took 35 min 0 s, against 35 min 49 s on the last full run of main. The gain is smaller than the ideal packing predicted, because the four longest scenarios now run at the same time and each got slower: ufw 907 → 1273 s, traefik 886 → 1027 s, gitea_runner 762 → 830 s. That is one run; the lane comparison in #432 should show whether this holds.

Not verified

  • Whether Gitea fills inputs.lanes for a dispatch. If it doesn't, the run silently uses 4 lanes. A dispatch with lanes=2 will show it.
  • #432's third criterion: a full run each with 2 and 4 lanes, and the chosen default.

  • I confirm third-party material is recorded in NOTICE and REUSE.toml, or there is none.

Assisted-by: Claude Code

## What and why Part of #432 (does not close it: the 2- vs 4-lane comparison is still to do). - **Longest first.** `scripts/run_molecule_scenarios.sh` keeps a duration list per scenario directory, from the last full run, and starts scenarios longest first. An unlisted scenario starts first, and ties keep the selection order. The log groups still print in selection order. - **Lane count.** A `lanes` `workflow_dispatch` input reaches the run container through `env:` and `-e MOLECULE_LANES`, never interpolated in `run:`. An empty value falls back to the script's default of 4. The script already refuses anything but a positive integer. - **Timing.** `.config/molecule/config.yml` enables the `ansible.posix.profile_tasks` (summary only, top 20 tasks) and `ansible.posix.timer` callbacks. They are here for #432's measurement and for the follow-ups under #419 (#455–#460), which each have to state a measured saving; the job log had no per-task timing before. - The Molecule lanes rule in `.gitea/workflows/AGENTS.md` now covers the start order and the input. ## Verified - `python3 -m unittest discover -s tests/scripts`: 298 tests pass. New tests cover the start order (derived from the list itself), that every listed path is a real scenario, that an empty lane count is accepted, and that the input reaches the scenario runner. - `pre-commit run --all-files` passes, and `ansible-test sanity` passed on push. - CI run 6363 is green: all 19 scenarios pass. The four longest scenarios finish first, so they started first. Each playbook run prints the task recap and its run time. - The full Molecule job took 35 min 0 s, against 35 min 49 s on the last full run of `main`. The gain is smaller than the ideal packing predicted, because the four longest scenarios now run at the same time and each got slower: `ufw` 907 → 1273 s, `traefik` 886 → 1027 s, `gitea_runner` 762 → 830 s. That is one run; the lane comparison in #432 should show whether this holds. ## Not verified - Whether Gitea fills `inputs.lanes` for a dispatch. If it doesn't, the run silently uses 4 lanes. A dispatch with `lanes=2` will show it. - #432's third criterion: a full run each with 2 and 4 lanes, and the chosen default. --- - [x] I confirm third-party material is recorded in `NOTICE` and `REUSE.toml`, or there is none. Assisted-by: Claude Code
Claude added this to the CI velocity (emergency) milestone 2026-11-28 08:49:27 +00:00
Claude added 3 commits 2026-11-28 08:49:27 +00:00
Part of #432. A long scenario started late sets the end of a full run, so
run_molecule_scenarios.sh now starts scenarios by the durations of the last
full run, longest first, with an unlisted scenario first; the log groups keep
the selection order. A workflow_dispatch input `lanes` reaches the script as
MOLECULE_LANES, so full runs with different lane counts can be compared; an
empty value keeps the default of 4.

The shared molecule config enables ansible.posix.profile_tasks (summary only)
and ansible.posix.timer, so each scenario's log shows where its time goes.

Assisted-by: Claude Code
Part of #432. The start-order test now reads its scenarios and their seconds
from the run script's list, so a refreshed list does not break it; the
empty-lanes test only asserts the value is accepted, and the script's header
and duration-list comments are rewrapped and say the list is keyed by
scenario directory.

Assisted-by: Claude Code
test(molecule): wrap the runner stub under the sanity line limit
Build / build (pull_request) Successful in 30s
Lint / lint (pull_request) Successful in 3m51s
Molecule / molecule (pull_request) Successful in 34m54s
92cf7257d4
Part of #432

Assisted-by: Claude Code
CODEOWNERS rules requested review from Defame1297 2026-11-28 08:49:27 +00:00
Defame1297 added 1 commit 2026-11-28 14:22:43 +00:00
Merge branch 'main' into ci/432-molecule-order-lanes
Build / build (pull_request) Successful in 29s
Lint / lint (pull_request) Successful in 4m8s
Molecule / molecule (pull_request) Successful in 38m42s
c0c1485470
Defame1297 approved these changes 2026-11-28 14:23:14 +00:00
Defame1297 scheduled this pull request to auto merge when all checks succeed 2026-11-28 14:23:17 +00:00
Defame1297 merged commit b5a5a4efa1 into main 2026-11-28 15:02:01 +00:00
Defame1297 deleted branch ci/432-molecule-order-lanes 2026-11-28 15:02:02 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#461