Skip to content

ci(playwright): cache Chromium apt deps to skip the mirror fetch per shard - #30847

Merged
chirag-madlani merged 1 commit into
mainfrom
ci/playwright-cache-apt-deps
Aug 3, 2026
Merged

chirag-madlani merged 1 commit into
mainfrom
ci/playwright-cache-apt-deps

Conversation

@chirag-madlani

Copy link
Copy Markdown
Collaborator

Summary

Every shard job (and the fixture builder on cache miss) runs npx playwright install-deps chromium, which apt-fetches ~21 MB of font packages from the Ubuntu Azure mirror. Two problems today:

  1. Repeats on every shard — the package list only changes on Playwright version bumps.
  2. A slow mirror can crawl the shard — chromium-18 in run 30788758311 hit 40 kB/s for 8m 45s, pushing its shard-job elapsed to 33.5 min and tripping the 30-min shardsAtMostThirtyMinutesBeforeUpload gate.

Change

Add awalsh128/[email protected] before each install-deps call, at both spots:

  • line 791 — fixture builder (only on fixture cache miss)
  • line 1052 — every shard job (chromium-01, chromium-02, …, plus other lanes)

On cache hit (99% of runs)

The action extracts the previously-installed files (/usr/share/fonts, /var/cache/fontconfig, dpkg state) directly from GH Actions cache. The subsequent install-deps sees every package as already-installed and skips the mirror fetch entirely (~1-2 s no-op).

On cache miss (Playwright version bumps only)

The action installs the same packages via apt as today, then bundles the result into the cache for next time. Same net cost as today, plus a small tar-and-upload overhead.

Design notes

  • install-deps deliberately kept as a safety net. If a Playwright version bump adds a new dep our hardcoded package list doesn't know about, install-deps will still catch it — we only miss the cache speedup for the newly-added package on the next few runs, and the failure mode is graceful (fetch fresh, don't fail).
  • continue-on-error: true on the cache action means any caching failure never blocks the shard — worst case we fall through to today's behavior.
  • version: playwright-chromium-deps-v1 in the cache key lets us bust the cache manually (bump to v2) if the package list needs to change.
  • Third-party action is pinned to v1.5.1. Matches the repo's convention of pinning by tag (not SHA) alongside actions/* deps. awalsh128/cache-apt-pkgs-action is widely used and stable.

Expected impact

Per-shard: install-deps step drops from ~30 s (happy path) → ~2 s. On a bad-mirror day: shards that would have crawled to 33 min stay near their normal ~25 min wall.

Aggregate across a 20-shard merge_queue run: saves ~10 min of accumulated runner minutes on the happy path, and eliminates the mirror-slowness class of failure entirely.

Test plan

  • YAML syntax validated.
  • First merge-queue run on this branch: shards should show a Cache Playwright system deps step succeeding (miss on the first run, hit thereafter). install-deps runs but reports 0 packages newly installed.
  • Subsequent runs: install-deps step drops to ~2 s across all shards.
  • Playwright version bump (whenever it happens): cache misses cleanly, action re-populates.

Related: #30826 (docker pull retry — same shape of infra-resilience change).

🤖 Generated with Claude Code

…shard

Every shard job (and the fixture builder on cache miss) runs
`npx playwright install-deps chromium`, which apt-fetches ~21 MB of font
packages from the Ubuntu Azure mirror. Two problems:

1. It repeats on every shard even though the package list only changes
   on Playwright version bumps.
2. When the Azure mirror hiccups, a single shard can crawl for many
   minutes on the download. chromium-18 in run 30788758311 hit 40 kB/s
   for 8m 45s, pushing its shard-job elapsed to 33.5 min and tripping
   the 30-min `shardsAtMostThirtyMinutesBeforeUpload` gate.

Add `awalsh128/cache-apt-pkgs-action` before each `install-deps` call.
On cache hit the action extracts the previously-installed files
directly (/usr/share/fonts, /var/cache/fontconfig, dpkg state) — the
subsequent `install-deps` sees every package as already-installed and
skips fetching from the mirror. On cache miss (Playwright version bump)
the action installs the same packages via apt as today and captures
the result for next time.

`install-deps` is deliberately kept as a safety net so a future
Playwright version that adds a new dep doesn't silently miss it —
the cache action only lists the packages we've seen it install today.

`continue-on-error: true` on the cache action means a caching failure
never blocks the shard — worst case we fall through to today's
behavior (fresh apt fetch).

Applied to both call sites:
- fixture builder (line 795, runs only on fixture cache miss)
- shard job (line 1056, runs on every chromium/basic/etc shard)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings August 3, 2026 07:34
@github-actions

github-actions Bot commented Aug 3, 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 3, 2026
@gitar-bot

gitar-bot Bot commented Aug 3, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Caches Chromium apt dependencies in Playwright CI workflows to skip mirror fetches per shard and prevent timeout failures. 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 improves Playwright E2E CI stability and shard performance by avoiding repeated apt mirror downloads for Playwright’s Chromium system dependencies (fonts/xfonts), which have caused shard slowdowns and time-gate failures.

Changes:

  • Adds an apt package cache restore step before npx playwright install-deps chromium in the fixture-builder path (only when the fixture cache is missed).
  • Adds the same apt package cache restore step before npx playwright install-deps chromium in every shard job so shard runs skip repeated mirror fetches.
Suppressed comments (1)

.github/workflows/playwright-postgresql-e2e.yml:1075

  • awalsh128/cache-apt-pkgs-action is a third-party action and is currently pinned to a mutable tag (v1.5.1). For supply-chain safety, pin it to the immutable commit SHA (the rest of this workflow already pins third-party actions by SHA, e.g. tj-actions/changed-files@...).
        uses: awalsh128/[email protected]


# Restore Playwright's Chromium system deps (fonts + xfonts) from the
# GH Actions cache before install-deps runs. On cache hit the action
# extracts the previously-installed files (~/usr/share/fonts and
# bump that adds a new dep does not silently miss it.
- name: Cache Playwright system deps
if: ${{ needs.restore-playwright-fixture.outputs.fixture_cache_hit != 'true' || (needs.plan-playwright.outputs.requires_airflow == 'true' && needs.restore-playwright-fixture.outputs.ingestion_cache_hit != 'true') }}
uses: awalsh128/[email protected]
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit 4d1856567badce7699f66cfdb97480a204c9cd79 in Playwright run 30794123798, 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) 1h 0m 41s

⏱️ Max setup 3m 1s · max shard execution 18m 46s · max shard-job elapsed before upload 23m 4s · reporting 6s

🌐 201.44 requests/attempt · 2.83 app boots/UI scenario · 7.73% common-shard skew

Optimization targets still in progress:

  • Browser traffic was 201.44 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.83 per UI scenario (1620 boots / 572 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 139 0 0 3 0 0
🟡 Shard chromium-02 135 0 1 0 0 0
✅ Shard chromium-03 124 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 › Domain Propagation (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

Merged via the queue into main with commit 3cc722c Aug 3, 2026
77 of 78 checks passed
@chirag-madlani
chirag-madlani deleted the ci/playwright-cache-apt-deps branch August 3, 2026 13:45
k-anshul pushed a commit to k-anshul/OpenMetadata that referenced this pull request Aug 12, 2026
…shard (open-metadata#30847)

Every shard job (and the fixture builder on cache miss) runs
`npx playwright install-deps chromium`, which apt-fetches ~21 MB of font
packages from the Ubuntu Azure mirror. Two problems:

1. It repeats on every shard even though the package list only changes
   on Playwright version bumps.
2. When the Azure mirror hiccups, a single shard can crawl for many
   minutes on the download. chromium-18 in run 30788758311 hit 40 kB/s
   for 8m 45s, pushing its shard-job elapsed to 33.5 min and tripping
   the 30-min `shardsAtMostThirtyMinutesBeforeUpload` gate.

Add `awalsh128/cache-apt-pkgs-action` before each `install-deps` call.
On cache hit the action extracts the previously-installed files
directly (/usr/share/fonts, /var/cache/fontconfig, dpkg state) — the
subsequent `install-deps` sees every package as already-installed and
skips fetching from the mirror. On cache miss (Playwright version bump)
the action installs the same packages via apt as today and captures
the result for next time.

`install-deps` is deliberately kept as a safety net so a future
Playwright version that adds a new dep doesn't silently miss it —
the cache action only lists the packages we've seen it install today.

`continue-on-error: true` on the cache action means a caching failure
never blocks the shard — worst case we fall through to today's
behavior (fresh apt fetch).

Applied to both call sites:
- fixture builder (line 795, runs only on fixture cache miss)
- shard job (line 1056, runs on every chromium/basic/etc shard)

Co-authored-by: Claude Opus 4.7 (1M context) <[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.

4 participants