Skip to content

fix: remove stale volumes from existing runners - #64

Merged
compscidr merged 1 commit into
mainfrom
fix/strict-volume-comparison
Nov 5, 2026
Merged

compscidr merged 1 commit into
mainfrom
fix/strict-volume-comparison

Conversation

@compscidr

Copy link
Copy Markdown
Owner

Why

github_runner_mount_docker_socket: false has no effect on a runner that already has the socket. community.docker ignores 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. The no-docker-socket scenario only covered a fresh install, so it couldn't catch this.

Change

  • Adds volumes: strict to the comparisons on both the deploy task and the check-mode task behind the drain gate
  • Bumps the collection to 0.1.9
  • Extends no-docker-socket to deploy with the socket, redeploy without it, and check it's gone

Upgrade 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/bump runners I could reach (nas.local, ubuntu-beast, ubuntu-cube, ubuntu-silverstone), only the android runners differ. jason-nuc and ubuntu-work-laptop weren't compared.

Testing

Against community.docker 5.4.0 with the real runner image:

Case Result
Socket removed, default comparison No change, socket stays
Socket removed, strict, check mode Reports a change, so the drain gate sees it
Socket removed, strict Replaced, socket gone
Same again No change, so it's idempotent

ansible-lint and molecule test --scenario-name no-docker-socket pass locally.

android-runner failed 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

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>
Copilot AI balanced review requested due to automatic review settings November 4, 2026 23:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-socket Molecule scenario to cover “socket present → redeploy without socket → socket removed”.
  • Bump the collection version to 0.1.9 and document the behavior in the changelog.

Key review notes (from final comments):

  • molecule/no-docker-socket/verify.yml: current assertions rely on HostConfig.Binds and may miss mounts represented under container.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 why strict is needed for mount removals (nits).
  • CHANGELOG.md: prefer the precise module name community.docker.docker_container for 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

@compscidr
compscidr merged commit 3bf20f5 into main Nov 5, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants