Skip to content

Commit 137aa9f

Browse files
authored
Merge pull request kubernetes#76815 from fejta/bzl
Add --config=remote and --config=remote-cache modes for bazel
2 parents 0f617a3 + 8f1d45f commit 137aa9f

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

build/root/.bazelrc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,32 @@ build:cross:linux_arm --config=repo_infra_crosstool --platforms=@io_bazel_rules_
3939
build:cross:linux_arm64 --config=repo_infra_crosstool --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 --cpu=arm64
4040
build:cross:linux_ppc64le --config=repo_infra_crosstool --platforms=@io_bazel_rules_go//go/toolchain:linux_ppc64le --cpu=ppc64le
4141
build:cross:linux_s390x --config=repo_infra_crosstool --platforms=@io_bazel_rules_go//go/toolchain:linux_s390x --cpu=s390x
42+
43+
# --config=remote-cache enables a remote bazel cache
44+
# Note needs a --remote_instance_name=projects/PROJ/instances/default_instance flag
45+
build:remote-cache --remote_cache=remotebuildexecution.googleapis.com
46+
build:remote-cache --tls_enabled=true
47+
build:remote-cache --remote_timeout=3600
48+
build:remote-cache --auth_enabled=true
49+
50+
# --config=remote adds remote execution to the --config=remote-cache
51+
# Note needs a --remote_instance_name=projects/PROJ/instances/default_instance flag
52+
build:remote --config=remote-cache
53+
build:remote --remote_executor=remotebuildexecution.googleapis.com
54+
build:remote --jobs=500
55+
build:remote --host_javabase=@rbe_default//java:jdk
56+
build:remote --javabase=@rbe_default//java:jdk
57+
build:remote --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
58+
build:remote --java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
59+
build:remote --crosstool_top=@rbe_default//cc:toolchain
60+
build:remote --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
61+
build:remote --extra_toolchains=@rbe_default//config:cc-toolchain
62+
build:remote --extra_execution_platforms=:rbe_with_network
63+
build:remote --host_platform=:rbe_with_network
64+
build:remote --platforms=:rbe_with_network
65+
build:remote --spawn_strategy=remote
66+
build:remote --strategy=Javac=remote
67+
build:remote --strategy=Closure=remote
68+
build:remote --strategy=Genrule=remote
69+
build:remote --define=EXECUTOR=remote
70+

build/root/BUILD.root

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,15 @@ genrule(
106106
cmd = "grep ^STABLE_BUILD_SCM_REVISION bazel-out/stable-status.txt | awk '{print $$2}' >$@",
107107
stamp = 1,
108108
)
109+
110+
platform(
111+
name = "rbe_with_network",
112+
parents = ["@rbe_default//config:platform"],
113+
remote_execution_properties = """
114+
properties: {
115+
name: "dockerNetwork"
116+
value: "standard"
117+
}
118+
{PARENT_REMOTE_EXECUTION_PROPERTIES}
119+
""",
120+
)

build/root/WORKSPACE

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
22
load("//build:workspace_mirror.bzl", "mirror")
33

4+
http_archive(
5+
name = "bazel_toolchains",
6+
sha256 = "8d43844d1d4447be2a108834771d617a1ad2a107f1680190bfe44925e7bf530e",
7+
strip_prefix = "bazel-toolchains-4c003ad45e8a2d829ffc40e3aecfb6b8577a9406",
8+
urls = [
9+
"https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/4c003ad45e8a2d829ffc40e3aecfb6b8577a9406.tar.gz",
10+
"https://github.com/bazelbuild/bazel-toolchains/archive/4c003ad45e8a2d829ffc40e3aecfb6b8577a9406.tar.gz",
11+
],
12+
)
13+
14+
load("@bazel_toolchains//rules:rbe_repo.bzl", "rbe_autoconfig")
15+
16+
rbe_autoconfig(name = "rbe_default")
17+
418
http_archive(
519
name = "bazel_skylib",
620
sha256 = "eb5c57e4c12e68c0c20bc774bfbc60a568e800d025557bc4ea022c6479acc867",

0 commit comments

Comments
 (0)