No issue. A full Molecule run takes about 18 minutes of job time: 15 scenarios, one after another. While it runs it holds the only runner slot.
f77586d: remove each scenario's containers in the workflow instead of molecule's destroy.
What changes: no scenario's test_sequence ends with destroy any more. Right after each scenario, pass or fail, the workflow removes that scenario's containers with docker rm -f, by the platform names in its molecule.yml.
Why: the driver's destroy waits about 5.6 s per scenario for the deletion (about 84 s over 15 scenarios). The whole destroy phase measured about 103 s per full run (median of full runs 4764, 4714, 4698, 4578 and others).
Updates the test_sequence rule in .gitea/workflows/AGENTS.md.
1ab01b6: run the selected scenarios side by side in four lanes.
What changes: the new scripts/run_molecule_scenarios.sh runs MOLECULE_LANES (default 4) scenarios at once.
Each scenario gets its own ANSIBLE_HOME, because molecule reinstalls the collection there with --force and keeps its ephemeral state there.
Each scenario gets its own log, printed afterwards in selection order in a ::group:: with its wall time, plus a timing summary.
It keeps the failure report, the ran-N-of-M guard, </dev/null and the per-scenario container removal.
Why containers can't clash: every scenario has one platform with a unique literal name, and a test enforces that.
Runs still must not overlap (single slot, #166). The concurrency comment and the .gitea/workflows/AGENTS.md rule now say that scenarios overlap within a run.
Cancellation: a TERM, INT or HUP to the script stops each lane's whole process tree and terminates it, including the groups of ansible's detached workers.
New test file: tests/scripts/test_run_molecule_scenarios.py. It is 304 lines, over the 200 soft limit. The cancel, process-group and lane-cap tests plus the helpers that read the workflow's stale filter need the room, and the existing cases were kept for coverage.
Not on the IGNORED list: the workflow runs the script, so a change to it runs every scenario.
No changelog fragment: CI only.
Verified
python3 -m unittest discover -s tests/scripts: all pass. The new tests use stub molecule and docker and cover:
selection order and grouping;
the lane cap;
a separate ANSIBLE_HOME and working directory per scenario;
failure reporting with containers still removed;
a failed removal;
a lane that dies;
an empty selection;
an invalid MOLECULE_LANES;
SIGTERM, a SIGKILL of the process group, and detached (setsid) children.
Each signal test fails against a broken implementation and passed 5 runs out of 5. The tests also check every real molecule.yml: no destroy, unique platform names, all matched by the workflow's stale filter.
pre-commit run --from-ref origin/main --to-ref HEAD passes (actionlint, zizmor, shellcheck, ruff, yamllint and the rest), as does the pre-push ansible-test sanity.
Molecule's source (26.11) shows that a shared ANSIBLE_HOME would race: the prerun reinstalls the collection with --force, and the ephemeral directories could collide. Per-scenario homes rule both out.
Three independent review passes. Their findings are fixed in these commits.
Not verified
Molecule has not run with this change; this pull request's Molecule run is the first test. It will show:
whether four systemd containers (cgroupns_mode: host) run side by side on the runner without interfering;
the real wall-time saving, which is to be recorded next to MOLECULE_LANES under the "Recorded speed" rule once a full run has measured it.
How act_runner's host executor cancels a step. From its source it SIGKILLs the step's process, which runs in its own session on a pty; the resulting SIGHUP reaching the script is inferred, not tested.
The runner's molecule version may differ from the 26.11 source that was read; the runner's venv is not pinned in this repository.
When a scenario fails, molecule still runs its own destroy, so the destroy saving applies to passing scenarios only.
f77586d and #302 both edit roles/traefik/molecule/default/molecule.yml, in different hunks; whichever merges second may need its branch updated.
I confirm third-party material is recorded in NOTICE and REUSE.toml, or there is none.
Assisted-by: Claude Code:claude-opus-5-5
## What and why
No issue. A full Molecule run takes about 18 minutes of job time: 15 scenarios, one after another. While it runs it holds the only runner slot.
**f77586d: remove each scenario's containers in the workflow instead of molecule's destroy.**
- What changes: no scenario's `test_sequence` ends with `destroy` any more. Right after each scenario, pass or fail, the workflow removes that scenario's containers with `docker rm -f`, by the platform names in its `molecule.yml`.
- Why: the driver's destroy waits about 5.6 s per scenario for the deletion (about 84 s over 15 scenarios). The whole destroy phase measured about 103 s per full run (median of full runs 4764, 4714, 4698, 4578 and others).
- Updates the `test_sequence` rule in `.gitea/workflows/AGENTS.md`.
**1ab01b6: run the selected scenarios side by side in four lanes.**
- What changes: the new `scripts/run_molecule_scenarios.sh` runs `MOLECULE_LANES` (default 4) scenarios at once.
- Each scenario gets its own `ANSIBLE_HOME`, because molecule reinstalls the collection there with `--force` and keeps its ephemeral state there.
- Each scenario gets its own log, printed afterwards in selection order in a `::group::` with its wall time, plus a timing summary.
- It keeps the failure report, the ran-N-of-M guard, `</dev/null` and the per-scenario container removal.
- Why containers can't clash: every scenario has one platform with a unique literal name, and a test enforces that.
- Runs still must not overlap (single slot, #166). The concurrency comment and the `.gitea/workflows/AGENTS.md` rule now say that scenarios overlap within a run.
- Cancellation: a TERM, INT or HUP to the script stops each lane's whole process tree and terminates it, including the groups of ansible's detached workers.
- New test file: `tests/scripts/test_run_molecule_scenarios.py`. It is 304 lines, over the 200 soft limit. The cancel, process-group and lane-cap tests plus the helpers that read the workflow's stale filter need the room, and the existing cases were kept for coverage.
- Not on the IGNORED list: the workflow runs the script, so a change to it runs every scenario.
No changelog fragment: CI only.
## Verified
- `python3 -m unittest discover -s tests/scripts`: all pass. The new tests use stub `molecule` and `docker` and cover:
- selection order and grouping;
- the lane cap;
- a separate `ANSIBLE_HOME` and working directory per scenario;
- failure reporting with containers still removed;
- a failed removal;
- a lane that dies;
- an empty selection;
- an invalid `MOLECULE_LANES`;
- SIGTERM, a SIGKILL of the process group, and detached (`setsid`) children.
Each signal test fails against a broken implementation and passed 5 runs out of 5. The tests also check every real `molecule.yml`: no `destroy`, unique platform names, all matched by the workflow's stale filter.
- `pre-commit run --from-ref origin/main --to-ref HEAD` passes (actionlint, zizmor, shellcheck, ruff, yamllint and the rest), as does the pre-push `ansible-test sanity`.
- Molecule's source (26.11) shows that a shared `ANSIBLE_HOME` would race: the prerun reinstalls the collection with `--force`, and the ephemeral directories could collide. Per-scenario homes rule both out.
- Three independent review passes. Their findings are fixed in these commits.
## Not verified
- Molecule has not run with this change; this pull request's Molecule run is the first test. It will show:
- whether four systemd containers (`cgroupns_mode: host`) run side by side on the runner without interfering;
- the real wall-time saving, which is to be recorded next to `MOLECULE_LANES` under the "Recorded speed" rule once a full run has measured it.
- How act_runner's host executor cancels a step. From its source it SIGKILLs the step's process, which runs in its own session on a pty; the resulting SIGHUP reaching the script is inferred, not tested.
- The runner's molecule version may differ from the 26.11 source that was read; the runner's venv is not pinned in this repository.
- When a scenario fails, molecule still runs its own destroy, so the destroy saving applies to passing scenarios only.
- f77586d and #302 both edit `roles/traefik/molecule/default/molecule.yml`, in different hunks; whichever merges second may need its branch updated.
---
- [x] I confirm third-party material is recorded in `NOTICE` and `REUSE.toml`, or there is none.
Assisted-by: Claude Code:claude-opus-5-5
molecule's trailing destroy runs the Docker driver's destroy playbook, whose
"Wait for instance(s) deletion to complete" task alone costs about 5.6 s per
scenario, about 84 s over the 15 scenarios of a full run. The whole destroy
phase measured about 103 s per full run (the median across full runs, among
them 4764, 4714, 4698 and 4578). The workflow already removes stale
containers before the run, so it can remove each scenario's containers itself
with `docker rm -f` as soon as the scenario ends, pass or fail, and skip the
playbook.
The names come from each scenario's molecule.yml (platforms[].name) via the
molecule venv's Python and PyYAML, so no list is kept in the workflow. A
failed removal fails the step. The test_sequence rule in the workflow guidance
now says both destroys are left out and that platform names are literal.
Assisted-by: Claude Code:claude-opus-5-5
A full run executes 15 scenarios one after another, about 1100 s in
total, with the slowest (traefik/default) at about 216 s. The scenarios
share nothing on the runner's Docker daemon but the daemon itself: their
container names are unique. So scripts/run_molecule_scenarios.sh now runs
MOLECULE_LANES (default 4, a positive integer) of them at once inside the
one job, with the slowest scenario as the floor; the saving will be
measured in CI.
Each scenario gets its own ANSIBLE_HOME under the job tree. With
Runtime(isolated=False), ansible-compat uses ANSIBLE_HOME as molecule's
cache dir: molecule's prerun installs the collection under test there with
`ansible-galaxy collection install --force` (which first deletes the
installed copy), and the scenario's ephemeral directory (inventory,
ansible.cfg, state) lives under it. A shared one would let a scenario
delete the copy another is running.
Each scenario's output goes to its own log, printed afterwards in the
selection order inside its own group with its wall time, plus a timing
summary. The failure list, the ran-N-of-M guard, </dev/null stdin, the
role-directory cwd and the per-scenario container removal are kept. A
TERM, INT or HUP to the script stops each lane's whole process tree,
including the process groups of ansible's detached workers (they call
setsid), terminates it, ignores further signals until done, and exits
128 plus the first signal. A kill of the step's process group reaches
the lanes and molecule but not ansible's detached workers. Either way a
cancelled job leaves no molecule behind to recreate a container after
the next run's cleanup. The logic moved from the workflow into a script
so a unit test with stub molecule and docker can hold it; the test also
fails a scenario whose platform name is not unique or not matched by the
stale-container filter, which is what makes running side by side safe.
Assisted-by: Claude Code:claude-opus-5-5
CODEOWNERS rules
requested review from Defame1297 2026-11-22 22:37:42 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What and why
No issue. A full Molecule run takes about 18 minutes of job time: 15 scenarios, one after another. While it runs it holds the only runner slot.
f77586d: remove each scenario's containers in the workflow instead of molecule's destroy.test_sequenceends withdestroyany more. Right after each scenario, pass or fail, the workflow removes that scenario's containers withdocker rm -f, by the platform names in itsmolecule.yml.test_sequencerule in.gitea/workflows/AGENTS.md.1ab01b6: run the selected scenarios side by side in four lanes.scripts/run_molecule_scenarios.shrunsMOLECULE_LANES(default 4) scenarios at once.ANSIBLE_HOME, because molecule reinstalls the collection there with--forceand keeps its ephemeral state there.::group::with its wall time, plus a timing summary.</dev/nulland the per-scenario container removal..gitea/workflows/AGENTS.mdrule now say that scenarios overlap within a run.tests/scripts/test_run_molecule_scenarios.py. It is 304 lines, over the 200 soft limit. The cancel, process-group and lane-cap tests plus the helpers that read the workflow's stale filter need the room, and the existing cases were kept for coverage.No changelog fragment: CI only.
Verified
python3 -m unittest discover -s tests/scripts: all pass. The new tests use stubmoleculeanddockerand cover:ANSIBLE_HOMEand working directory per scenario;MOLECULE_LANES;setsid) children.Each signal test fails against a broken implementation and passed 5 runs out of 5. The tests also check every real
molecule.yml: nodestroy, unique platform names, all matched by the workflow's stale filter.pre-commit run --from-ref origin/main --to-ref HEADpasses (actionlint, zizmor, shellcheck, ruff, yamllint and the rest), as does the pre-pushansible-test sanity.Molecule's source (26.11) shows that a shared
ANSIBLE_HOMEwould race: the prerun reinstalls the collection with--force, and the ephemeral directories could collide. Per-scenario homes rule both out.Three independent review passes. Their findings are fixed in these commits.
Not verified
cgroupns_mode: host) run side by side on the runner without interfering;MOLECULE_LANESunder the "Recorded speed" rule once a full run has measured it.f77586dand #302 both editroles/traefik/molecule/default/molecule.yml, in different hunks; whichever merges second may need its branch updated.NOTICEandREUSE.toml, or there is none.Assisted-by: Claude Code:claude-opus-5-5