glci run fails on every job, every project, always at the "Getting source from Git repository"
Summary
glci run fails on every job, on every project, always at the "Getting source from Git repository" step, with:
fatal: unable to access 'http://glci-mock:<port>/...': Failed to connect to glci-mock:<port> after ~130000 ms: Could not connect to serverRoot cause: glci enables FF_NETWORK_PER_BUILD in the runner config it generates, but computes the extra_hosts entry for glci-mock as a static, pre-resolved IP address (the gateway of glci's own glci-net-<N> network) instead of using Docker's native host-gateway sentinel. Under FF_NETWORK_PER_BUILD, the job container is placed on its own independent per-build network (runner-<id>-...), which is never the same network as glci-net-<N>. The static IP baked into extra_hosts is therefore unreachable from the job container (different bridge network, isolated by Docker's default inter-network iptables rules), and the connection hangs until TCP times out.
Environment
- glci: commit
50516e8ccf85514a484295556f578f9d97437707(daemon and CLI in sync) - Also reproduced on commit
8f2a3707a54be3e2416d6b6b6268ab4a67740d62(previous day, same machine) - GitLab Runner (embedded): 19.2.0
- Docker: 28.4.0, Docker Desktop + WSL2 backend
- OS: Windows 11 + WSL2,
Linux 5.15.167.4-microsoft-standard-WSL2 .glciconfig.toml(project): only[skip] stages = [".pre"], unrelated to this bug- Global
~/.glci/config.toml: tested both a stale hardcodedhost_gateway = "172.20.0.1"and the documented defaulthost_gateway = "auto"— both fail identically
Steps to reproduce
Minimal repro, no project-specific config needed:
mkdir glci-repro && cd glci-repro
git init
git config user.email test@test.local
git config user.name test
cat > .gitlab-ci.yml <<'EOF'
smoke:
stage: test
script:
- echo ok
EOF
git add .gitlab-ci.yml
git commit -m init
glci run smokeResult: job hangs on "Getting source from Git repository" for ~130s, then fails with the connection error above.
Evidence
1. glci forces FF_NETWORK_PER_BUILD = true in the runner config.toml it generates for the embedded gitlab-runner (captured live from a running job, via docker exec glci-runner cat /etc/gitlab-runner/config.toml):
[runners.docker]
extra_hosts = ["glci-mock:172.18.0.1"]
...
[runners.feature_flags]
FF_NETWORK_PER_BUILD = true172.18.0.1 here is the gateway of glci-net-2, the network glci created for its own use (mock server + daemon). It is not related to the job's actual network.
2. The job container ends up on a completely different network, created independently by the embedded gitlab-runner because of the forced feature flag:
$ docker network inspect runner-e3826f44b-1-0-17895467181190001 --format '{{json .IPAM.Config}}'
[{"Subnet":"172.20.0.0/16","Gateway":"172.20.0.1"}]
$ docker network inspect glci-net-2 --format '{{json .IPAM.Config}}'
[{"Subnet":"172.18.0.0/16","Gateway":"172.18.0.1"}]3. /etc/hosts inside the -predefined job container, confirming the static/stale mapping:
172.18.0.1 glci-mock
172.20.0.2 runner-e3826f44b-project-1-concurrent-0glci-mock resolves to glci-net-2's gateway, which is unreachable from a container whose only network is runner-... (172.20.0.0/16). Docker's default bridge-to-bridge isolation silently drops the traffic, so the connection hangs rather than being actively refused, giving the ~130s timeout instead of an immediate error.
4. The official troubleshooting docs describe the intended mechanism, which does not match the above:
"Each build gets its own Docker network via
FF_NETWORK_PER_BUILD. Job containers reach the mock server viaextra_hosts(host-gateway)."
This describes Docker's native extra_hosts: ["glci-mock:host-gateway"] sentinel, which Docker resolves per-container, dynamically, regardless of which network that container is on — this would correctly sidestep the whole per-build-network problem. But the actually-generated config uses a literal precomputed IP address instead of the host-gateway string, which defeats the mechanism entirely.
5. The [network] host_gateway config key (glci config --network) does not fix this. Its default is "auto", but "auto" only recomputes the gateway of glci's own glci-net-<N> network — never the gateway of the independent per-build network that FF_NETWORK_PER_BUILD creates. Tested explicitly:
$ glci config --network
[network]
host_gateway = "auto" (default)Same failure as with a hardcoded IP.
Expected behavior
extra_hosts in the generated runner config should use Docker's native host-gateway sentinel (extra_hosts = ["glci-mock:host-gateway"]) instead of a precomputed IP, so it resolves correctly regardless of which network the job container is placed on — consistent with what the project's own troubleshooting documentation already describes as the intended design. Alternatively, if a precomputed IP is intentional for some other reason, glci should attach the glci-mock container to the per-build network it does not control (the one gitlab-runner creates for FF_NETWORK_PER_BUILD), or avoid forcing FF_NETWORK_PER_BUILD = true when it cannot guarantee mock-server reachability on that network.
Impact
glci run (and by extension glci run --simulate) never completes any job that needs to fetch source code, on any project, on this (and reportedly other) Docker Desktop + WSL2 environments. This makes glci unusable for local CI/CD pipeline debugging in this setup.