Skip to content

Add github_runner_network_mode knob (host networking for host-side adb)#48

Merged
compscidr merged 2 commits into
mainfrom
feat/network-mode-knob
May 27, 2026
Merged

Add github_runner_network_mode knob (host networking for host-side adb)#48
compscidr merged 2 commits into
mainfrom
feat/network-mode-knob

Conversation

@compscidr
Copy link
Copy Markdown
Owner

What

Adds a github_runner_network_mode variable wired into the community.docker.docker_container task in roles/github_runner/tasks/main.yml, defaulting to default (no behavior change).

Why

For an Android runner we want the adb server to run on the host (the host owns the USB phones) and have the in-container adb client reach it. Running the runner container with network_mode: host shares the host's net namespace so adb talks to the host server at 127.0.0.1:5037. This lets a CI job reboot its phones without the container losing them on USB re-enumeration.

Changes

  • roles/github_runner/defaults/main.yml — add github_runner_network_mode: default.
  • roles/github_runner/tasks/main.yml — add network_mode: "{{ github_runner_network_mode }}" and move the ports: expression into a runner_ports var that omits the mapping when network_mode == 'host' (since ports: is invalid with network_mode: host).
  • molecule/android-runner-host/ — new scenario asserting host networking converges, is idempotent, uses NetworkMode: host, and publishes no ports. Added to the CI matrix.
  • README.md — document the new variable and usage pattern.
  • galaxy.yml — bump to 0.1.3 (BumpApp/bump#4602 pins to it).

Testing

Ran locally with molecule (docker driver):

  • android-runner-host — converge + idempotence + verify all pass (NetworkMode: host, PortBindings: {}).
  • android-runner (regression after the ports: refactor) — full run exits 0, ADB port still mapped correctly.
  • ansible-lint passes on the production profile.

Notes

  • Default (default) keeps current behavior; existing molecule scenarios pass unchanged.
  • Release as 0.1.3 and publish to Galaxy.

Closes #47

🤖 Generated with Claude Code

Adds a github_runner_network_mode variable wired into the
community.docker.docker_container task, defaulting to "default" (no
behavior change). Setting it to "host" shares the host's network
namespace so the in-container adb client can reach an adb server running
on the host at 127.0.0.1:5037.

Since ports: is invalid together with network_mode: host, the port
mapping is now built via a runner_ports var that omits the mapping when
network_mode is "host".

Adds an android-runner-host molecule scenario (and CI matrix entry)
asserting host networking converges, is idempotent, and publishes no
ports. Bumps the collection to 0.1.3.

Closes #47

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 27, 2026 22:54
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a configurable Docker network mode for the GitHub runner container, enabling Android runners to use host networking so in-container ADB clients can reach a host-side ADB server.

Changes:

  • Introduces github_runner_network_mode defaulting to default.
  • Wires network_mode into the Docker container task and omits ADB port publishing when using host.
  • Adds documentation, CI coverage, and a Molecule scenario for host-networked Android runners.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
roles/github_runner/tasks/main.yml Applies the configured Docker network mode and conditionally omits port mappings for host networking.
roles/github_runner/defaults/main.yml Adds the new default role variable.
README.md Documents the new option and host-side ADB usage pattern.
molecule/android-runner-host/converge.yml Adds convergence playbook for the new Molecule scenario.
molecule/android-runner-host/molecule.yml Defines the host-network Android runner scenario.
molecule/android-runner-host/verify.yml Verifies host networking and absence of published ports.
galaxy.yml Bumps the collection version to 0.1.3.
.github/workflows/lint-and-test.yml Adds the new Molecule scenario to CI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@compscidr compscidr merged commit 0180032 into main May 27, 2026
6 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.

Add github_runner_network_mode knob (host networking for host-side adb)

2 participants