Skip to content

DEV: Pin playwright browser cache path in discourse_test image#1058

Merged
tgxworld merged 1 commit into
mainfrom
tgxworld/playwright-browsers-path
May 21, 2026
Merged

DEV: Pin playwright browser cache path in discourse_test image#1058
tgxworld merged 1 commit into
mainfrom
tgxworld/playwright-browsers-path

Conversation

@tgxworld
Copy link
Copy Markdown
Contributor

Previously, the discourse_test image 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 uses HOME=/github/home, missed the cache via the default ~/.cache/ms-playwright lookup and re-downloaded chromium (~170 MB) on every system test job.

This change pins PLAYWRIGHT_BROWSERS_PATH to the installed path in the image's release stage so consumers inherit it regardless of which user runs the container.

Paired change: discourse/discourse#40214 (drops the now-redundant Install playwright step from the test workflow once this image change ships).

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.
@tgxworld tgxworld merged commit b2fbbeb into main May 21, 2026
8 of 12 checks passed
@tgxworld tgxworld deleted the tgxworld/playwright-browsers-path branch May 21, 2026 02:31
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.
tgxworld added a commit that referenced this pull request May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants