DEV: Pin playwright browser cache path in discourse_test image#1058
Merged
Conversation
Playwright stores its downloaded browsers under `~/.cache/ms-playwright` by default. The image installs chromium as the discourse user, which resolves to `/home/discourse/.cache/ms-playwright`. Consumers that run the container as a different user (e.g. GitHub Actions runs as root with `HOME=/github/home`) cannot reuse this cache via the default lookup and re-download chromium on every system test job. This commit sets `ENV PLAYWRIGHT_BROWSERS_PATH=/home/discourse/.cache/ms-playwright` in the `release` stage so the path is inherited by consumers regardless of which user runs the container, letting them skip the redundant download.
tgxworld
added a commit
to discourse/discourse
that referenced
this pull request
May 21, 2026
The `discourse_test` image pre-installs playwright's chromium browser under `/home/discourse/.cache/ms-playwright`. Previously, CI re-downloaded it (~170 MB) every system test job because playwright's `~/.cache/ms-playwright` lookup resolved to `/github/home/.cache/ms-playwright` (CI runs as root with `HOME=/github/home`). This commit sets `PLAYWRIGHT_BROWSERS_PATH` to the image's cache so the binary is found without a download, and drops the `Install playwright` step entirely. The env var lives in the workflow for now so the change can be verified independently. Once confirmed, the variable will be moved to the `discourse_test` image (paired with discourse/discourse_docker#1058) so CI does not need a workflow-side override.
KrisKotlarek
approved these changes
May 21, 2026
tgxworld
added a commit
to discourse/discourse
that referenced
this pull request
May 21, 2026
The `discourse_test` image pre-installs playwright's chromium browser under `/home/discourse/.cache/ms-playwright`. Previously, CI re-downloaded it (~170 MB) every system test job because playwright's `~/.cache/ms-playwright` lookup resolved to `/github/home/.cache/ms-playwright` (CI runs as root with `HOME=/github/home`). discourse/discourse_docker#1058 sets `ENV PLAYWRIGHT_BROWSERS_PATH=/home/discourse/.cache/ms-playwright` in the `release` stage, so CI inherits the path and finds the pre-installed binary without a download. The `Install playwright` step in this workflow is now redundant and is removed.
This was referenced May 21, 2026
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.
Previously, the
discourse_testimage installed playwright's chromium browser under the discourse user (/home/discourse/.cache/ms-playwright). Consumers that run the container as a different user, such as GitHub Actions which usesHOME=/github/home, missed the cache via the default~/.cache/ms-playwrightlookup and re-downloaded chromium (~170 MB) on every system test job.This change pins
PLAYWRIGHT_BROWSERS_PATHto the installed path in the image'sreleasestage so consumers inherit it regardless of which user runs the container.Paired change: discourse/discourse#40214 (drops the now-redundant
Install playwrightstep from the test workflow once this image change ships).