Map the mock server to Docker's host-gateway sentinel
Why
glci run failed every job, on every project, at "Getting source from Git repository", after waiting out a ~130s TCP timeout:
fatal: unable to access 'http://glci-mock:39741/...': Failed to connect to
glci-mock:39741 after 130000 ms: Could not connect to serverJob containers do not sit on a network glci controls — FF_NETWORK_PER_BUILD gives each build one gitlab-runner creates — so they reach the mock server by name, through an extra_hosts entry pointing at the Docker host and the port published there. e31a9dd (multi-daemon support) changed that entry from Docker's host-gateway sentinel to the pre-resolved gateway IP of glci's own bus network, where only the remote-runner case needed a per-daemon address.
A glci-net-* gateway is reachable from another bridge only where it happens to be host-local. It is on Linux and on the macOS VM backends — which is why this held for almost everyone — and on Docker Desktop's WSL2 backend the packets are dropped rather than refused, which is what turned an unreachable address into a two-minute hang and a git error that mentions nothing about networking.
The reporter also found that [network] host_gateway, documented as the escape hatch for exactly this, changed nothing: it was read by nothing but glci config --network.
What changed
The fix — the sentinel is restored, so the Docker daemon resolves it per container on whatever network that container landed on. Remote runners get it too; only a Windows daemon keeps a pre-resolved gateway, and that lookup now happens once per runner alongside isWindows()/IsOnDifferentHost(), so the relay decision and the entries for the runner and its job containers cannot disagree.
[network] made real, and global-only — host_gateway is now the wired escape hatch, and a value that is neither an IP nor the sentinel is refused rather than resolved to, because it lands in every job container's /etc/hosts. [network.extra_hosts] entries were dead too; they now reach job containers on every daemon, validated as name:address (split on the first colon so IPv6 survives), with an entry naming the mock server dropped — ordering is not protection, since musl's resolver collects every matching /etc/hosts line and treats the second address as a live fallback. The whole section becomes global-config-only: those keys redirect the API that serves the working tree and the job token, pick the daemon that receives them, or widen a loopback bind. [tls] cert_validity goes the other way and stays project-settable, falling back to 24h with its existing warning, so a repository's typo cannot stop every pipeline in its own checkout now that the daemon fails closed on a config that does not resolve.
A check that would have caught it — glci doctor gains a Job network row that reproduces the hop in about a second, fails only on evidence it measured (an engine error, an interrupt, a wrong answer, a refusal under the sentinel are all "not checked"), and separates the two failures that look identical from inside a container: a wrongly resolved host gateway, and a firewall dropping traffic from the docker bridges. --no-job-network opts out.
Verification
go build ./...,go vet ./...(incl.-tags e2e),gofmt,make test(20 packages) — greenTestDockerInfra_JobNetworkProbeand its negative twin — pass repeatedly (the first iteration of the probe failed 3/3 on a healthy host; that race is fixed)TestDockerInfra_JobResolvesMockOffGlciNetworks— runs a real pipeline onglci:localand asserts from inside the job container thatglci-mockresolves off everyglci-net-*gateway, which is the assertion that would have failed before this fixglci doctorpass / fail / skip / interrupt / TTY-progress paths checked by hand; no probe containers or networks leaked
Four rounds of /review-all (correctness, security, perf, concurrency, docs, CLI-UX) are resolved; the final security pass reported no findings.
Known gap: PreparePipeline/RepreparePipelineForResume returning the resolve error has no direct unit test — there is no harness for those functions, and building one is larger than this change. It is covered indirectly by the config-level tests and the doctor gate.
Closes #179 (closed)