-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathshared.bazelrc
More file actions
401 lines (328 loc) · 17.7 KB
/
shared.bazelrc
File metadata and controls
401 lines (328 loc) · 17.7 KB
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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
#################
# STARTUP FLAGS #
#################
# Use BLAKE3 digest function.
startup --digest_function=BLAKE3
# Bazel doesn't track the contents of source directories by default, which can result
# in non-hermeticity.
startup --host_jvm_args=-DBAZEL_TRACK_SOURCE_DIRECTORIES=1
################
# COMMON FLAGS #
################
# Use a mirror for all source archives referenced by the BCR to protect against checksum changes and upstream outages.
common --module_mirrors=https://bcr.cloudflaremirrors.com
# Avoid being broken by version requirement changes in transitive deps.
common --check_direct_dependencies=error
# Enable proto toolchain resolution to use pre-built protoc.
common --incompatible_enable_proto_toolchain_resolution
common --@com_google_protobuf//bazel/toolchains:prefer_prebuilt_protoc
# Sanitize environment variables to avoid cache misses.
common --incompatible_strict_action_env
# Write build outputs in a platform-specific directory,
# avoid outputs being wiped and rewritten when switching between platforms.
common --experimental_platform_in_output_dir
# TODO(tyler-french): Remove once toolchains_musl is updated to load cc symbols explicitly.
# See https://github.com/bazel-contrib/musl-toolchain/pull/65
common --incompatible_autoload_externally=+cc_common,+CcToolchainConfigInfo,+cc_toolchain
# Workaround for Bazel 7,8:
# rules_docker (archived) defines a transition that helps ensure building containers with binary would use the same platform for both.
# Reference: https://github.com/bazelbuild/rules_docker/pull/1963
#
# However, the platform and transition made use of `label_setting` instead of `constraint_value`.
# This used to work in Bazel 6, but Bazel 7 introduced a new mandatory provider `ConstraintValueInfo` for all constraints_value targets.
# Since `label_setting` does not return this provider, it is no longer possible to use `label_setting` in Bazel 7.
#
# Disabling this is safe because today, we are building these constainers on Linux host, executing Linux actions and targeting Linux machines.
# This assumption might not hold in the future, but we can revisit this when that happens.
common --@io_bazel_rules_docker//transitions:enable=false
# Currently only works for go tests
# Coverage outputs could be viewed with `genhtml`:
# $ genhtml -o cover bazel-out/_coverage/_coverage_report.dat
# $ open cover/index.html
common --combined_report=lcov
# Include target names in timing profile so it's clickable.
common --experimental_profile_include_target_label
# Include primary output name in timing profile.
common --experimental_profile_include_primary_output
# Don't merge timing profile actions.
common --noslim_profile
# Include compact execution log
# TODO(sluongng): make Bazel writes this to output_base automatically
common --execution_log_compact_file=%workspace%/bazel_compact_exec_log.binpb.zst
# Disable https://github.com/aspect-build/tools_telemetry.
common --repo_env=DO_NOT_TRACK=1
#############################
# TESTING/DEVELOPMENT FLAGS #
#############################
# Use tsconfig.json for skipLibCheck setting.
common --@aspect_rules_ts//ts:skipLibCheck=honor_tsconfig
# Add `-test.v` to all Go tests so that each test func is reported as a separate test case
# in the XML output. This allows our webUI to display the run time of each test case
# separately and let us know which tests is slow.
common --test_env=GO_TEST_WRAP_TESTV=1
# In rules_go v0.50.0, nogo static analysis was moved from GoCompilePkg to a couple of
# actions: RunNogo and ValidateNogo. Among these, ValidateNogo is a validation action*.
# When the validation runs on top of the go_test binary, it will prevent the test
# execution (TestRunner) until the validation is success.
#
# This flag will run the validation action as an aspect, which will not block the test
# execution.
#
# *: https://bazel.build/extending/rules#validation_actions
common --experimental_use_validation_aspect=true
# Don't show cached test results in the test summary
# We have many tests that can fill up the console with cached results.
# If you prefer to see cached results, set this to 'short' in user.bazelrc file.
common --test_summary=terse
common --downloader_config=bazel_downloader.cfg
common:race --@io_bazel_rules_go//go/config:race
common:race --test_timeout=120,600,-1,-1
common:performance --compilation_mode=opt
# Configurations used to debug flaky tests
common:quarantine --config=remote-minimal
common:quarantine --config=race
common:quarantine --test_env=RUN_QUARANTINED_TESTS=true
# Configuration used to deflake tests
common:deflake --config=quarantine
common:deflake --runs_per_test=100
common:deflake --test_runner_fail_fast
common:deflake --notest_keep_going
# Run Webdriver tests with --config=webdriver-debug to debug webdriver tests locally.
# See server/testutil/webtester/webtester.go for more details.
common:webdriver-debug --test_arg=-webdriver_headless=false
common:webdriver-debug --test_arg=-webdriver_end_of_test_delay=3s
# Forward X server display for local webdriver tests.
common:webdriver-debug --test_env=DISPLAY
# When debugging, only run one webdriver test at a time (it's overwhelming
# otherwise).
common:webdriver-debug --local_test_jobs=1
###################################
# PLATFORM-SPECIFIC CONFIGURATION #
###################################
# Enable special "macos", "linux" and "windows" config that are automatically applied
# based on the host machine.
common --enable_platform_specific_config=true
# rules_nodejs needs runfiles to be explicitly enabled.
common:linux --enable_runfiles
common:macos --enable_runfiles
# Allow disk/remote cache hits across different Bazel configurations for supported actions (e.g. GoCompilePkg).
# Requires a sandboxed execution strategy and is thus not enabled on Windows.
# https://github.com/bazelbuild/bazel/discussions/22658
common:linux --experimental_output_paths=strip
common:macos --experimental_output_paths=strip
# Use C++17 standard for all C++ compilation
common:linux --host_cxxopt=-std=c++17
common:linux --cxxopt=-std=c++17
common:macos --host_cxxopt=-std=c++17
common:macos --cxxopt=-std=c++17
common:windows --host_cxxopt=/std:c++17
common:windows --cxxopt=/std:c++17
# Suppress compiler warnings from external Redis C sources.
common:linux --per_file_copt=external/redis\\+/.*@-w
common:macos --per_file_copt=external/redis\\+/.*@-w
# Populate workspace info like commit sha and repo name to your invocation.
common:linux --workspace_status_command=$(pwd)/workspace_status.sh
common:macos --workspace_status_command=$(pwd)/workspace_status.sh
common:windows --workspace_status_command="bash workspace_status.sh"
# XCode flags
common:macos --action_env=DEVELOPER_DIR
common:macos --host_action_env=DEVELOPER_DIR
# Ensure that we don't use the apple_support cc_toolchain
common:macos --repo_env=BAZEL_NO_APPLE_CPP_TOOLCHAIN=1
# Ensure that our executors can run on macOS 11.0+
common:macos --macos_minimum_os=12.0
common:macos --host_macos_minimum_os=12.0
# Silence noise about -lm -lm which has no functional downside
#
# TODO(sluongng): Note that adding linkopt here will break --config=remote since
# we will use Linux exec and target under that config. We should find a better way
# to add this flag into the toolchain level.
# common:macos --linkopt=-Wl,-no_warn_duplicate_libraries
# common:macos --host_linkopt=-Wl,-no_warn_duplicate_libraries
########################
# BES + CACHE + REMOTE #
########################
common:anon-bes --bes_results_url=https://app.buildbuddy.io/invocation/
common:anon-bes --bes_backend=grpcs://remote.buildbuddy.io
common:authed-bes --bes_results_url=https://buildbuddy.buildbuddy.io/invocation/
common:authed-bes --bes_backend=grpcs://buildbuddy.buildbuddy.io
# Build with --config=local to send build logs to your local server
common:local --bes_results_url=http://localhost:8080/invocation/
common:local --bes_backend=grpc://localhost:1985
common:local --remote_cache=grpc://localhost:1985
common:local --config=cache-shared
# Build with --config=local-rbe-linux to target a local linux executor, using
# BuildBuddy's RBE container image (x86_64 only for now). For this to work, the
# local executor must have an isolation type enabled which supports
# containerized execution, such as docker (the default), podman, or oci.
common:local-rbe-linux --remote_executor=grpc://localhost:1985
common:local-rbe-linux --config=target-linux-x86
common:local-rbe-linux --config=local
# Build with --config=local-rbe-mac to target a local executor on macOS.
common:local-rbe-mac --remote_executor=grpc://localhost:1985
common:local-rbe-mac --config=target-darwin-arm64
common:local-rbe-mac --config=local
# Build with --config=dev to send build logs to the dev server
common:dev --bes_results_url=https://buildbuddy.buildbuddy.dev/invocation/
common:dev --bes_backend=grpcs://buildbuddy.buildbuddy.dev
# Common flags to be used with remote cache
common:cache-shared --remote_cache_compression
common:cache-shared --experimental_remote_cache_compression_threshold=100
common:cache-shared --remote_timeout=10m
common:cache-dev --config=cache-shared
common:cache-dev --config=dev
common:cache-dev --remote_cache=grpcs://buildbuddy.buildbuddy.dev
# Build with --config=cache to use prod cache.
common:cache --config=cache-shared
common:cache --remote_cache=grpcs://buildbuddy.buildbuddy.io
# Target+Exec Platforms configuration
common:target-darwin-arm64 --platforms=@toolchains_buildbuddy//platforms:darwin_arm64
common:target-darwin-arm64 --extra_execution_platforms=@toolchains_buildbuddy//platforms:darwin_arm64
common:target-linux-x86 --platforms=@toolchains_buildbuddy//platforms:linux_x86_64
common:target-linux-x86 --extra_execution_platforms=@toolchains_buildbuddy//platforms:linux_x86_64
common:target-linux-arm64 --platforms=@toolchains_buildbuddy//platforms:linux_arm64
common:target-linux-arm64 --extra_execution_platforms=@toolchains_buildbuddy//platforms:linux_arm64
common:download-minimal --remote_download_minimal
# Flags shared across remote configs
common:remote-shared --config=cache-shared
common:remote-shared --jobs=100
common:remote-shared --verbose_failures
# Flags shared for prod RBE and cache
common:remote-prod-shared --config=remote-shared
common:remote-prod-shared --remote_executor=grpcs://buildbuddy.buildbuddy.io
# Tests tagged with "docker" or "bare" can be run if using authenticated RBE,
# but performance tests should not be run remotely since the environment
# is not consistent or stable.
common:remote-prod-shared --test_tag_filters=-performance
# Flags shared for dev BES, RBE and cache
# Note: Dev BES needed to override the default prod BES urls.
common:remote-dev-shared --config=dev
common:remote-dev-shared --config=remote-shared
common:remote-dev-shared --remote_executor=grpcs://buildbuddy.buildbuddy.dev
# Tests tagged with "docker" or "bare" can be run if using authenticated RBE,
# but performance tests should not be run remotely since the environment
# is not consistent or stable.
common:remote-dev-shared --test_tag_filters=-performance
# Build with --config=remote to use BuildBuddy RBE, generally as a human from
# the command line. Other configs shoudn't embed this.
common:remote --config=remote-prod-shared
common:remote --config=target-linux-x86
common:remote --remote_download_toplevel
# Build with --config=remote-dev to use BuildBuddy RBE.
common:remote-dev --config=remote-dev-shared
common:remote-dev --config=target-linux-x86
common:remote-dev --remote_download_toplevel
# Build with --config=remote-minimal to use BuildBuddy RBE in automated
# processes, (probers, workflows, ci, etc.) where the outputs shouldn't be
# downloaded.
common:remote-minimal --config=remote-prod-shared
common:remote-minimal --config=target-linux-x86
common:remote-minimal --config=download-minimal
common:remote-dev-minimal --config=remote-dev-shared
common:remote-dev-minimal --config=target-linux-x86
common:remote-dev-minimal --config=download-minimal
# Specify arch to do cross-platform builds on remote until the go toolchain can
# accomodate multiple execution platforms
common:remote-linux-arm64 --config=remote-prod-shared
common:remote-linux-arm64 --config=target-linux-arm64
common:remote-linux-arm64 --remote_download_toplevel
# Specify arch to do cross-platform builds on remote-dev
common:remote-dev-linux-arm64 --config=remote-dev-shared
common:remote-dev-linux-arm64 --config=target-linux-arm64
common:remote-dev-linux-arm64 --remote_download_toplevel
#######################
# SPECIALIZED CONFIGS #
#######################
# Flags shared across prober configs
common:probers-shared --config=remote-shared
common:probers-shared --config=target-linux-x86
common:probers-shared --config=download-minimal
common:probers-shared --config=cache-shared
# Build with --config=probers to use BuildBuddy RBE in the probers org.
common:probers --config=probers-shared
common:probers --bes_results_url=https://buildbuddy-probers-us-west1.buildbuddy.io/invocation/
common:probers --bes_backend=grpcs://buildbuddy-probers-us-west1.remote.buildbuddy.io
common:probers --remote_cache=grpcs://buildbuddy-probers-us-west1.remote.buildbuddy.io
common:probers --remote_executor=grpcs://buildbuddy-probers-us-west1.remote.buildbuddy.io
# Build with --config=probers-dev to use BuildBuddy RBE in the probers org.
common:probers-dev --config=probers-shared
common:probers-dev --bes_results_url=https://buildbuddy-probers.buildbuddy.dev/invocation/
common:probers-dev --bes_backend=grpcs://buildbuddy-probers.buildbuddy.dev
common:probers-dev --remote_cache=grpcs://buildbuddy-probers.buildbuddy.dev
common:probers-dev --remote_executor=grpcs://buildbuddy-probers.buildbuddy.dev
# Configuration used for Buildbuddy auto-release probers
common:auto-release --config=probers
common:auto-release --remote_instance_name=buildbuddy-io/buildbuddy/auto-release
common:auto-release --compilation_mode=opt
common:auto-release --@io_bazel_rules_go//go/config:pgoprofile=enterprise/tools/pgo:prod.pprof
# Configuration used for all builds of artifacts released to GitHub
common:release-shared --compilation_mode=opt
common:release-shared --stamp
common:release-shared --define=release=true
common:release-shared --strip=always
# Configuration used for Linux releases
common:release --config=release-shared
common:release --repository_cache=~/repo-cache/
common:release --remote_instance_name=buildbuddy-io/buildbuddy/release
# Configuration used for release-mac workflow
common:release-mac --config=release-shared
common:release-mac --repository_cache=~/repo-cache/
# Configuration used for release-m1 workflow
common:release-m1 --config=release-shared
# Configuration used for release-windows workflow
common:release-windows --config=cache
common:release-windows --config=release-shared
common:release-windows --repository_cache=C:/bazel/repo-cache/
common:release-windows --remote_instance_name=buildbuddy-io/buildbuddy/release-windows-25
# Common flags for Github Actions and BuildBuddy Workflows setup
# Note that the actual Remote endpoint is not included here.
common:ci-shared --config=cache-shared
common:ci-shared --config=download-minimal
# common:ci-shared --config=race
common:ci-shared --build_metadata=ROLE=CI
common:ci-shared --flaky_test_attempts=2
common:ci-shared --repository_cache=~/repo-cache/
common:ci-shared --color=yes
# Configuration used for untrusted GitHub actions-based CI
common:untrusted-ci --config=ci-shared
common:untrusted-ci --config=remote-minimal
common:untrusted-ci --remote_instance_name=buildbuddy-io/buildbuddy/untrusted-ci
common:untrusted-ci --remote_executor=grpcs://remote.buildbuddy.io
common:untrusted-ci --bes_results_url=https://app.buildbuddy.io/invocation/
common:untrusted-ci --bes_backend=grpcs://remote.buildbuddy.io
common:untrusted-ci --remote_cache=grpcs://remote.buildbuddy.io
# TODO(vanja) turn on once https://github.com/buildbuddy-io/buildbuddy-internal/issues/6247 is fixed
# common:untrusted-ci --remote_header=x-buildbuddy-platform.enable-vfs=true
# Disabled RBE for Windows
common:untrusted-ci-windows --config=ci-shared
common:untrusted-ci-windows --remote_instance_name=buildbuddy-io/buildbuddy/untrusted-ci-windows-25
common:untrusted-ci-windows --repository_cache=C:/bazel/repo-cache/
common:untrusted-ci-windows --bes_results_url=https://app.buildbuddy.io/invocation/
common:untrusted-ci-windows --bes_backend=grpcs://remote.buildbuddy.io
common:untrusted-ci-windows --remote_cache=grpcs://remote.buildbuddy.io
# Use BuildBuddy endpoints from the ci_runner-generated bazelrc.
# These will point to local, dev, or prod, depending on which app created the workflow action.
common:workflows --config=buildbuddy_bes_backend
common:workflows --config=buildbuddy_bes_results_url
common:workflows --config=buildbuddy_remote_cache
common:workflows --config=buildbuddy_experimental_remote_downloader
# Explicitly disable repository cache for BuildBuddy Workflows.
# This helps reduce disk space usage in the Firecracker, thus reduce the VM snapshot size.
# Rely on remote downloader to cache downloads through Remote Asset API instead.
common:workflows --repository_cache=
# Configuration used for Linux workflows
common:linux-workflows --config=remote-shared
common:linux-workflows --config=target-linux-x86
common:linux-workflows --config=workflows
common:linux-workflows --config=buildbuddy_remote_executor
common:linux-workflows --build_metadata=TAGS=linux-workflow
# TODO(vanja) turn on once https://github.com/buildbuddy-io/buildbuddy-internal/issues/6247 is fixed
# common:linux-workflows --remote_header=x-buildbuddy-platform.enable-vfs=true
# Configuration used for Mac workflows
# TODO(bduffany): Enable RBE for Mac workflows, and reconcile this with other configs
common:mac-workflows --config=cache
common:mac-workflows --config=workflows
common:mac-workflows --build_metadata=TAGS=mac-workflow
# Build fully static binaries linked against musl on Linux.
common:static --platforms=//platforms:linux_x86_64_musl
common:static-arm64 --platforms=//platforms:linux_arm64_musl