extension: ccache-remote: fix Docker host-gateway for hostnames resolving to loopback#9505
extension: ccache-remote: fix Docker host-gateway for hostnames resolving to loopback#9505
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe shell script now detects when a Docker host resolution yields a loopback address (127.* or ::1) and adds the host using Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@extensions/ccache-remote/ccache-remote.sh`:
- Around line 400-402: The current block appends
"--add-host=${_host}:host-gateway" to DOCKER_EXTRA_ARGS when _resolved_ip is
loopback, which will break on Docker <20.10.0; add a Docker-version gate before
modifying DOCKER_EXTRA_ARGS (use the same logic in both places where
DOCKER_EXTRA_ARGS is appended around _host/_resolved_ip), e.g., detect Docker
Engine version via `docker version --format '{{.Server.Version}}'` and only use
"host-gateway" when the semantic version is >=20.10.0; if the version is older,
either skip adding the host-gateway entry or fall back to resolving and
injecting the actual host IP, and call display_alert with an appropriate message
mentioning _host and _resolved_ip to indicate the fallback.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 504b6119-7003-4648-a2be-b687bc5a78ed
📒 Files selected for processing (1)
extensions/ccache-remote/ccache-remote.sh
…pback When avahi-browse discovers a ccache service on the local machine, it returns 127.0.0.1 as the address. The code used this IP directly in --add-host, making the hostname resolve to the container's own loopback inside Docker instead of the host machine, causing all remote cache lookups to fail (err=N in ccache stats). Fix: after resolving the hostname (from avahi discovery or getent), check if the resulting IP is a loopback address and use host-gateway instead, consistent with the existing handling for literal localhost/ 127.0.0.1 in the storage URL. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4b7620d to
49fb658
Compare
Summary
--add-host, making the hostname resolve to the container's own loopback inside Docker instead of the host machine, causing all remote cache lookups to fail (err=Nin ccache stats).host-gatewayinstead, consistent with the existing handling for literallocalhost/127.0.0.1in the storage URL.Test plan
err=Nin ccache stats)Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
Summary by CodeRabbit