Repository navigation
fix: remove stale volumes from existing runners - #64
Conversation
The docker module ignores removed volumes by default, so setting github_runner_mount_docker_socket: false left the socket on any runner that already had it. Compare volumes strictly, and test removing it from a running runner. The new scenario only covered a fresh install, which is why this slipped through. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Note
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
🟢 Approval recommended
The core drift/idempotence fix (strict volume comparisons in plan and deploy) is implemented and accompanied by an expanded Molecule scenario, while the remaining review feedback is limited to non-blocking verification and documentation/comment nits.
No open issues 🎉
What changed in this PR
This pull request fixes an idempotence/drift gap in the github_runner role where removing volume mounts (notably /var/run/docker.sock) from configuration did not reliably trigger container replacement for already-deployed runners, leaving stale mounts in place.
Changes:
- Enforce strict volume comparison (
comparisons: { volumes: strict }) in both the check-mode “plan” task and the deploy task so removed mounts trigger replacement (behind the drain gate). - Extend the
no-docker-socketMolecule scenario to cover “socket present → redeploy without socket → socket removed”. - Bump the collection version to
0.1.9and document the behavior in the changelog.
Key review notes (from final comments):
molecule/no-docker-socket/verify.yml: current assertions rely onHostConfig.Bindsand may miss mounts represented undercontainer.Mounts(moderate).molecule/no-docker-socket/verify.yml: disable unused fact gathering to reduce runtime/flakiness (nit).roles/github_runner/tasks/main.yml: clarify comments so they accurately describe whystrictis needed for mount removals (nits).CHANGELOG.md: prefer the precise module namecommunity.docker.docker_containerfor clarity (nit).
| File | Summary |
|---|---|
roles/github_runner/tasks/main.yml |
Tightens drift detection by making volume comparisons strict in both plan (check mode) and deploy tasks; minor comment clarity nits noted. |
molecule/no-docker-socket/verify.yml |
Adds coverage for removing the docker socket on an existing runner; moderate issues noted where checks may miss mounts reported via container.Mounts and an unused gather_facts: true. |
galaxy.yml |
Bumps collection version to 0.1.9. |
CHANGELOG.md |
Documents the 0.1.9 fix and expected one-time replacement impact; nit about naming the specific module. |
This pull request requires changes.
Review effort: Balanced
Why
github_runner_mount_docker_socket: falsehas no effect on a runner that already has the socket.community.dockerignores removed volumes by default, so the container isn't replaced and the mount stays until something else forces a replace.This showed up in
BumpApp/bump#6711: it set the option on all android runners, and the deploy succeeded without replacing any of them or removing the socket. Theno-docker-socketscenario only covered a fresh install, so it couldn't catch this.Change
volumes: strictto the comparisons on both the deploy task and the check-mode task behind the drain gateno-docker-socketto deploy with the socket, redeploy without it, and check it's goneUpgrade impact
Any existing runner whose mounts differ from the role's computed list is replaced on its next deploy, after draining. That's the intended fix, but it's a one-time replace. On the
BumpApp/bumprunners I could reach (nas.local,ubuntu-beast,ubuntu-cube,ubuntu-silverstone), only the android runners differ.jason-nucandubuntu-work-laptopweren't compared.Testing
Against
community.docker5.4.0 with the real runner image:strict, check modestrictansible-lintandmolecule test --scenario-name no-docker-socketpass locally.android-runnerfailed locally because it couldn't bind its adb ports: my workstation runs a real android runner and adb stack. It passed in CI on the merge of #63, so this PR's CI run is the check for it.🤖 Generated with Claude Code