-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an experimental remote build execution config based on Angular's (#…
…6576) Add an experimental remote build execution config to run highly parallel builds on remote machines. Currently, only Linux is supported. Adding --config=rbe to any Bazel command (or any yarn command that uses Bazel) will make the build execute remotely. Note that this is only enabled for members of the TFJS team.
- Loading branch information
1 parent
70be562
commit 6c9ec9f
Showing
9 changed files
with
149 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
platform( | ||
name = "platform", | ||
constraint_values = [ | ||
"@bazel_tools//platforms:linux", | ||
"@bazel_tools//platforms:x86_64", | ||
"@bazel_tools//tools/cpp:clang", | ||
], | ||
exec_properties = { | ||
# We use the same docker image for remote builds as we use for CI testing. | ||
"container-image": "docker://gcr.io/learnjs-174218/release@sha256:d85abab6146eaf1e01312bdb9e353a5efa0508b913dccf30fc5e505d009026ff", | ||
# By default in Google Cloud Remote build execution, network access is disabled. We explicitly set the | ||
# property in the platform again in case the default ever changes. Network access is not desirable in | ||
# Bazel builds as it is potential source of flaky tests and therefore also breaks hermeticity. | ||
"dockerNetwork": "off", | ||
}, | ||
) | ||
|
||
platform( | ||
name = "platform_with_network", | ||
exec_properties = { | ||
# By default we have network access disabled with the `:platform` target. This is an | ||
# additional platform that extends from the default one but enables network access. | ||
# Network is generally not recommended, but for some exceptions, like integration tests | ||
# running a Yarn install, network access is reasonable. In such special cases, Bazel can | ||
# be invoked to run with this platform. It is recommended that exec platforms with network | ||
# access are used in combination with `--sandbox_default_allow_network=false` as this allows | ||
# specific targets to be granted network access, while others will not have access. | ||
"dockerNetwork": "standard", | ||
}, | ||
parents = [":platform"], | ||
) | ||
|
||
filegroup( | ||
name = "files", | ||
srcs = [ | ||
"BUILD.bazel", | ||
"@npm//@angular/dev-infra-private/bazel/remote-execution/cpp:files", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
load("@bazel_tools//tools/cpp:cc_toolchain_config.bzl", "cc_toolchain_config") | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
filegroup( | ||
name = "files", | ||
srcs = ["BUILD.bazel"], | ||
) | ||
|
||
cc_toolchain_suite( | ||
name = "cc_toolchain_suite", | ||
tags = ["manual"], | ||
toolchains = { | ||
"k8": ":cc_compiler_k8", | ||
}, | ||
) | ||
|
||
toolchain( | ||
name = "cc_toolchain", | ||
exec_compatible_with = [ | ||
"@bazel_tools//platforms:linux", | ||
"@bazel_tools//platforms:x86_64", | ||
"@bazel_tools//tools/cpp:clang", | ||
], | ||
target_compatible_with = [ | ||
"@bazel_tools//platforms:linux", | ||
"@bazel_tools//platforms:x86_64", | ||
], | ||
toolchain = ":cc_compiler_k8", | ||
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", | ||
) | ||
|
||
# Basic CC toolchain for k8 remote containers. Based on the default k8 | ||
# toolchain provided in Bazel (but unfortunately internal). | ||
# https://github.com/bazelbuild/bazel/blob/c951753097b45cfb9be512c02199aa891b9646b8/tools/cpp/BUILD.tools#L298-L311 | ||
cc_toolchain( | ||
name = "cc_compiler_k8", | ||
all_files = ":empty", | ||
ar_files = ":empty", | ||
as_files = ":empty", | ||
compiler_files = ":empty", | ||
dwp_files = ":empty", | ||
linker_files = ":empty", | ||
objcopy_files = ":empty", | ||
strip_files = ":empty", | ||
supports_param_files = 1, | ||
toolchain_config = ":k8_toolchain_config", | ||
toolchain_identifier = "cc-k8-compiler", | ||
) | ||
|
||
cc_toolchain_config( | ||
name = "k8_toolchain_config", | ||
compiler = "compiler", | ||
cpu = "local", | ||
) | ||
|
||
# Empty filegroup used for defining the CC toolchain. | ||
filegroup(name = "empty") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,4 +39,5 @@ genrule( | |
exec_tools = [ | ||
"//tfjs-tflite/scripts:download_tflite_web_api", | ||
], | ||
tags = ["no-remote-exec"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters