scripting-adb-for-ci
Installation
SKILL.md
Scripting adb For CI — Bash Idioms, Exit Codes, Fan-out
This skill is the connective tissue that turns the other ADB skills into a CI pipeline: exit-code propagation, retries, timeouts, parallel device fan-out, port forwarding, idempotent setup, capture-on-failure, and Test Orchestrator wiring. Each section cross-links to the skill that owns the underlying primitive.
When to use this skill
- A CI job invokes
adb shell am instrumentand "passes" even when tests fail — it gates on$?, butam instrumentalways exits0; the real status lives inINSTRUMENTATION_STATUS_CODElines on stdout (and-wis needed just to get that stdout at all). - The team has multiple physical devices on a single agent and wants to run sharded tests in parallel.
adb forwardandadb reverseare confused — most teams have at least one bug from the opposite argument order.- Transient
error: device not found/error: closedfailures are not retried; the job fails on the first hiccup. - A script lacks cleanup so leaked port forwards or modified
settings put global ...survive into the next run. - The team wires Test Orchestrator with
androidTestImplementation— the build silently fails to install the orchestrator APK.
When NOT to use this skill
- The single primitive (logcat, screencap, pull, push, settings, input, am instrument) is not yet understood. Read the relevant sibling skill first.
- The CI itself (Gradle plugin, Firebase Test Lab cloud config). Use FTL's own docs for that layer.
- Compose / instrumentation test mechanics. Use
../../../compose/synchronization/synchronizing-with-idle/SKILL.mdand friends.