Add github_runner_network_mode knob (host networking for host-side adb)#48
Merged
Conversation
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>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
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_modedefaulting todefault. - Wires
network_modeinto the Docker container task and omits ADB port publishing when usinghost. - 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
github_runner_network_modevariable wired into thecommunity.docker.docker_containertask inroles/github_runner/tasks/main.yml, defaulting todefault(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
adbclient reach it. Running the runner container withnetwork_mode: hostshares the host's net namespace soadbtalks to the host server at127.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— addgithub_runner_network_mode: default.roles/github_runner/tasks/main.yml— addnetwork_mode: "{{ github_runner_network_mode }}"and move theports:expression into arunner_portsvar that omits the mapping whennetwork_mode == 'host'(sinceports:is invalid withnetwork_mode: host).molecule/android-runner-host/— new scenario asserting host networking converges, is idempotent, usesNetworkMode: host, and publishes no ports. Added to the CI matrix.README.md— document the new variable and usage pattern.galaxy.yml— bump to0.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 theports:refactor) — full run exits 0, ADB port still mapped correctly.ansible-lintpasses on the production profile.Notes
default) keeps current behavior; existing molecule scenarios pass unchanged.0.1.3and publish to Galaxy.Closes #47
🤖 Generated with Claude Code