Two Molecule runs could not overlap on the runner's Docker daemon, because every scenario's container name was fixed; only the single runner slot kept them apart. Spec: #212 items 1, 3, 6 and 7, with #256 item 4 for Lint and Build.
Per-run names and labels: every scenario platform is named ${KAMINO_RUN_ID:-local}-<name> and labelled net.rkdr.mortis.molecule-run: "${KAMINO_RUN_ID:-local}". The workflow sets KAMINO_RUN_ID (run id and attempt) and passes it into the docker run container, which carries the same label.
Scenario cleanup:scripts/run_molecule_scenarios.sh expands the names with molecule's own Interpolator before removing a scenario's containers. molecule's interpolator also handles the $$ escapes in cloudflared's molecule.yml, which os.path.expandvars would not.
Cleanup only touches the run's own containers: an always() step removes this run's labelled containers. The pre-run sweep removes only labelled containers older than 30 minutes, the job timeout; a script test holds the two values equal. Both steps tolerate a container another run's sweep already removed, and fail if one is still listed afterwards.
Concurrency: pull requests keep their per-PR cancel groups. Scheduled and dispatched runs each get their own group (github.run_id), so no run cancels another. There is no shared group.
No Molecule, Lint or Build on push to main: Build keeps its v* tag trigger and workflow_dispatch, and the Lint and Build concurrency groups are now <wf>-${{ github.ref }}. Nightly and manual dispatch still run every scenario.
Docs: the selector docstring (both "push run after the merge" sentences), the workflow comments and .gitea/workflows/AGENTS.md are corrected.
Test fix: the test helper alive() now also treats a process that exits between open and read (ProcessLookupError) as gone. That race failed about 1 run in 15.
No changelog fragment: CI only, nothing consumer-visible.
Verified
python3 -m unittest discover -s tests/scripts: 235 tests OK. The 6 that need molecule are skipped under system python.
The same test_run_molecule_scenarios.py in a venv with molecule==26.11.0: all 15 tests ran, and 15 looped runs passed.
pre-commit run --all-files: all hooks pass. ansible-test sanity passed in the pre-push hook.
The new tests (per-run name expansion, the label filters in the sweep and cleanup steps, the sweep bound equal to timeout-minutes) were seen failing before the change.
The sweep and cleanup shell was run under bash -e against a stub docker: old container removed, young one kept; a removal racing another sweep passes; a container still listed or a failing docker ps fails the step.
From the pinned molecule-plugins 26.11.0 source: the docker driver merges per-platform labels: into the container labels.
Not verified
No real Molecule run with the new names. That happens in this PR's CI.
The sweep's date -d on the runner's real docker inspect output, and the 30-minute bound in practice.
Acceptance, to be checked after merge:
two Molecule dispatches started together both finish green;
a cancelled run leaves no container after its cleanup step (including whether act_runner runs the always() step on cancel);
a push to main starts no Molecule, Lint or Build run.
Containers left by runs from before this change carry no label, so the sweep never removes them. Any still on the runner have to be removed by hand once.
Concurrency behaviour (queue versus replace a waiting run) was read from Gitea and GitHub documentation, not tested.
I confirm third-party material is recorded in NOTICE and REUSE.toml, or there is none.
Assisted-by: Claude Code
## What and why
Closes #166
Two Molecule runs could not overlap on the runner's Docker daemon, because every scenario's container name was fixed; only the single runner slot kept them apart. Spec: #212 items 1, 3, 6 and 7, with #256 item 4 for Lint and Build.
- **Per-run names and labels:** every scenario platform is named `${KAMINO_RUN_ID:-local}-<name>` and labelled `net.rkdr.mortis.molecule-run: "${KAMINO_RUN_ID:-local}"`. The workflow sets `KAMINO_RUN_ID` (run id and attempt) and passes it into the `docker run` container, which carries the same label.
- **Scenario cleanup:** `scripts/run_molecule_scenarios.sh` expands the names with molecule's own `Interpolator` before removing a scenario's containers. molecule's interpolator also handles the `$$` escapes in cloudflared's `molecule.yml`, which `os.path.expandvars` would not.
- **Cleanup only touches the run's own containers:** an `always()` step removes this run's labelled containers. The pre-run sweep removes only labelled containers older than 30 minutes, the job timeout; a script test holds the two values equal. Both steps tolerate a container another run's sweep already removed, and fail if one is still listed afterwards.
- **Concurrency:** pull requests keep their per-PR cancel groups. Scheduled and dispatched runs each get their own group (`github.run_id`), so no run cancels another. There is no shared group.
- **No Molecule, Lint or Build on push to `main`:** Build keeps its `v*` tag trigger and `workflow_dispatch`, and the Lint and Build concurrency groups are now `<wf>-${{ github.ref }}`. Nightly and manual dispatch still run every scenario.
- **Docs:** the selector docstring (both "push run after the merge" sentences), the workflow comments and `.gitea/workflows/AGENTS.md` are corrected.
- **Test fix:** the test helper `alive()` now also treats a process that exits between open and read (`ProcessLookupError`) as gone. That race failed about 1 run in 15.
No changelog fragment: CI only, nothing consumer-visible.
## Verified
- `python3 -m unittest discover -s tests/scripts`: 235 tests OK. The 6 that need molecule are skipped under system python.
- The same `test_run_molecule_scenarios.py` in a venv with `molecule==26.11.0`: all 15 tests ran, and 15 looped runs passed.
- `pre-commit run --all-files`: all hooks pass. `ansible-test sanity` passed in the pre-push hook.
- The new tests (per-run name expansion, the label filters in the sweep and cleanup steps, the sweep bound equal to `timeout-minutes`) were seen failing before the change.
- The sweep and cleanup shell was run under `bash -e` against a stub `docker`: old container removed, young one kept; a removal racing another sweep passes; a container still listed or a failing `docker ps` fails the step.
- From the pinned molecule-plugins 26.11.0 source: the docker driver merges per-platform `labels:` into the container labels.
## Not verified
- No real Molecule run with the new names. That happens in this PR's CI.
- The sweep's `date -d` on the runner's real `docker inspect` output, and the 30-minute bound in practice.
- Acceptance, to be checked after merge:
- two Molecule dispatches started together both finish green;
- a cancelled run leaves no container after its cleanup step (including whether act_runner runs the `always()` step on cancel);
- a push to `main` starts no Molecule, Lint or Build run.
- Containers left by runs from before this change carry no label, so the sweep never removes them. Any still on the runner have to be removed by hand once.
- Concurrency behaviour (queue versus replace a waiting run) was read from Gitea and GitHub documentation, not tested.
---
- [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-24 10:01:41 +00:00
Two Molecule runs could not overlap on one Docker daemon because every
scenario's container name was fixed; only the runner's single slot kept
them apart. Each platform is now named and labelled by KAMINO_RUN_ID
(run id and attempt, "local" outside CI), the run script expands those
names with molecule's own interpolator before removing them, and the
workflow removes its own containers by label and only sweeps labelled
leftovers older than the job timeout, so a run still going is never hit.
Non-pull-request runs get a concurrency group of their own.
Push to main no longer triggers Molecule, Lint or Build: a merged pull
request was already tested, and the nightly and manual Molecule runs
cover every scenario. Build keeps its v* tag trigger.
Assisted-by: Claude Code:claude-opus-5-5
The sweep now fails the step when a timestamp cannot be parsed or a
container it removes is still there, while tolerating one another run's
sweep removed first. Its 30-minute bound and the job's timeout point at
each other, since a shorter bound would remove a live run's containers.
The concurrency comments of Lint and Build now say that runs on one ref
queue rather than cancel, and the scenarios' comment names the run
script as what removes their containers. The workflow test checks the
label filters of the sweep and cleanup steps by name.
Assisted-by: Claude Code:claude-opus-5-5
A script test now fails when the sweep step's age bound differs from the
job's timeout-minutes, since a shorter bound would remove a live run's
containers. The final cleanup removes this run's containers one by one
and fails only when one is still there, as another run's sweep may have
removed it first once this run passed its timeout.
Assisted-by: Claude Code:claude-opus-5-5
Reading /proc/<pid>/stat raises ProcessLookupError when the process
exits between the open and the read, which made the lane-kill tests
fail now and then.
Assisted-by: Claude Code:claude-opus-5-5
A removal that fails because another run's sweep was first is harmless,
but checking that with `docker container inspect` also passed when the
daemon could not be reached. Both removal steps now remove what they
can and then list the containers they meant to remove; a failing list
or a container still listed fails the step.
The workflow rules name the test that holds the sweep's age bound to
the job timeout.
Assisted-by: Claude Code:claude-opus-5-5
CODEOWNERS rules
requested review from Defame1297 2026-11-24 10:01:41 +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
Closes #166
Two Molecule runs could not overlap on the runner's Docker daemon, because every scenario's container name was fixed; only the single runner slot kept them apart. Spec: #212 items 1, 3, 6 and 7, with #256 item 4 for Lint and Build.
${KAMINO_RUN_ID:-local}-<name>and labellednet.rkdr.mortis.molecule-run: "${KAMINO_RUN_ID:-local}". The workflow setsKAMINO_RUN_ID(run id and attempt) and passes it into thedocker runcontainer, which carries the same label.scripts/run_molecule_scenarios.shexpands the names with molecule's ownInterpolatorbefore removing a scenario's containers. molecule's interpolator also handles the$$escapes in cloudflared'smolecule.yml, whichos.path.expandvarswould not.always()step removes this run's labelled containers. The pre-run sweep removes only labelled containers older than 30 minutes, the job timeout; a script test holds the two values equal. Both steps tolerate a container another run's sweep already removed, and fail if one is still listed afterwards.github.run_id), so no run cancels another. There is no shared group.main: Build keeps itsv*tag trigger andworkflow_dispatch, and the Lint and Build concurrency groups are now<wf>-${{ github.ref }}. Nightly and manual dispatch still run every scenario..gitea/workflows/AGENTS.mdare corrected.alive()now also treats a process that exits between open and read (ProcessLookupError) as gone. That race failed about 1 run in 15.No changelog fragment: CI only, nothing consumer-visible.
Verified
python3 -m unittest discover -s tests/scripts: 235 tests OK. The 6 that need molecule are skipped under system python.test_run_molecule_scenarios.pyin a venv withmolecule==26.11.0: all 15 tests ran, and 15 looped runs passed.pre-commit run --all-files: all hooks pass.ansible-test sanitypassed in the pre-push hook.timeout-minutes) were seen failing before the change.bash -eagainst a stubdocker: old container removed, young one kept; a removal racing another sweep passes; a container still listed or a failingdocker psfails the step.labels:into the container labels.Not verified
date -don the runner's realdocker inspectoutput, and the 30-minute bound in practice.always()step on cancel);mainstarts no Molecule, Lint or Build run.NOTICEandREUSE.toml, or there is none.Assisted-by: Claude Code