Adds better caching for browser archives and their extraction. This is done because the archives are currently extracted as a build action and these are actions are invalidated frequently, causing flakiness on the CI and slow-down in local development. Here is an example flaky error on the CI (that surfaces often with RBE execution): ``` ERROR: /home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/external/npm/@angular/dev-infra-private/bazel/browsers/chromium/BUILD.bazel:22:17: Extracting ../org_chromium_chromium_amd64/file/chrome-linux.zip failed: (Exit 34): extract.sh failed: error executing command external/io_bazel_rules_webtesting/web/internal/extract.sh external/org_chromium_chromium_amd64/file/chrome-linux.zip ... (remaining 2 argument(s) skipped). Note: Remote connection/protocol failed with: execution failed ``` We fix this by introducing a new rule that downloads a browser archive and unpacks it directly into a Bazel repository. Before this change, the archive would just be downloaded but extracted later as part of a build action. This is unnecessary and results in less efficient caching as build actions are invalidated more often, especially if developers run `bazel clean` in between. The root cause on why the extraction often fails in RBE containers is unclear. It's unclear why the extacted archive is not cached properly as part of a build action (most likely some hermeticity issue within `rules_webtesting`, but it seems more Bazel-idiomatic to unpack the archives as part of the repository anyway, and this solves the flakiness issue. PR Close #42814
34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
load("@io_bazel_rules_webtesting//web:web.bzl", "browser")
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
browser(
|
|
name = "firefox",
|
|
disabled = select({
|
|
# TODO: Consider adding support for Windows. Requires a portable version of
|
|
# Firefox. Official distribution only ships with installers.
|
|
"@io_bazel_rules_webtesting//common/conditions:windows": "Firefox is not supported on Windows",
|
|
"//conditions:default": None,
|
|
}),
|
|
metadata = "firefox.json",
|
|
deps = [
|
|
"@io_bazel_rules_webtesting//go/wsl",
|
|
] + select({
|
|
"@io_bazel_rules_webtesting//common/conditions:linux": [
|
|
"@org_mozilla_firefox_amd64//:metadata",
|
|
"@org_mozilla_geckodriver_amd64//:metadata",
|
|
],
|
|
"@io_bazel_rules_webtesting//common/conditions:mac": [
|
|
"@org_mozilla_firefox_macos//:metadata",
|
|
"@org_mozilla_geckodriver_macos//:metadata",
|
|
],
|
|
"@io_bazel_rules_webtesting//common/conditions:windows": [],
|
|
}),
|
|
)
|
|
|
|
# Make source files available for distribution via pkg_npm
|
|
filegroup(
|
|
name = "files",
|
|
srcs = glob(["*"]),
|
|
)
|