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
31 lines
956 B
Python
31 lines
956 B
Python
load("@io_bazel_rules_webtesting//web:web.bzl", "browser")
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
browser(
|
|
name = "chromium",
|
|
metadata = "chromium.json",
|
|
deps = [
|
|
"@io_bazel_rules_webtesting//go/wsl",
|
|
] + select({
|
|
"@io_bazel_rules_webtesting//common/conditions:linux": [
|
|
"@org_chromium_chromedriver_amd64//:metadata",
|
|
"@org_chromium_chromium_amd64//:metadata",
|
|
],
|
|
"@io_bazel_rules_webtesting//common/conditions:mac": [
|
|
"@org_chromium_chromedriver_macos//:metadata",
|
|
"@org_chromium_chromium_macos//:metadata",
|
|
],
|
|
"@io_bazel_rules_webtesting//common/conditions:windows": [
|
|
"@org_chromium_chromedriver_windows//:metadata",
|
|
"@org_chromium_chromium_windows//:metadata",
|
|
],
|
|
}),
|
|
)
|
|
|
|
# Make source files available for distribution via pkg_npm
|
|
filegroup(
|
|
name = "files",
|
|
srcs = glob(["*"]),
|
|
)
|