Repository navigation
ci(playwright): retry docker pulls when starting the fast environment - #30826
Conversation
Three chromium shards (14, 19, 20) on merge-queue run 30730142750 all failed at the very first playwright step with: Get "https://auth.docker.io/token?account=githubactions&..." net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) Docker Hub's auth endpoint had a blip during the ~10-second window in which those three shards happened to be running `docker compose up`. The single-shot pull in `start_playwright_fast_environment.sh:181` gave the shard no way to recover — no tests ran, the merge queue had to be manually retried. Add a small `pull_image_with_retry` helper before the compose `up`: - Skip the pull if the image is already cached on the runner (`docker image inspect` succeeds) so repeat invocations on the same runner are still zero-cost. - Retry each image up to 3 times with 10s / 20s / 40s backoff. Worst case adds ~70 s of sleep to the 5-minute wrapper — still fits comfortably inside the outer timeout. - Fail with a clear "docker pull failed for X after 3 attempts" message rather than orphaning the compose stack. The compose `up` line stays as-is — separating the retriable network step from the container start also gives a cleaner failure surface when pulls genuinely can't succeed. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
Code Review ✅ ApprovedAdds a retry mechanism and caching check for Docker image pulls in the fast Playwright environment script to prevent pipeline failures from transient registry timeouts. No issues found. OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar | Powered by Gitar — free for open source |
There was a problem hiding this comment.
Pull request overview
This PR hardens the Playwright “fast environment” startup in CI by pre-pulling the fixture-pinned Postgres and OpenSearch images with retries, reducing shard failures caused by transient Docker Hub auth/network timeouts before any tests execute.
Changes:
- Adds a
pull_image_with_retryhelper to retrydocker pull(3 attempts with exponential backoff) and to skip pulling if the exact digest image is already cached. - Pre-pulls
$PW_POSTGRES_IMAGEand$PW_OPENSEARCH_IMAGEbefore runningdocker compose up, improving failure clarity and avoiding partial compose starts when pulls fail.
✅ Playwright Results — workflow succeededValidated commit ✅ 549 passed · ❌ 0 failed · 🟡 1 flaky · ⏭️ 3 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 50m 2s ⏱️ Max setup 3m 9s · max shard execution 17m 13s · max shard-job elapsed before upload 21m 0s · reporting 5s 🌐 201.34 requests/attempt · 2.83 app boots/UI scenario · 0.48% common-shard skew Optimization targets still in progress:
🟡 1 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
…open-metadata#30826) Three chromium shards (14, 19, 20) on merge-queue run 30730142750 all failed at the very first playwright step with: Get "https://auth.docker.io/token?account=githubactions&..." net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) Docker Hub's auth endpoint had a blip during the ~10-second window in which those three shards happened to be running `docker compose up`. The single-shot pull in `start_playwright_fast_environment.sh:181` gave the shard no way to recover — no tests ran, the merge queue had to be manually retried. Add a small `pull_image_with_retry` helper before the compose `up`: - Skip the pull if the image is already cached on the runner (`docker image inspect` succeeds) so repeat invocations on the same runner are still zero-cost. - Retry each image up to 3 times with 10s / 20s / 40s backoff. Worst case adds ~70 s of sleep to the 5-minute wrapper — still fits comfortably inside the outer timeout. - Fail with a clear "docker pull failed for X after 3 attempts" message rather than orphaning the compose stack. The compose `up` line stays as-is — separating the retriable network step from the container start also gives a cleaner failure surface when pulls genuinely can't succeed. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
…etry (#31730) Run 32222855561's plan-playwright died on a single upstream blip: error https://registry.yarnpkg.com/regenerator-runtime/-/regenerator- runtime-0.14.1.tgz: Request failed "502 Bad Gateway" Two defects compounded: 1. setup-node's built-in `cache: yarn` is exact-key only. The queue batch changed yarn.lock, the key missed with no fallback ("yarn cache is not found"), and yarn cold-fetched all ~2000 tarballs from the registry — maximizing the surface for any single 5xx. yarn v1 does not retry HTTP errors on tarball downloads, so one 502 killed the whole plan job and ejected the queue entry. 2. No retry anywhere around `yarn install`, the last infra dependency in the playwright pipeline without one (docker pulls retry since #30826; apt is cached + gated since #31691/#31718). Fixes, applied to all four install call sites (plan-playwright, prepare-playwright-fixture, playwright-ci, slack-notify): * Replace setup-node's cache with an explicit actions/cache on ~/.cache/yarn keyed on the lockfile hash WITH a restore-keys fallback. A lockfile change now restores the previous cache and yarn fetches only the delta — a handful of tarballs instead of the world. * Wrap `yarn --ignore-scripts --frozen-lockfile` in a 3-attempt retry (15 s / 30 s backoff, `--network-timeout 100000`). The idiom is verified safe under the runner's `bash -e`. Also in plan-playwright: mark the two browser-cache seeding steps `continue-on-error`. They exist to populate the run-scoped browser cache once for all downstream shards (not for `--list`, which never launches a browser) — a seeding failure should degrade to shards self-installing, not fail planning. Comment updated to document the seeding role explicitly. `id: setup-node` / `id: install-dependencies` outcome wiring in the shard job is preserved. Follow-up (separate PR): cache the discovery output itself (playwright-test-list.json keyed on the playwright tree + config + mode flags) so plan-playwright skips install + discovery entirely on the hot path. Co-authored-by: Claude Fable 5 <[email protected]>
Summary
Three chromium shards (14, 19, 20) on merge-queue run 30730142750 all died at the very first playwright step (
Restore fast Playwright environment) with the same error, seconds apart:Docker Hub's auth endpoint had a blip. The single-shot
docker compose upinstart_playwright_fast_environment.sh:181gave the shard no way to recover — no tests ran, the merge queue had to be manually retried.Change
Small
pull_image_with_retryhelper in the same script, called for bothPW_POSTGRES_IMAGEandPW_OPENSEARCH_IMAGEbefore the composeup:docker image inspectfirst) — repeat invocations on the same runner stay zero-cost.Compose
upitself is unchanged. Nothing else in the script moves.Test plan
bash -nsyntax check clean.shellcheckclean.🤖 Generated with Claude Code