Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

feat(ci): install chromium via http_archive #62683

Merged
merged 8 commits into from
May 27, 2024

Conversation

jamesmcnamara
Copy link
Contributor

@jamesmcnamara jamesmcnamara commented May 14, 2024

I'm trying to install chromium for playwright to use but it's a bit of a nightmare. Starting with just the most pressing problem: Bazel cannot handle runfiles with spaces in them. When we extract just the chromium executable as we did in this commit, playwright fails because it expects the supporting files to be present:

  1) [chromium] › src/routes/[...repo=reporev]/(validrev)/-/branches/page.spec.ts:31:5 › list branches

    Error: browserType.launch: Target page, context or browser has been closed
    Browser logs:

    <launching> ../chromium-darwin-arm64/chrome-mac/Chromium.app/Contents/MacOS/Chromium --disable-field-trial-config --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate,HttpsUpgrades,PaintHolding --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --disable-search-engine-choice-screen --enable-use-zoom-for-dsf=false --use-angle --headless --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --user-data-dir=/var/folders/jv/l76kfkmn0f7by8mt_khd9_rw0000gn/T/playwright_chromiumdev_profile-UOagZw --remote-debugging-pipe --no-startup-window
    <launched> pid=17785
    [pid=17785][err] dlopen /private/var/tmp/_bazel_james/ce8280211e358ae1a5987c2895741c06/sandbox/darwin-sandbox/10848/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/client/web-sveltekit/e2e_test.sh.runfiles/__main__/../chromium-darwin-arm64/chrome-mac/Chromium.app/Contents/MacOS/../Frameworks/Chromium Framework.framework/Versions/125.0.6422.26/Chromium Framework: dlopen(/private/var/tmp/_bazel_james/ce8280211e358ae1a5987c2895741c06/sandbox/darwin-sandbox/10848/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/client/web-sveltekit/e2e_test.sh.runfiles/__main__/../chromium-darwin-arm64/chrome-mac/Chromium.app/Contents/MacOS/../Frameworks/Chromium Framework.framework/Versions/125.0.6422.26/Chromium Framework, 0x0105): tried: '/private/var/tmp/_bazel_james/ce8280211e358ae1a5987c2895741c06/sandbox/darwin-sandbox/10848/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/client/web-sveltekit/e2e_test.sh.runfiles/__main__/../chromium-darwin-arm64/chrome-mac/Chromium.app/Contents/MacOS/../Frameworks/Chromium Framework.framework/Versions/125.0.6422.26/Chromium Framework' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/private/var/tmp/_bazel_james/ce8280211e358ae1a5987c2895741c06/sandbox/darwin-sandbox/10848/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/client/web-sveltekit/e2e_test.sh.runfiles/__main__/../chromium-darwin-arm64/chrome-mac/Chromium.app/Contents/MacOS/../Frameworks/Chromium Framework.framework/Versions/125.0.6422.26/Chromium Framework' (no such file), '/private/var/tmp/_bazel_james/ce8280211e358ae1a5987c2895741c06/sandbox/darwin-sandbox/10848/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/client/web-sveltekit/e2e_test.sh.runfiles/__main__/../chromium-darwin-arm64/chrome-mac/Chromium.app/Contents/MacOS/../Frameworks/Chromium Framework.framework/Versions/125.0.6422.26/Chromium Framework' (no such file).
    [pid=17785] <process did exit: exitCode=null, signal=SIGABRT>
    [pid=17785] starting temporary directories cleanup
    Call log:
      - <launching> ../chromium-darwin-arm64/chrome-mac/Chromium.app/Contents/MacOS/Chromium --disable-field-trial-config --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate,HttpsUpgrades,PaintHolding --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --disable-search-engine-choice-screen --enable-use-zoom-for-dsf=false --use-angle --headless --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --user-data-dir=/var/folders/jv/l76kfkmn0f7by8mt_khd9_rw0000gn/T/playwright_chromiumdev_profile-UOagZw --remote-debugging-pipe --no-startup-window
      - <launched> pid=17785
      - [pid=17785][err] dlopen /private/var/tmp/_bazel_james/ce8280211e358ae1a5987c2895741c06/sandbox/darwin-sandbox/10848/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/client/web-sveltekit/e2e_test.sh.runfiles/__main__/../chromium-darwin-arm64/chrome-mac/Chromium.app/Contents/MacOS/../Frameworks/Chromium Framework.framework/Versions/125.0.6422.26/Chromium Framework: dlopen(/private/var/tmp/_bazel_james/ce8280211e358ae1a5987c2895741c06/sandbox/darwin-sandbox/10848/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/client/web-sveltekit/e2e_test.sh.runfiles/__main__/../chromium-darwin-arm64/chrome-mac/Chromium.app/Contents/MacOS/../Frameworks/Chromium Framework.framework/Versions/125.0.6422.26/Chromium Framework, 0x0105): tried: '/private/var/tmp/_bazel_james/ce8280211e358ae1a5987c2895741c06/sandbox/darwin-sandbox/10848/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/client/web-sveltekit/e2e_test.sh.runfiles/__main__/../chromium-darwin-arm64/chrome-mac/Chromium.app/Contents/MacOS/../Frameworks/Chromium Framework.framework/Versions/125.0.6422.26/Chromium Framework' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/private/var/tmp/_bazel_james/ce8280211e358ae1a5987c2895741c06/sandbox/darwin-sandbox/10848/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/client/web-sveltekit/e2e_test.sh.runfiles/__main__/../chromium-darwin-arm64/chrome-mac/Chromium.app/Contents/MacOS/../Frameworks/Chromium Framework.framework/Versions/125.0.6422.26/Chromium Framework' (no such file), '/private/var/tmp/_bazel_james/ce8280211e358ae1a5987c2895741c06/sandbox/darwin-sandbox/10848/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/client/web-sveltekit/e2e_test.sh.runfiles/__main__/../chromium-darwin-arm64/chrome-mac/Chromium.app/Contents/MacOS/../Frameworks/Chromium Framework.framework/Versions/125.0.6422.26/Chromium Framework' (no such file).
      - [pid=17785] <process did exit: exitCode=null, signal=SIGABRT>
      - [pid=17785] starting temporary directories cleanup

tl;dr: It's looking for files in the chromium-darwin-arm64/chrome-mac/Chromium.app/Contents/MacOS/../Frameworks/Chromium Framework.framework/ dir and it doesn't exist (because we only copied over the executable.

So then I copied over all of the files like this (which causes lots of it's own problems because we can't use $(location ...) any more) but even before then it fails because the path from above (Chromium Framework) has a space in it.

INFO: Analyzed target //client/web-sveltekit:dummy (2 packages loaded, 352 targets configured).
ERROR: /Users/james/projects/sourcegraph/client/web-sveltekit/BUILD.bazel:170:10: Creating runfiles tree bazel-out/darwin_arm64-fastbuild/bin/client/web-sveltekit/dummy.runfiles failed: build-runfiles failed: error executing <shell command> command
  (cd /private/var/tmp/_bazel_james/ce8280211e358ae1a5987c2895741c06/execroot/__main__ && \
  exec env - \
    PATH=/bin:/usr/bin:/usr/local/bin \
    PG_UTILS_PATH=/opt/homebrew/opt/postgresql@15/bin \
  /var/tmp/_bazel_james/install/6fa43776ce3930b57b4217d3f775fd41/build-runfiles --allow_relative bazel-out/darwin_arm64-fastbuild/bin/client/web-sveltekit/dummy.runfiles_manifest bazel-out/darwin_arm64-fastbuild/bin/client/web-sveltekit/dummy.runfiles): Process exited with status 1: Process exited with status 1
/var/tmp/_bazel_james/install/6fa43776ce3930b57b4217d3f775fd41/build-runfiles (args bazel-out/darwin_arm64-fastbuild/bin/client/web-sveltekit/dummy.runfiles_manifest bazel-out/darwin_arm64-fastbuild/bin/client/web-sveltekit/dummy.runfiles): link or target filename contains space on line 6: 'chromium-darwin-arm64/chrome-mac/Chromium.app/Contents/Frameworks/Chromium Framework.framework/Chromium Framework /private/var/tmp/_bazel_james/ce8280211e358ae1a5987c2895741c06/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/external/chromium-darwin-arm64/chrome-mac/Chromium.app/Contents/Frameworks/Chromium Framework.framework/Chromium Framework'

Test plan

It will run in CI

@cla-bot cla-bot bot added the cla-signed label May 14, 2024
@jamesmcnamara jamesmcnamara merged commit 4eed823 into jsm/playwright-playground May 27, 2024
11 of 13 checks passed
@jamesmcnamara jamesmcnamara deleted the jsm/playwright-install branch May 27, 2024 20:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants