Skip to content

Commit 0c6e07b

Browse files
committed
ci: pull Playwright browsers from MCR image, not cdn.playwright.dev
cdn.playwright.dev browser-binary downloads stall from GitHub runners (the binaries never finish, hanging the job for its full duration even with a timeout+retry; confirmed via logs). Pull the exact matching browsers from the official Playwright image on Microsoft Container Registry (mcr.microsoft.com/playwright:v1.59.1-noble, independent of cdn.playwright.dev) and copy them into the default browser cache. Verified: the v1.59.1-noble tag exists, the image keeps browsers at /ms-playwright with 0777 perms, and its browser revisions match @playwright/test 1.59.1 by construction. e2e still runs on the normal runner as a non-root user, so Chromium keeps its sandbox. install-deps stays (apt only, no CDN). Keep the image tag in lockstep with @playwright/test on bumps.
1 parent c1e7494 commit 0c6e07b

2 files changed

Lines changed: 25 additions & 19 deletions

File tree

.github/workflows/ci.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,19 @@ jobs:
2727
- run: bun run typecheck
2828
- run: bun run build
2929
- run: bun run test
30-
- name: Install Playwright browsers
31-
# cdn.playwright.dev browser-binary downloads occasionally stall with no
32-
# built-in timeout, hanging the job. Cap each attempt and retry.
30+
- name: Provision Playwright browsers from MCR image (bypass cdn.playwright.dev)
31+
# cdn.playwright.dev browser-binary downloads stall from GitHub runners.
32+
# Pull the exact matching browsers from the official Playwright image on
33+
# Microsoft Container Registry, then copy them into the default browser
34+
# cache. install-deps is apt-only (no CDN download). Keep the image tag
35+
# in lockstep with @playwright/test in package.json (currently 1.59.1).
3336
run: |
34-
for i in 1 2 3; do
35-
timeout 480 bunx playwright install --with-deps chromium && exit 0
36-
echo "::warning::Playwright install attempt $i stalled or failed; retrying"
37-
sleep 10
38-
done
39-
echo "::error::Playwright browser download failed after 3 attempts"; exit 1
37+
bunx playwright install-deps chromium
38+
docker create --name pwbrowsers mcr.microsoft.com/playwright:v1.59.1-noble
39+
mkdir -p "$HOME/.cache/ms-playwright"
40+
docker cp pwbrowsers:/ms-playwright/. "$HOME/.cache/ms-playwright/"
41+
docker rm pwbrowsers
42+
ls -1 "$HOME/.cache/ms-playwright"
4043
- run: bun run test:e2e
4144
env:
4245
PLAYWRIGHT_PROJECTS: chromium

.github/workflows/release.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,21 @@ jobs:
7575
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
7676
run: bun run test
7777

78-
- name: Install Playwright browsers
78+
- name: Provision Playwright browsers from MCR image (bypass cdn.playwright.dev)
7979
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
80-
# cdn.playwright.dev browser-binary downloads occasionally stall with no
81-
# built-in timeout, hanging the job for its full duration. Cap each
82-
# attempt and retry so a stalled download fails fast and re-fetches.
80+
# cdn.playwright.dev browser-binary downloads stall from GitHub runners
81+
# (the binaries never finish, hanging the job). Pull the exact matching
82+
# browsers from the official Playwright image on Microsoft Container
83+
# Registry instead, then copy them into the default browser cache.
84+
# install-deps is apt-only (no CDN download). Keep the image tag in
85+
# lockstep with @playwright/test in package.json (currently 1.59.1).
8386
run: |
84-
for i in 1 2 3; do
85-
timeout 540 bunx playwright install --with-deps chromium firefox webkit && exit 0
86-
echo "::warning::Playwright install attempt $i stalled or failed; retrying"
87-
sleep 10
88-
done
89-
echo "::error::Playwright browser download failed after 3 attempts (cdn.playwright.dev stall)"; exit 1
87+
bunx playwright install-deps
88+
docker create --name pwbrowsers mcr.microsoft.com/playwright:v1.59.1-noble
89+
mkdir -p "$HOME/.cache/ms-playwright"
90+
docker cp pwbrowsers:/ms-playwright/. "$HOME/.cache/ms-playwright/"
91+
docker rm pwbrowsers
92+
ls -1 "$HOME/.cache/ms-playwright"
9093
9194
- name: E2E tests
9295
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'

0 commit comments

Comments
 (0)