ci(molecule): cancel superseded runs, trim the test sequence, run nightly #117

Merged
Defame1297 merged 8 commits from ci/molecule-cancel-and-trim into main 2026-11-14 11:56:00 +00:00
Owner

Stacked on #116: merge that first. Until then this pull request also shows its commit (4d330d4); the three commits below are this one's own.

What

  1. ci(molecule): cancel superseded pull request runs: a new commit on a pull request cancels its running Molecule run, like Lint and Build (group per ref for pull requests, per SHA otherwise, so a run on main is never cancelled). The old single molecule group existed so two runs never shared the runner's Docker daemon, whose container names are fixed. That is now the runner's single slot (gitea_runner_capacity: 1 in the maintainer's environment repository), stated in the workflow comment and CLAUDE.md: raising that capacity needs a lock or a shared group again. A cancelled run is killed before molecule can destroy its container, so the run step first removes the containers of every scenario by their exact platform names, whether or not this run selects it.
  2. ci(molecule): drop the leading destroy from every scenario's test sequence: about 6 s per scenario, 42 s per full run. The first destroy runs against a container that is not there and only waits out the Docker driver's fixed 5 s poll. Safe because the run step clears stale containers first, and molecule's state file lives under the job's own ANSIBLE_HOME (Runtime(isolated=False) in molecule 26.11), which is deleted with the checkout, so a cancelled run cannot make the next one skip create or prepare. The rest of the sequence is molecule's default.
  3. ci(molecule): run every scenario nightly: 04:43 UTC, after Renovate's 03:17 run (single slot). Pull requests now run fewer scenarios, so drift in the others (a package mirror, the runner's molecule venv) would otherwise wait for the next push to main.

Verified

  • Script tests, actionlint, yamllint, REUSE and the pre-commit hooks pass.
  • The explicit test_sequence equals molecule 26.11's default minus the first destroy; its step names are valid for the version the runner pins (read from the source, not run).
  • The container-name filters match all seven platform names (<role>-instance, image-smoke, image-smoke-2604) and Docker's leading /.
  • The schedule path (if: guard, checkout SHA/REF, selector falling back to all, concurrency group) was read through for event_name == 'schedule'.
  • Independent review of the diffs, whose findings are folded in (an earlier flock was removed as redundant on a single-slot runner).

Not verified

  • Nothing has run in CI. The cancellation itself, on the runner's host executor, is the main unknown: push twice quickly to a pull request and check that the first run is cancelled and the second passes. A cancelled run's orphaned processes may live briefly; the cleanup bounds the damage to one failed run.
  • The cleanup removes any container on that daemon named *-instance or image-smoke*; the daemon is the runner's own, dedicated to this.
  • The nightly run's first execution will show the schedule path end to end.

🤖 Generated with Claude Code

**Stacked on #116: merge that first.** Until then this pull request also shows its commit (`4d330d4`); the three commits below are this one's own. ## What 1. `ci(molecule): cancel superseded pull request runs`: a new commit on a pull request cancels its running Molecule run, like Lint and Build (group per ref for pull requests, per SHA otherwise, so a run on `main` is never cancelled). The old single `molecule` group existed so two runs never shared the runner's Docker daemon, whose container names are fixed. That is now the runner's single slot (`gitea_runner_capacity: 1` in the maintainer's environment repository), stated in the workflow comment and CLAUDE.md: raising that capacity needs a lock or a shared group again. A cancelled run is killed before molecule can destroy its container, so the run step first removes the containers of every scenario by their exact platform names, whether or not this run selects it. 2. `ci(molecule): drop the leading destroy from every scenario's test sequence`: about 6 s per scenario, 42 s per full run. The first `destroy` runs against a container that is not there and only waits out the Docker driver's fixed 5 s poll. Safe because the run step clears stale containers first, and molecule's state file lives under the job's own `ANSIBLE_HOME` (`Runtime(isolated=False)` in molecule 26.11), which is deleted with the checkout, so a cancelled run cannot make the next one skip `create` or `prepare`. The rest of the sequence is molecule's default. 3. `ci(molecule): run every scenario nightly`: 04:43 UTC, after Renovate's 03:17 run (single slot). Pull requests now run fewer scenarios, so drift in the others (a package mirror, the runner's molecule venv) would otherwise wait for the next push to `main`. ## Verified - Script tests, `actionlint`, `yamllint`, REUSE and the pre-commit hooks pass. - The explicit `test_sequence` equals molecule 26.11's default minus the first `destroy`; its step names are valid for the version the runner pins (read from the source, not run). - The container-name filters match all seven platform names (`<role>-instance`, `image-smoke`, `image-smoke-2604`) and Docker's leading `/`. - The schedule path (`if:` guard, checkout SHA/REF, selector falling back to all, concurrency group) was read through for `event_name == 'schedule'`. - Independent review of the diffs, whose findings are folded in (an earlier `flock` was removed as redundant on a single-slot runner). ## Not verified - Nothing has run in CI. The cancellation itself, on the runner's host executor, is the main unknown: push twice quickly to a pull request and check that the first run is cancelled and the second passes. A cancelled run's orphaned processes may live briefly; the cleanup bounds the damage to one failed run. - The cleanup removes any container on that daemon named `*-instance` or `image-smoke*`; the daemon is the runner's own, dedicated to this. - The nightly run's first execution will show the `schedule` path end to end. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Claude added 4 commits 2026-11-14 11:22:35 +00:00
ci(molecule): run only the scenarios of the roles a pull request changes
Build / build (pull_request) Failing after 12s
Lint / lint (pull_request) Successful in 21s
Molecule / molecule (pull_request) Successful in 6m53s
4d330d41c7
A pull request now runs the scenarios of the roles it touches, none when it
touches only paths no scenario reads, and everything for any other file, for
every push to main and for manual dispatch. The job stays unconditional so
Molecule can remain a required check.

scripts/select_molecule_scenarios.py makes the choice and is run from the base
branch's copy, so a pull request cannot edit its own rules. A changed role
that exists but has no scenario fails instead of passing with nothing tested.

The scenario loop no longer gives molecule the list as stdin, which a child
could have drained, and fails when it ran fewer scenarios than were selected.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNmHMc85bomfevwUDG
A new commit on a pull request now cancels its running Molecule run, as for
Lint and Build; a run on main is never cancelled (its group is the commit SHA).

The old global concurrency group kept two runs off the runner's shared Docker
daemon, whose container names are fixed. That is now the runner's single slot
(gitea_runner_capacity: 1), as the workflow comment and CLAUDE.md say. A
cancelled run is killed before molecule can destroy its container, so the run
step first removes the containers of every scenario by their exact platform
names, whether or not this run selects that scenario.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNmHMc85bomfevwUDG
The first destroy runs against a container that is not there and only waits out
the Docker driver's fixed 5 s poll, about 6 s per scenario and 42 s per full
run. The run step already removes what a killed run left, and molecule's state
file lives under the job's own ANSIBLE_HOME (Runtime(isolated=False)), which is
deleted with the checkout, so a cancelled run cannot make the next one skip
create or prepare. The rest of the sequence is molecule's default.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNmHMc85bomfevwUDG
ci(molecule): run every scenario nightly
Build / build (pull_request) Canceled after 0s
Lint / lint (pull_request) Canceled after 0s
Molecule / molecule (pull_request) Canceled after 0s
25bca2ebff
A pull request runs only the scenarios of the roles it changes, so drift in the
others (a package mirror, the runner's molecule venv) would wait for the next
push to main. A nightly run of everything bounds that. It is scheduled after
Renovate's run, since the runner has a single slot.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNmHMc85bomfevwUDG
Defame1297 added 1 commit 2026-11-14 11:23:53 +00:00
Merge branch 'main' into ci/molecule-cancel-and-trim
Build / build (pull_request) Failing after 11s
Lint / lint (pull_request) Successful in 20s
Molecule / molecule (pull_request) Canceled after 5m0s
37420825a1
Defame1297 added 3 commits 2026-11-14 11:35:51 +00:00
Merge branch 'main' into ci/molecule-changed-roles
Build / build (pull_request) Failing after 12s
Lint / lint (pull_request) Successful in 21s
Molecule / molecule (pull_request) Successful in 7m19s
fdab483109
fix(lint): satisfy ansible-test pylint in the molecule selector
Build / build (pull_request) Successful in 11s
Lint / lint (pull_request) Successful in 24s
Molecule / molecule (pull_request) Successful in 7m0s
a94bee8fd3
ansible-test sanity runs pylint over scripts/ and tests/scripts/ too and
rejects a mutable default argument (environ=os.environ) and `_` as a variable
name. main() now takes environ=None and reads os.environ itself, and the tests
name the values they ignore.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNmHMc85bomfevwUDG
Merge branch 'ci/molecule-changed-roles' into ci/molecule-cancel-and-trim
Build / build (pull_request) Successful in 11s
Lint / lint (pull_request) Successful in 24s
Molecule / molecule (pull_request) Successful in 6m50s
676c950c08
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNmHMc85bomfevwUDG
Defame1297 merged commit ceeca66209 into main 2026-11-14 11:56:00 +00:00
Defame1297 deleted branch ci/molecule-cancel-and-trim 2026-11-14 11:56:00 +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#117