chore(ci): Use Playwright Docker images instead of install-playwright action#20270
Draft
chore(ci): Use Playwright Docker images instead of install-playwright action#20270
Conversation
… action Replace the custom `install-playwright` composite action with official Playwright Docker images for browser integration tests, and inline `npx playwright install` for other jobs. **Browser integration tests** (playwright + loader): - Use `mcr.microsoft.com/playwright:v1.56.1-noble` container image - Browsers are pre-installed, no download or caching needed **Remix, E2E, canary, flaky-test-detector**: - Replace composite action with `npx playwright install --with-deps chromium` - These jobs have complex setups (Node version matrix, pnpm, Verdaccio) where a container adds unnecessary complexity This also removes the `actions/cache@v4` usage from the composite action, eliminating another source of Node.js 20 deprecation warnings. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Cloudflare
Core
Deps
Other
Bug Fixes 🐛Deno
Other
Internal Changes 🔧Ci
Deps
Deps Dev
Other
🤖 This preview updates automatically when you update the PR. |
Build a custom Docker image extending the official Playwright image with yarn pre-installed, push it to GHCR, and use it across all CI jobs that need Playwright browsers. - Add `.github/docker/playwright.Dockerfile` with yarn@1.22.22 - Add build workflow that pushes to GHCR on Dockerfile or Playwright version changes - All Playwright jobs (browser tests, loader tests, Remix, E2E, canary, flaky-test-detector) now use the GHCR container image - No more `npx playwright install` or browser caching logic anywhere When bumping @playwright/test, also update the PLAYWRIGHT_IMAGE env var in build.yml, canary.yml, and flaky-test-detector.yml. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
size-limit report 📦
|
- Trigger the build workflow on PRs that change the Dockerfile, Playwright version, or any e2e test application package.json - Add a version consistency check that verifies all packages and e2e test applications use the same @playwright/test version as the canonical source (dev-packages/browser-integration-tests) - On PRs, the image is built (to verify the Dockerfile) but not pushed - On push to develop and workflow_dispatch, the image is built and pushed Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tandalone workflow Replace the standalone build-playwright-docker-image workflow with a composite action that runs as a prerequisite job in each workflow: - Verifies all @playwright/test versions are consistent across the repo - Checks if the GHCR image already exists (noop if so) - Builds and pushes only when the image is missing Each workflow (build, canary, flaky-test-detector) now has a small `job_playwright_image` prerequisite job that runs the composite action and outputs the image reference for downstream container jobs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove the default value for PLAYWRIGHT_VERSION ARG so the build fails if the arg isn't passed. The ensure-playwright-image action reads the version from browser-integration-tests/package.json and passes it as a build arg — that is the single source of truth. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Simplify the checkout steps — full checkout is fine here and avoids potential issues with missing files. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@playwright/test is in `dependencies` (not `devDependencies`) in browser-integration-tests/package.json. Check both fields so the version is found regardless of which section it's declared in. Also cleaned up the version consistency check to use a shared function and log the canonical version for easier debugging. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Firefox fails with "Sandbox: CanCreateUserNamespace() clone() failure: EPERM" when running in a Docker container on GitHub Actions because user namespaces are restricted. Adding --ipc=host allows the browser sandbox to work correctly for all browsers (chromium, firefox, webkit). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The image tag was only based on the Playwright version, so changes to the Dockerfile (e.g. adding yarn, system deps) didn't trigger a rebuild. Tag is now `v<playwright-version>-<8-char-dockerfile-hash>`, e.g. `v1.56.0-a1b2c3d4`. Any change to the Dockerfile produces a new tag, which misses the GHCR cache and triggers a fresh build. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
GitHub Actions runs containers as root but sets HOME=/github/home (owned by pwuser). Firefox refuses to launch as root in another user's home directory. Setting HOME=/root fixes this. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
install-playwrightcomposite action@playwright/testversion consistency across the entire repoArchitecture
Each workflow has a lightweight
job_playwright_imageprerequisite job that:@playwright/testversions match across packages and e2e test appsghcr.io/getsentry/sentry-javascript/playwright:v<version>already existsDownstream jobs reference the image via
needs.job_playwright_image.outputs.image.Jobs updated
install-playwrightcomposite actioninstall-playwrightcomposite actioninstall-playwrightcomposite actioninstall-playwrightcomposite actioninstall-playwrightcomposite actioninstall-playwrightcomposite actioninstall-playwrightcomposite actionBenefits
actions/cache@v4usage from the deleted composite action (Node.js 20 deprecation warning)@playwright/testversions fail CI with clear error annotationspackage.jsonautomaticallydocker manifest inspect)Maintenance
When bumping
@playwright/test, the ensure-playwright-image action automatically detects the new version and builds a new image on the first CI run. No manual workflow file updates needed.Test plan
job_playwright_imageis a noop when the image already exists🤖 Generated with Claude Code