Skip to content

build: cache Playwright browsers in product build test jobs - #343395

Merged
Bryan Chen (bryanchen-d) merged 1 commit into
mainfrom
copilot/vscode/ado-playwright-cache
Oct 27, 2026
Merged

Bryan Chen (bryanchen-d) merged 1 commit into
mainfrom
copilot/vscode/ado-playwright-cache

Conversation

@bryanchen-d

Copy link
Copy Markdown
Collaborator

Caches Playwright's browsers in the product build's test jobs (ADO def 111), so a Playwright CDN outage no longer fails them. This is the ADO half of B11. The GitHub half is #343387.

Stacked on #343325, which adds retryCountOnTaskFailure to the Cache@2 steps. This PR targets that branch so the diff shows only this change. I'll retarget it to main once #343325 merges.

Why

On Oct 21, 4 Windows test jobs in def 111 failed in Download Electron and Playwright (487426, 487513, 487556, 487566). playwright.download.prss.microsoft.com returned ENOTFOUND and the fallback cdn.playwright.dev/builds reset the connection. The step's retryCountOnTaskFailure: 3 was exhausted in under a minute. Those were the only Playwright download failures in 14 days (out of about 9,840 runs of that step), but they come in bursts.

What

There's a new step template, build/azure-pipelines/common/restore-playwright-browsers.yml, used by the Linux, macOS and Windows test step templates right before Download Electron and Playwright. It does two things:

  • It sets PLAYWRIGHT_BROWSERS_PATH to $(Build.SourcesDirectory)/.build/ms-playwright.
  • It restores that folder with Cache@2 (retryCountOnTaskFailure: 2), keyed on "playwright" | Agent.OS | VSCODE_ARCH | node_modules/playwright/package.json. That's the pinned Playwright version, so the key only changes when Playwright does.

Download Electron and Playwright itself is unchanged. On a hit, playwright install finds the browsers and downloads nothing. On a miss, it downloads as before, and Cache@2's post-job step saves the folder. Electron comes from our Azure feed, so it doesn't need this.

Validation (full def 111, publish off)

  1. Cold: 487870. I expect a cache miss, a download as today, and a post-job save.
  2. Warm: queued after 1 finishes. I expect a cache hit, and the install step showing no Downloading lines.

Results will be posted here before I ask for signing.

Authored with Copilot

@bryanchen-d
Bryan Chen (bryanchen-d) force-pushed the copilot/vscode/cache-restore-retry branch from 66394bc to 6d7acfd Compare October 22, 2026 00:43
@bryanchen-d
Bryan Chen (bryanchen-d) force-pushed the copilot/vscode/ado-playwright-cache branch from 2d27ad9 to 4d3365b Compare October 22, 2026 00:43
@bryanchen-d

Copy link
Copy Markdown
Collaborator Author

Def 111 validation (CI mode, publish off): cold, then warm.

Cold 487870 Warm 487882
Restore Playwright browsers cache 18/18 miss 18/18 hit
Browsers downloaded in Download Electron and Playwright 118 0
Linux x64: restore + download (median) 1.1 s + 17.3 s 4.8 s + 3.6 s
Windows x64: restore + download (median) 1.0 s + 22.5 s 4.9 s + 13.1 s (Electron only)
macOS arm64: restore + download (median) 1.3 s + 30.4 s 38.7 s + 2.7 s
  • Cold run: one job per platform saved the cache in its post-job step (Linux 570 MB, Windows 518 MB, macOS 450 MB physical). The other jobs found it already saved and skipped. Its only failures were the 3 known WebM Unit Tests (Electron) failures, because that run predates issue: skip WebM tests that can't open on the shipped Electron #343360 on main.
  • Warm run: every test job restored the cache, and playwright install downloaded nothing. That's what removes the dependency on Playwright's CDN, which is failing again tonight on the ADO macOS agents (487876, ERR_TLS_CERT_ALTNAME_INVALID).
  • Time: about 10 s faster on Linux and Windows, and about 10 s slower on macOS, where AcesShared restores the roughly 1.2 GB cache more slowly than the CDN download.

Co-authored with Copilot

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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

3 open issues
What changed in this PR

Adds an Azure Pipelines step template to cache Playwright browser downloads in product-build test jobs, reducing test flakiness when Playwright CDNs are unavailable.

Changes:

  • Introduces a shared restore-playwright-browsers.yml template that sets PLAYWRIGHT_BROWSERS_PATH and restores/saves .build/ms-playwright via Cache@2.
  • Wires the template into Linux, macOS, and Windows product-build test step templates immediately before the Playwright install step.
File Description
build/​azure-pipelines/​common/​restore-playwright-browsers.yml New template to set browser path and restore Playwright browser cache.
build/​azure-pipelines/​linux/​steps/​product-build-linux-test.yml Calls the new restore template before Playwright install.
build/​azure-pipelines/​darwin/​steps/​product-build-darwin-test.yml Calls the new restore template before Playwright install.
build/​azure-pipelines/​win32/​steps/​product-build-win32-test.yml Calls the new restore template before Playwright install.

Review effort: Lite

Base automatically changed from copilot/vscode/cache-restore-retry to main October 22, 2026 21:56
@bryanchen-d
Bryan Chen (bryanchen-d) force-pushed the copilot/vscode/ado-playwright-cache branch from a23c4fe to 90c7615 Compare October 22, 2026 22:02
@bryanchen-d
Bryan Chen (bryanchen-d) requested a balanced review from Copilot October 22, 2026 22:03

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.

🔵 Needs a closer look

Cold-cache saving and warm-cache reuse still need confirmation from the planned Azure DevOps runs across all three platforms.

No open issues 🎉

3 resolved since last review

Review effort: Balanced

The test jobs download every Playwright browser from Playwright's CDN.
On Oct 21, 4 Windows test jobs in def 111 failed in `Download Electron
and Playwright` while `playwright.download.prss.microsoft.com` didn't
resolve, and the step's own retries were over in under a minute.

Restore `.build/ms-playwright` with Cache@2 before the download, keyed
on OS, arch and the pinned Playwright version, and point
PLAYWRIGHT_BROWSERS_PATH at it. On a hit, `playwright install` finds the
browsers and downloads nothing. On a miss, it downloads as before and
the post-job step saves the cache.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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.

🔵 Needs a closer look

Successful cold-cache saves and warm-cache installs without downloads have not yet been confirmed across all three platforms.

No open issues 🎉

Review effort: Balanced

@bryanchen-d
Bryan Chen (bryanchen-d) marked this pull request as ready for review October 26, 2026 23:06
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

Ladislau Szomoru (@lszomoru)

Matched files:

  • build/azure-pipelines/common/restore-playwright-browsers.yml
  • build/azure-pipelines/darwin/steps/product-build-darwin-test.yml
  • build/azure-pipelines/linux/steps/product-build-linux-test.yml
  • build/azure-pipelines/win32/steps/product-build-win32-test.yml

@bryanchen-d
Bryan Chen (bryanchen-d) merged commit 502cb7d into main Oct 27, 2026
52 checks passed
@bryanchen-d
Bryan Chen (bryanchen-d) deleted the copilot/vscode/ado-playwright-cache branch October 27, 2026 15:45
@vs-code-engineering vs-code-engineering Bot added this to the 1.145.0 milestone Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants