Skip to content

ci(playwright): retry docker pulls when starting the fast environment - #30826

Merged
chirag-madlani merged 1 commit into
mainfrom
ci/playwright-fast-env-pull-with-retry
Aug 3, 2026
Merged

chirag-madlani merged 1 commit into
mainfrom
ci/playwright-fast-env-pull-with-retry

Conversation

@chirag-madlani

Copy link
Copy Markdown
Collaborator

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:

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. The single-shot docker compose up 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.

Change

Small pull_image_with_retry helper in the same script, called for both PW_POSTGRES_IMAGE and PW_OPENSEARCH_IMAGE before the compose up:

  • Skip the pull if the image is already cached on the runner (docker image inspect first) — repeat invocations on the same runner stay zero-cost.
  • 3 attempts with 10s / 20s / 40s backoff. Worst case adds ~70 s of sleep inside the existing 5-minute wrapper.
  • Fail with a clear message rather than orphaning the compose stack — separating the network step from the container start also gives a cleaner failure surface.

Compose up itself is unchanged. Nothing else in the script moves.

Test plan

  • bash -n syntax check clean.
  • shellcheck clean.
  • Merge-queue runs where Docker Hub is healthy: no behavior change (images are pre-pulled, compose up finds them locally).
  • Merge-queue runs where Docker Hub hiccups on one attempt: the shard sleeps 10 s and retries, succeeds, continues to tests.

🤖 Generated with Claude Code

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]>
Copilot AI review requested due to automatic review settings August 2, 2026 10:40
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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 skip-pr-checks label.

@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Aug 2, 2026
@gitar-bot

gitar-bot Bot commented Aug 2, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Adds 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.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar | Powered by Gitar — free for open source

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_retry helper to retry docker pull (3 attempts with exponential backoff) and to skip pulling if the exact digest image is already cached.
  • Pre-pulls $PW_POSTGRES_IMAGE and $PW_OPENSEARCH_IMAGE before running docker compose up, improving failure clarity and avoiding partial compose starts when pulls fail.

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit 404cc51a7c83455ab457f2497b9bde27f9a92ad6 in Playwright run 30744194896, attempt 1.

✅ 549 passed · ❌ 0 failed · 🟡 1 flaky · ⏭️ 3 skipped · 🧰 0 lifecycle flaky

Performance

Blocking 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:

  • Browser traffic was 201.34 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.83 per UI scenario (1621 boots / 572 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 142 0 0 3 0 0
🟡 Shard chromium-02 121 0 1 0 0 0
✅ Shard chromium-03 135 0 0 0 0 0
✅ Shard data-asset-rules-01 61 0 0 0 0 0
✅ Shard domain-isolation-01 14 0 0 0 0 0
✅ Shard global-state-01 34 0 0 0 0 0
✅ Shard ingestion-01 1 0 0 0 0 0
✅ Shard reindex-01 2 0 0 0 0 0
✅ Shard search-01 10 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0
🟡 1 flaky test(s) (passed on retry)
  • Pages/Entity.spec.ts › Tier Add, Update and Remove (shard chromium-02, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@chirag-madlani
chirag-madlani added this pull request to the merge queue Aug 3, 2026
Merged via the queue into main with commit d13b818 Aug 3, 2026
74 of 75 checks passed
@chirag-madlani
chirag-madlani deleted the ci/playwright-fast-env-pull-with-retry branch August 3, 2026 13:45
k-anshul pushed a commit to k-anshul/OpenMetadata that referenced this pull request Aug 12, 2026
…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]>
chirag-madlani added a commit that referenced this pull request Aug 19, 2026
…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]>

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants