You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Harden the MSVC build workflow against transient Docker daemon unavailability
GitHub-hosted Windows runners occasionally start the job before the Docker
engine is listening on \\.\pipe\docker_engine. The first docker command then
fails instantly with "failed to connect to the docker API", which surfaced as a
confusing "LastTest.log not found" and a ~27s red build unrelated to any code
change.
- Add a "Wait for Docker daemon" step that polls `docker version` until the
engine responds (up to 4 minutes) before any docker command, and fails with a
clear message if it never comes up.
- Retry `docker pull` (cached-image step) up to 3 times on transient
registry/network/daemon errors; a "not found" result still falls through to
building the image from scratch.
- Retry the `docker run` build step up to 3 times, but only when the daemon was
unreachable -- a genuine build or test failure is propagated immediately and
never triggers a costly rebuild. Output is streamed via Tee-Object so the
build log still appears live.
CI-only change; no library code is affected.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
# Retry only when the daemon was unreachable / the container never
192
+
# started; a genuine build or test failure must NOT trigger a costly
193
+
# rebuild and is propagated to the "Check test results" step.
194
+
$daemonError = ($output -join "`n") -match 'pipe/docker_engine|error during connect|cannot connect to the Docker daemon|failed to connect to the docker API'
195
+
if ($daemonError -and $attempt -lt $maxAttempts) {
196
+
Write-Host "##[warning]Docker daemon not reachable (attempt $attempt/$maxAttempts); retrying in 10s..."
197
+
Start-Sleep -Seconds 10
198
+
continue
199
+
}
200
+
201
+
Write-Error "Container build failed with exit code $code"
0 commit comments