fix: bound container stop and raise Docker API timeout on deploy - #53
Merged
Conversation
Replacing an existing runner container (image bump) stops and removes it first. A crash-looping or wedged runner can take longer than the Docker SDK's 60s default read timeout to stop+remove, failing the first playbook run with 'UnixHTTPConnectionPool ... Read timed out (read timeout=60)' — the daemon finishes the removal in the background, which is why an immediate rerun succeeds. Add github_runner_stop_timeout (default 10) to bound the graceful stop and github_runner_docker_timeout (default 180) to give the API client room to wait out a slow removal. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR aims to make runner container replacement more reliable on hosts where an existing runner container is crash-looping or otherwise slow to stop/remove, by bounding container stop time and increasing the Docker client/API timeout during deployment.
Changes:
- Add two new role defaults:
github_runner_stop_timeoutandgithub_runner_docker_timeout. - Apply the new stop/API timeout settings to the runner container deploy task.
- Bump collection version to
0.1.4and document the change inCHANGELOG.mdandREADME.md.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| roles/github_runner/tasks/main.yml | Adds stop/removal timing controls to the runner container deploy task. |
| roles/github_runner/defaults/main.yml | Introduces defaults for stop timeout and Docker API/client timeout. |
| README.md | Documents the two new role variables in the variable table. |
| galaxy.yml | Bumps collection version to 0.1.4. |
| CHANGELOG.md | Adds a 0.1.4 entry describing the fix and new variables. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Problem
First playbook run against a host with an existing (especially crash-looping) runner container fails:
…and the immediate rerun succeeds. Replacing the container stops+removes the old one first; a crash-looping or wedged runner can take longer than the Docker SDK's 60s default client timeout to stop and remove. The timeout only kills the client's wait — the daemon finishes the removal in the background, which is why the second pass works.
Fix
Two new role vars, applied to the
docker_containerdeploy task:github_runner_docker_timeout(default 180) → moduletimeout: gives the API client room to wait out a slow stop+remove.github_runner_stop_timeout(default 10) → containerstop_timeout: bounds the graceful SIGTERM window before SIGKILL, so replacement stays fast even when the runner process is wedged. Deliberately notforce_kill— a deploy racing a running CI job still gets a few seconds of cleanup.Also bumps the collection to 0.1.4 with CHANGELOG and README variable-table entries, per repo convention.
Testing
ansible-lintclean (production profile, 33 files).🤖 Generated with Claude Code