ci(molecule): isolate Molecule runs per run and stop running Molecule on push to main #166
Notifications
Due Date
No due date set.
Blocks
Depends on
Reference: Mortis/Kamino#166
Reference in new issue
Block a user
Spec: Molecule and Renovate on the shared runner: isolation, capacity and cost, resolution items 1, 3, 6 and 7. This replaces the earlier spec from CI image pipeline section 7. A shared concurrency group cancels a waiting run and stalls its pull request's required check, so it is not used. Scope was added from What Molecule proves before a merge, and who acts on the nightly run. This issue is blocked by ci(molecule): run Molecule with the toolchain baked into the ci image instead of the runner's venv, which changes the job's shape first, and it waits on the contributor-doc split (#189) and on docs(agents): replace CLAUDE.md with a root AGENTS.md: put the text edits below in the root or nested
AGENTS.md, not inCLAUDE.mdorCONTRIBUTING.mdwhere those are replaced.What
${KAMINO_RUN_ID:-local}-ufw-instance), the second and third platforms included (those that the platforms issue and the Debian 13 molecule image issue add, if they landed first), and a label carrying the run id. The workflow setsKAMINO_RUN_ID(for example fromgithub.run_idand the attempt, passed throughenv:) and passes it into thedocker runcontainer that holds Molecule. A local run without it gets thelocal-prefix. Thedocker runcontainer gets the per-run name and label too.always()step removes this run's labelled containers, thedocker runcontainer included. The pre-run sweep removes only labelled containers older than the job timeout (30 min), never the containers of a run beside it, and never anything unlabelled.concurrency:comment inmolecule.yml: two runs can now overlap safely.push:trigger onmainfrommolecule.yml,paths:filter included. Nightly andworkflow_dispatchkeep running every scenario. Update the agent-instructions text that says every push tomainruns every scenario.scripts/select_molecule_scenarios.py:32-33("The scenarios the selection skips are not skipped onmain: the push run after the merge runs them all"). The skipped scenarios now run in the nightly and in manual dispatch.main. Removepush: branches: [main]from.gitea/workflows/lint.ymland.gitea/workflows/build.yml. Build keepspush: tags: ['v*']andworkflow_dispatch; Lint keepsworkflow_dispatch.release.yml.mainonly ever receives a tree its pull request already tested.concurrency.groupexpressions to match.Then (maintainer)
The runner capacity is raised in a separate issue, outside this repository: chore: raise the CI runner's capacity to 2 and record the memory headroom. The memory headroom is measured by the maintainer on the host; the job log does not print host sizing.
Acceptance
always()step.docker psshows no container of that run after the cleanup step (not tested yet: whether a cancelled step leaves thedocker runcontainer running).mainstarts no Molecule, Lint or Build run; nightly and dispatch run every scenario.Notes
ci(molecule): open an issue when the nightly full run fails and close it on the next green one is blocked by this issue, because both edit
molecule.yml.Order: this now waits on the contributor-doc split (#189) where it edits
CONTRIBUTING.md, and on docs(agents): replace CLAUDE.md with a root AGENTS.md (#185): put theCLAUDE.mdedits in the root or nestedAGENTS.mdinstead. (From Order of the implementation backlog, #198.)ci(molecule): run Molecule two-wide safely and select scenarios on push to mainto ci(molecule): isolate Molecule runs per run and stop running Molecule on push to mainRewritten from Molecule and Renovate on the shared runner: isolation, capacity and cost: isolation per run instead of one shared group, and no Molecule on push to
main(so no diff selection onmain). Blocked by ci(molecule): run Molecule with the toolchain baked into the ci image instead of the runner's venv, which changes the job's shape first: passKAMINO_RUN_IDinto thedocker runcontainer. The maintainer's capacity raise is chore: raise the CI runner's capacity to 2 and record the memory headroom.Review of the map (2026-11-17).
scripts/select_molecule_scenarios.py:26-27, which says "the push run after the merge runs them all". After this issue the nightly and a manual dispatch are the only runs of the scenarios a pull request did not select.docker runcontainer that holds Molecule gets the per-run name and label too, and thealways()step and the sweep remove it. Not tested: whether a cancelled step leaves that container running. Acceptance addition: cancel a run mid-scenario and check thatdocker psshows no container of that run after the cleanup step.free -mandnprocputs host sizing into a job log. Whether that is wanted is open in Does the stand-alone rule cover issue text and job logs.Correction from Does the stand-alone rule cover issue text and job logs (2026-11-20): drop the step that prints
free -mandnproc. Job output is public, and host sizing stays out of it. The memory headroom is measured by the maintainer on the host (#243).Scope added from What Molecule proves before a merge, and who acts on the nightly run (2026-11-20)
main. Removepush: branches: [main]from.gitea/workflows/lint.ymland.gitea/workflows/build.yml. Build keepspush: tags: ['v*']andworkflow_dispatch; Lint keepsworkflow_dispatch.release.yml.mainonly ever receives a tree its pull request already tested.concurrency.groupexpressions to match.scripts/select_molecule_scenarios.py:32-33("The scenarios the selection skips are not skipped onmain: the push run after the merge runs them all"). The skipped scenarios now run in the nightly and in manual dispatch.molecule.yml.Body rewritten on 2026-11-20 to the final state of the comments above (final validation round of the map, #87 (comment)). The body is the spec; the earlier comments are history.
free -m,nproc) and its acceptance line (the comment from #253), moves theCLAUDE.mdedits toAGENTS.md, and folds in thedocker runcontainer naming, the cancelled-run acceptance, the selector docstring fix and the Lint/Build push-trigger removal.Final validation round, second pass (2026-11-20): body edited.
scripts/select_molecule_scenarios.py(verified by grep).Unblocked: #225 is merged (#345, #348). The Molecule job now has this shape; build on it.
docker run --rm -i --initon the pinnedciimage. Inside,scripts/run_molecule_in_ci_image.shruns the pin check, the slow path when pins differ, and thenscripts/run_molecule_scenarios.sh. The selector and the stale sweep stay on the host.$RUN_CONTAINER(kamino-molecule-${{ github.run_id }}-${{ github.run_attempt }}, set throughenv:) and labellednet.rkdr.mortis.molecule-run=$RUN_CONTAINER. Anif: always()step runsdocker rm -fon it.*-instanceandimage-smoke*, so a leakedkamino-molecule-*container survives into the next run. Extend the sweep to the label, with the 30-minute age bound from #212 item 1.always()step on a cancelled job has not been checked. The acceptance line "cancel a run mid-scenario and checkdocker ps" covers it.dockerCLI read-only at/usr/local/bin/docker, because the driver's connection plugin runs the CLI;$ac_root/passwdover/etc/passwd, so the runner uid has an entry and a home;HOME, the slow-path pins andmolecule-runs/all live in the job tree, underac/.run_molecule_scenarios.shnow uses the Python Docker SDK. The per-run prefix of platform names has to reach that script's exact-name match too.-e NAME, never by${{ }}inrun:. A new value such asKAMINO_RUN_IDneeds its own-e.Assisted-by: Claude Code
Acceptance after the merge of #350 (2026-11-24).
mainstarts no Molecule, Lint or Build run: passed. The merge commit1b6a4e8started no run.mainwere queued at the same moment. 5341 and 5342 each ran every scenario and succeeded in turn. Neither cancelled the other.always()step "Remove this run's containers", which succeeded. That step fails while any container labelled with the run's id is still listed.docker ps -aon the Molecule runner listed no container, so none needed removing by hand.Assisted-by: Claude Code