refactor(ci): merge KVM molecule runner into a driver input#32
Conversation
ci-ansible-molecule.yml and ci-ansible-molecule-kvm.yml were ~85% identical — same scenario-discovery job, checkout, python setup, dependency install, and summary. Only the QEMU/KVM apt setup and the `sg kvm` wrapper differed. Add a `driver` input (`docker` default, `qemu`) to ci-ansible-molecule.yml: the QEMU/KVM setup step is gated on `driver == 'qemu'` and the run step wraps molecule in `sg kvm` only in that case. A validation step rejects any other value. Remove ci-ansible-molecule-kvm.yml. Net -226/+72; the discovery job no longer has to be kept in sync across two files. Callers of the -kvm reusable switch to ci-ansible-molecule.yml with `driver: qemu` (only open chore branches reference it, no main caller yet). Signed-off-by: Simon Bärlocher <s.baerlocher@sbaerlocher.ch>
d9aabdc to
cf3fcca
Compare
There was a problem hiding this comment.
Solid refactor — collapsing the ~85% duplication into a single driver input is the right call, the validation fails fast in the discover job, and the qemu setup/sg kvm wrapper are correctly gated. Two minor points to address:
- CHANGELOG: the
## 2026-06-17section both adds and removesci-ansible-molecule-kvm.ymlin the same deployed-to-mainwindow. Since it never effectively shipped, fold this into theChanged: ci-ansible-molecule.ymlentry rather than leaving a self-contradicting Added/Removed pair. - /dev/kvm probe (carried over from the deleted file): under
set -ethetest -e /dev/kvm && ls -lline hard-fails the step if KVM is absent, contradicting the comment's "falls back to TCG otherwise." Align the code with the intended behavior.
Neither is a functional blocker on GitHub-hosted runners; happy to approve once the CHANGELOG is tidied.
There was a problem hiding this comment.
No changes have been pushed since the last review — both issues remain open:
- CHANGELOG.md — same-day add-and-remove of
ci-ansible-molecule-kvm.ymlcreates a self-contradicting audit trail. Collapse theAdded/Removedentries and fold the QEMU rationale into the existingChanged: ci-ansible-molecule.ymlentry. - ci-ansible-molecule.yml line 199 —
test -e /dev/kvm && ls -l /dev/kvmhard-fails underset -euo pipefailwhen/dev/kvmis absent, contradicting the comment that describes a TCG fallback. Either make the probe non-fatal or update the comment to state that a missing KVM device is an intentional failure.
Under set -euo pipefail, `test -e /dev/kvm && ls -l /dev/kvm` aborted the setup step when /dev/kvm was absent, so the job never reached the TCG fallback the comment described. Log a warning instead and let molecule-qemu fall back to TCG. (Carried over from the deleted -kvm workflow.) Signed-off-by: Simon Bärlocher <s.baerlocher@sbaerlocher.ch>
There was a problem hiding this comment.
The /dev/kvm probe fix in ci-ansible-molecule.yml looks correct — thank you. One issue remains: CHANGELOG.md still has a same-day ### Added entry for ci-ansible-molecule-kvm.yml followed by a ### Removed entry for the same file under the same ## 2026-06-17 heading. Please collapse both into a single ### Changed note (or remove the transient ### Added entry) before merging.
Signed-off-by: Simon Bärlocher <s.baerlocher@sbaerlocher.ch>
There was a problem hiding this comment.
The CHANGELOG.md issue remains unresolved: the ## 2026-06-17 section still both adds and removes ci-ansible-molecule-kvm.yml in the same day, creating a self-contradicting audit trail. The workflow KVM probe fix was confirmed resolved in the previous round. Please collapse the transient ### Added/### Removed entries for ci-ansible-molecule-kvm.yml before merging.
There was a problem hiding this comment.
The workflow file issue (KVM probe hard-fail) was resolved in a previous round. One issue remains: CHANGELOG.md still contains a self-contradicting same-day add-and-remove of ci-ansible-molecule-kvm.yml under the single ## 2026-06-17 heading — please collapse or remove the transient entries before merging.
Summary
ci-ansible-molecule.ymlandci-ansible-molecule-kvm.ymlwere ~85% identical(same discovery job, checkout, python setup, dependency install, summary). Only
the QEMU/KVM apt setup and the
sg kvmwrapper differed.driverinput toci-ansible-molecule.yml:docker(default) orqemu.driver == 'qemu'; run step wraps molecule insg kvmonly then. A validation step rejects any other value.ci-ansible-molecule-kvm.yml.Migration
Callers of the
-kvmreusable switch toci-ansible-molecule.ymlwithdriver: qemu. Only open chore branches reference it today — nomaincaller.Test plan
driver: dockerpath unchanged from before