Skip to content

Commit 382b1b7

Browse files
authored
build: use platform from shared dev-infra package for remote execution (#22555)
Uses the new shared RBE platform from the dev-infra package. We introduced a shared Bazel platform for remote execution builds using Google cloud. Previously we used `bazel_toolchains` for providing the platform w/ additional CPP and Java toolchains `bazel_toolchains` no longer provides default toolchains with the latest version, but provides a tool (linux and windows only) for generating toolchain/platforms, which then need to be checked into the repository. This is quite inconvenient and cumbersome (especially with no macOS support), so we just provided our own platform and CPP toolchain within `//dev-infra`. This is more simple than all the effort we'd need to make the toolchain generation tool work (while it would also increase the amount of checked-in sources significantly; with more unused toolchains for CPP or Java) See: angular/angular#41767.
1 parent dda2e0f commit 382b1b7

File tree

6 files changed

+89
-353
lines changed

6 files changed

+89
-353
lines changed

.bazelrc

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,8 @@ build:remote --project_id=internal-200822
7171
# Needed due to: https://github.com/bazelbuild/bazel/issues/7254
7272
build:remote --define=EXECUTOR=remote
7373

74-
# For remote execution, we use the `ubuntu16_04_clang` toolchain configurations. These only
75-
# support `k8` or `armeabi-v7a`. Since we run on remotely with `k8` containers, we need to
76-
# ensure that the proper CPU is configured so that the correct toolchain can be used.
77-
# https://github.com/bazelbuild/bazel-toolchains/blob/master/configs/ubuntu16_04_clang/10.0.0/bazel_2.1.0/cc/BUILD#L50
74+
# Since remote builds run within Google Cloud `k8`-based containers, we set the
75+
# host and target CPU accordingly.
7876
build:remote --cpu=k8
7977
build:remote --host_cpu=k8
8078

@@ -84,16 +82,12 @@ build:remote --remote_executor=remotebuildexecution.googleapis.com
8482
build:remote --auth_enabled=true
8583

8684
# Setup the toolchain and platform for the remote build execution. The platform
87-
# is automatically configured by the "rbe_autoconfig" rule in the project workpsace.
88-
build:remote --crosstool_top=@rbe_default//cc:toolchain
89-
build:remote --host_javabase=@rbe_default//java:jdk
90-
build:remote --javabase=@rbe_default//java:jdk
91-
build:remote --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
92-
build:remote --java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
93-
build:remote --extra_execution_platforms=//tools:rbe_platform
94-
build:remote --host_platform=//tools:rbe_platform
95-
build:remote --platforms=//tools:rbe_platform
96-
build:remote --extra_toolchains=@rbe_default//config:cc-toolchain
85+
# is provided by the shared dev-infra package and targets k8 remote containers.
86+
build:remote --crosstool_top=@npm//@angular/dev-infra-private/bazel/remote-execution/cpp:cc_toolchain_suite
87+
build:remote --extra_toolchains=@npm//@angular/dev-infra-private/bazel/remote-execution/cpp:cc_toolchain
88+
build:remote --extra_execution_platforms=@npm//@angular/dev-infra-private/bazel/remote-execution:platform
89+
build:remote --host_platform=@npm//@angular/dev-infra-private/bazel/remote-execution:platform
90+
build:remote --platforms=@npm//@angular/dev-infra-private/bazel/remote-execution:platform
9791

9892
################################
9993
# --config=build-results #

WORKSPACE

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -66,42 +66,6 @@ load("@io_bazel_rules_sass//:defs.bzl", "sass_repositories")
6666

6767
sass_repositories()
6868

69-
# Bring in bazel_toolchains for RBE setup configuration.
70-
http_archive(
71-
name = "bazel_toolchains",
72-
# Patch `bazel-toolchains` to always consider the host platform as Linux. This is necessary
73-
# because the RBE configurations are incorrectly based on the host platform and this breaks
74-
# cross-platform remote execution. e.g. using RBE on macOS.
75-
# See: https://github.com/bazelbuild/bazel-toolchains/issues/895
76-
patches = ["//tools:rbe_cross_platform_workaround.patch"],
77-
sha256 = "1adf5db506a7e3c465a26988514cfc3971af6d5b3c2218925cd6e71ee443fc3f",
78-
strip_prefix = "bazel-toolchains-4.0.0",
79-
urls = [
80-
"https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/releases/download/4.0.0/bazel-toolchains-4.0.0.tar.gz",
81-
"https://github.com/bazelbuild/bazel-toolchains/releases/download/4.0.0/bazel-toolchains-4.0.0.tar.gz",
82-
],
83-
)
84-
85-
load("@bazel_toolchains//repositories:repositories.bzl", bazel_toolchains_repositories = "repositories")
86-
87-
bazel_toolchains_repositories()
88-
89-
load("@bazel_toolchains//rules:rbe_repo.bzl", "rbe_autoconfig")
90-
91-
rbe_autoconfig(
92-
name = "rbe_default",
93-
# Need to specify a base container digest in order to ensure that we can use the checked-in
94-
# platform configurations for the "ubuntu16_04" image. Otherwise the autoconfig rule would
95-
# need to pull the image and run it in order determine the toolchain configuration.
96-
# See: https://github.com/bazelbuild/bazel-toolchains/blob/master/configs/ubuntu16_04_clang/versions.bzl#L9
97-
base_container_digest = "sha256:f6568d8168b14aafd1b707019927a63c2d37113a03bcee188218f99bd0327ea1",
98-
digest = "sha256:dddaaddbe07a61c2517f9b08c4977fc23c4968fcb6c0b8b5971e955d2de7a961",
99-
registry = "marketplace.gcr.io",
100-
# We can't use the default "ubuntu16_04" RBE image provided by the autoconfig because we need
101-
# a specific Linux kernel that comes with "libx11" in order to run headless browser tests.
102-
repository = "google/rbe-ubuntu16-04-webtest",
103-
)
104-
10569
# Load pinned rules_webtesting browser versions for tests.
10670
#
10771
# TODO(wagnermaciel): deduplicate browsers - this will load another version of chromium in the

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
"@angular-devkit/schematics": "^12.0.0-rc.0",
7777
"@angular/bazel": "^12.0.0-rc.0",
7878
"@angular/compiler-cli": "^12.0.0-rc.0",
79-
"@angular/dev-infra-private": "https://github.com/angular/dev-infra-private-builds.git#3953ba9eea35a2660b6068523bafb92634042be9",
79+
"@angular/dev-infra-private": "https://github.com/angular/dev-infra-private-builds.git#2e0271af93b020a811323fbc274afcf588dbc91e",
8080
"@angular/platform-browser-dynamic": "^12.0.0-rc.0",
8181
"@angular/platform-server": "^12.0.0-rc.0",
8282
"@angular/router": "^12.0.0-rc.0",

tools/BUILD.bazel

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,8 @@ package(default_visibility = ["//visibility:public"])
33
exports_files([
44
"system-config-tmpl.js",
55
"system-rxjs-operators.js",
6-
"rbe_cross_platform_workaround.patch",
76
])
87

9-
# Workaround for https://github.com/bazelbuild/bazel-toolchains/issues/356. We need the
10-
# "SYS_ADMIN" capability in order to run browsers with sandbox enabled.
11-
platform(
12-
name = "rbe_platform",
13-
parents = ["@rbe_default//config:platform"],
14-
remote_execution_properties = """
15-
{PARENT_REMOTE_EXECUTION_PROPERTIES}
16-
properties: {
17-
name: "dockerAddCapabilities"
18-
value: "SYS_ADMIN"
19-
}
20-
""",
21-
)
22-
238
config_setting(
249
name = "view_engine_mode",
2510
values = {

tools/rbe_cross_platform_workaround.patch

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)