-
Notifications
You must be signed in to change notification settings - Fork 427
/
.bazelrc
271 lines (227 loc) · 11.7 KB
/
.bazelrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# Global bazelrc file, see https://docs.bazel.build/versions/master/guide.html#bazelrc.
# Use strict action env to prevent leaks of env vars.
build --incompatible_strict_action_env
# Only pass through GH_API_KEY for stamped builds.
# This is still not ideal as it still busts the cache of stamped builds.
build:stamp --stamp
build:stamp --action_env=GH_API_KEY
# Doesn't rely on a localjdk which is default. This removes the need for a JAVA_HOME
# on the build machine and also makes JAVA builds hermetic.
build --java_runtime_version=remotejdk_11
test --java_runtime_version=remotejdk_11
# https://github.com/bazelbuild/rules_jvm_external/issues/445
common --repo_env=JAVA_HOME=../bazel_tools/jdk
build --remote_download_minimal
test --remote_download_minimal
run --remote_download_outputs=all
coverage --build_runfile_links
# Needed by rules_meta.
# Follow https://github.com/fmeum/rules_meta/issues/1#issuecomment-1255828109
# for updates.
common --incompatible_remove_rule_name_parameter=false
# Get version information into the build.
build --workspace_status_command=bazel/get_workspace_status.sh
# We only have support for python3 on the Ubuntu 20.04 image.
build --host_force_python=PY3
# Limit memory for JVM to reduce runaway usage.
startup --host_jvm_args=-Xmx1900m
# For all builds, by default, exclude tests that require root or BPF privileges.
# To run a test that was filtered out:
# bazel test //path/to:test --test_tag_filter=
# Which reset the filter to empty.
build --test_tag_filters=-requires_root,-requires_bpf,-disabled
# Sets the default Apple platform to macOS.
build --apple_platform_type=macos
# Keep debug symbols (required for go binaries).
# Unfortunately, this affects C++ with -c fastbuild too.
# Upgrading io_bazel_rules_go provides a better way to do this, but that upgrade is a tangled web.
# TODO(oazizi): Remove after upgrading io_bazel_rules_go.
build --strip=never
# Give each sandbox its own tmp directory.
# This is important for //src/stirling/utils:java_test, which otherwise creates conflicting writes
# when multiple instances are running simultaneously.
# It is also generally not a bad idea, since it improves heremeticity.
# For more context, see: https://github.com/bazelbuild/bazel/issues/3236
# We can't use this for qemu because it breaks the 9p fs. Since we can't
# remove these flags we just set them for all our configs.
test:tmp-sandbox --sandbox_tmpfs_path=/tmp
# This flag prevents rules_docker from transitioning the platform for our images.
# Since our target platform is the same as the containers we use,
# it doesn't make sense to transition, and results in duplicate builds of targets.
build --@io_bazel_rules_docker//transitions:enable=false
# This flag is equivalent to --config=linux on a linux machine, and --config=macos on a macos machine.
common --enable_platform_specific_config
# Linux specific config
# `bazel query` will try to auto-detect the toolchain without this.
common:linux --repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
# --platforms is only set on linux, because we don't have a linux cross-compiling setup on macos.
build:linux --platforms=//bazel/cc_toolchains:linux-x86_64
# Likewise, we only have cc_toolchain definitions for our linux compilers, so we only enable toolchain resolution on linux.
build:linux --incompatible_enable_cc_toolchain_resolution
build:linux --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
# Common options from clang.
build:clang-base --//bazel/cc_toolchains:compiler=clang
build:clang-base --//bazel/cc_toolchains:libc_version=glibc_host
# We build our own chroot for the sysroot tests, which doesn't work well under bazel's sandbox.
build:sysroot-base --//bazel/test_runners:test_runner=sysroot_chroot
test:sysroot-base --strategy TestRunner=standalone
test:sysroot-base --run_under="bazel/test_runners/sysroot_chroot/test_runner.sh"
build:x86_64_sysroot --config=clang
build:x86_64_sysroot --//bazel/cc_toolchains:libc_version=glibc2_36
build:x86_64_sysroot --config=sysroot-base
build:aarch64_sysroot --config=clang
build:aarch64_sysroot --//bazel/cc_toolchains:libc_version=glibc2_36
build:aarch64_sysroot --platforms=//bazel/cc_toolchains:linux-aarch64
build:aarch64_sysroot --config=sysroot-base
# Increase test timeouts for qemu (don't increase the slowest ones because those are already very long).
test:aarch64_sysroot --test_timeout=180,600,1800,3600
test:aarch64_sysroot --test_env=QEMU_STRACE
test:aarch64_sysroot --test_tag_filters=-no_libcpp,-requires_root,-requires_bpf,-disabled,-requires_full_qemu_emulation
# Build for Clang using Libc++.
build:clang --config=clang-base
build:clang --//bazel:enable_libcpp
build:clang --features=libc++ --features=-libstdc++
build:clang --build_tag_filters=-no_libcpp
build:clang --test_tag_filters=-no_libcpp,-requires_root,-requires_bpf,-disabled
test:clang --config=tmp-sandbox
# Build for Clang with libstdc++:
build:clang-libstdc++ --config=clang-base
build:clang-libstdc++ --//bazel/cc_toolchains:compiler=clang
build:clang-libstdc++ --//bazel/cc_toolchains:libc_version=gnu
test:clang-libstdc++ --config=tmp-sandbox
build:qemu-bpf --config=clang-base
build:qemu-bpf --//bazel:enable_libcpp
build:qemu-bpf --features=libc++ --features=-libstdc++
build:qemu-bpf --build_tag_filters=requires_bpf,requires_root,-no_qemu,-no_libcpp
build:qemu-bpf --test_tag_filters=requires_bpf,requires_root,-no_qemu,-no_libcpp,-disabled
build:qemu-bpf --sandbox_fake_username
build:qemu-bpf --//bazel/cc_toolchains:libc_version=glibc2_36
build:qemu-bpf --//bazel/test_runners:test_runner=qemu_with_kernel
build:qemu-bpf --run_under="bazel/test_runners/qemu_with_kernel/test_runner.sh"
test:qemu-bpf --test_timeout=180,600,1800,3600
# Build for GCC.
# These are copts because they apply to both c++ and c files.
# In particular, upb is has issues with this that will hopefully be
# fixed upstream soon.
build:gcc --copt -Wno-error=sign-compare
build:gcc --copt -Wno-error=stringop-truncation
build:gcc --copt -Wno-error=maybe-uninitialized
build:gcc --build_tag_filters=-no_gcc,-qemu_interactive
build:gcc --test_tag_filters=-no_gcc,-requires_root,-requires_bpf,-disabled,-qemu_interactive
build:gcc --//bazel/cc_toolchains:compiler=gcc
# TODO(#1462): Investigate why tcmalloc breaks linking of go binaries.
build:gcc --define tcmalloc=disabled
test:gcc --config=tmp-sandbox
# bazel build --config asan ...
build:asan --config=clang
build:asan --//bazel:sanitizer=asan
build:asan --features=asan
build:asan --test_timeout="120,600,1800,3600"
build:asan --define PL_CONFIG_ASAN=1
build:asan --define tcmalloc=disabled
build:asan --build_tag_filters=-no_asan
build:asan --test_tag_filters=-no_asan,-requires_root,-requires_bpf,-disabled
build:asan --define signal_trace=disabled
build:asan --test_env=ASAN_SYMBOLIZER_PATH
build:asan --test_env=ASAN_OPTIONS=handle_abort=1:allow_addr2line=true
build:asan --test_env=UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1
build:asan --define tcmalloc=disabled
#test:asan --test_env=ASAN_OPTIONS=detect_container_overflow=0
# bazel build --config msan
build:msan --config=clang
build:msan --define PL_CONFIG_MSAN=1
build:msan --//bazel:sanitizer=msan
build:msan --define tcmalloc=disabled
build:msan --build_tag_filters=-no_msan
build:msan --test_tag_filters=-no_msan,-requires_root,-requires_bpf,-disabled
build:msan --features=msan
# bazel build --config tsan
build:tsan --config=clang
build:tsan --//bazel:sanitizer=tsan
build:tsan --define PL_CONFIG_TSAN=1
build:tsan --define tcmalloc=disabled
build:tsan --build_tag_filters=-no_tsan
build:tsan --test_tag_filters=-no_tsan,-requires_root,-requires_bpf,-disabled
build:tsan --define tcmalloc=disabled
# This is needed to address false positive problem with abseil.
# https://github.com/google/sanitizers/issues/953
build:tsan --test_env=TSAN_OPTIONS=report_atomic_races=0
build:tsan --features=tsan
test:tsan --test_timeout=180,600,1800,3600
# Note that we are lumping tests that require root into the BPF tests below
# to minimize number of configs.
# If there are ever a lot of tests with requires_root, a new config is warranted.
# See also ci/bazel_build_deps.sh
# Note 2: BPF tests are limited to --jobs=4, because otherwise the parallel tests
# cause a lot of flakiness. In particular, many of the BPF tests deploy containers,
# and the sudden deployment of too many containers causes some containers to get
# stuck for minutes without actually running.
# bazel build --config bpf
build:bpf --config=clang
build:bpf --build_tag_filters=requires_bpf,requires_root
build:bpf --test_tag_filters=requires_bpf,requires_root,-disabled
test:bpf --strategy=TestRunner=standalone
# bazel build --config bpf_asan
# Need to repeat the negative build_tag_filters from config=asan,
# because the positive build_tag_filters here can re-enable such tests.
build:bpf_asan --config=asan
build:bpf_asan --build_tag_filters=requires_bpf,requires_root,-no_asan
build:bpf_asan --test_tag_filters=requires_bpf,requires_root,-no_asan,-disabled
test:bpf_asan --jobs=4 --strategy=TestRunner=standalone
# bazel build --config bpf_tsan
# Need to repeat the negative build_tag_filters from config=tsan,
# because the positive build_tag_filters here can re-enable such tests.
build:bpf_tsan --config=tsan
build:bpf_tsan --build_tag_filters=requires_bpf,requires_root,-no_tsan
build:bpf_tsan --test_tag_filters=requires_bpf,requires_root,-no_tsan,-disabled
test:bpf_tsan --jobs=4 --strategy=TestRunner=standalone
# bazel build --config go_race
build:go_race --config=clang
build:go_race --define tcmalloc=disabled
build:go_race --@io_bazel_rules_go//go/config:race
test:go_race --define tcmalloc=disabled
test:go_race --@io_bazel_rules_go//go/config:race
run:go_race --define tcmalloc=disabled
run:go_race --@io_bazel_rules_go//go/config:race
coverage --config=gcc
coverage --cxxopt -fprofile-arcs
coverage --cxxopt -ftest-coverage
coverage --instrument_test_targets
coverage --define PL_COVERAGE=true
coverage --copt -DPL_COVERAGE
coverage --test_tag_filters=-requires_root,-requires_bpf,-no_coverage,-disabled,-no_gcc
coverage --action_env=COVERAGE_GCOV_OPTIONS=-b
try-import %workspace%/bes.bazelrc
# jenkins.bazelrc is copied from ci/jenkins.bazelrc by Jenkins workers during the build.
# The intention is to avoid polluting configurations of bazel for developers.
try-import %workspace%/jenkins.bazelrc
# github.bazelrc is copied from ci/github/bazelrc by the github action workers during the build.
try-import %workspace%/github.bazelrc
# Import a machine specific bazelrc. This can be used to enable caching.
try-import /etc/bazelrc
# Put your own configurations into user.bazelrc, which is ignored by git.
try-import %workspace%/user.bazelrc
# Tensorflow requires this option
common --experimental_repo_remote_exec
# Try Stirling flakes more than the default 3 times.
test --flaky_test_attempts=//src/stirling/source_connectors/socket_tracer/.*bpf_test@5
# Disable XNNPACK for tensorflow lite. There's currently an ASAN issue with XNNPACK, so disable for now.
build --define=tflite_with_xnnpack=false
build:remote --remote_executor=grpcs://remote.buildbuddy.io
build:remote --host_platform=//bazel:remote_exec_platform
build:remote --extra_execution_platforms=//bazel:remote_exec_platform
build:remote --bes_results_url=https://app.buildbuddy.io/invocation/
build:remote --bes_backend=grpcs://remote.buildbuddy.io
build:remote --remote_cache=grpcs://remote.buildbuddy.io
build:remote --experimental_remote_downloader=grpcs://remote.buildbuddy.io
build:remote --remote_timeout=1h
build:remote --remote_retries=5
build:remote --spawn_strategy=remote,local
build:remote --experimental_remote_cache_compression
build:remote --jobs=100
test:remote --jobs=100
build:remote --nolegacy_important_outputs
build:remote --build_metadata=VISIBILITY=PUBLIC
coverage:remote --strategy=CoverageReport=local,remote
coverage:remote --experimental_fetch_all_coverage_outputs
coverage:remote --experimental_split_coverage_postprocessing