-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.bazelrc
223 lines (175 loc) · 9.92 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
# Load dynamic configuration generated by tools/bazel, if present.
try-import /tmp/gocode-bazel/laptop_config.bazelrc
try-import /tmp/gocode-bazel/dynamic_config.bazelrc
# Allow OS-specific flag overrides in this file
common --enable_platform_specific_config
# Define some values, so that we can use `config_setting` in various BUILD.bazel
# files in order to detect if we're executing a "bazel coverage" command.
#
# More details on matching various config setting(s) can be found at:
# https://docs.bazel.build/versions/main/be/general.html#config_setting
coverage --define BAZEL_COVERAGE=true
# Use the go_cover coverage format instead of lcov.
# See bin/gocoverage for use sites.
coverage --@io_bazel_rules_go//go/config:cover_format=go_cover
# We have a specific build setting for core/buildinfo; disable it in tests as
# well. This is distinct because we also use Bazel transitions to disable it
# for specific targets in the build; see core/buildinfo/defs.bzl for more
# information.
test:ci --//core/buildinfo:stamp=false
# Enable remote-downloader for laptops.
common:laptop --experimental_remote_downloader=grpc://remotebuild-downloader.northwest.corp.stripe.com
common:laptop --remote_cache=grpc://remotebuild-storage.northwest.corp.stripe.com
common:laptop --noremote_upload_local_results
# Do local development builds in debug mode by default (instead of fastbuild)
build --compilation_mode=dbg
build:ci --compilation_mode=opt
build:ci --experimental_build_event_upload_strategy=local
# Tidy up logs in CI.
common:ci --logging=3 --curses=no --color=no
# Suppress stdout from successful actions in CI.
# Errors are not suppressed.
build:ci --output_filter=DOES_NOT_MATCH
build:ci --noshow_loading_progress
build:ci --ui_event_filters=-DEBUG
# Increase the loading-phase threads from the default (HOST_CPUS * 0.5) so that
# large numbers of small downloads (Node.JS deps) are fetched faster.
build:ci --loading_phase_threads=HOST_CPUS*2
query:ci --loading_phase_threads=HOST_CPUS*2
test:ci --cache_test_results
test:ci --test_arg=-test.v --run_under=//testing/junit_wrapper
test:ci --flaky_test_attempts=2
test:ci --test_env=GO_TEST_WRAP=0
# Run all benchmarks to ensure they don't rot.
test:ci --test_arg=-test.bench=.
build:ci --workspace_status_command=tools/build/bazel_workspace_status --stamp=yes
# Sets //tools/build:disable_test_deps - true for builds, false for tests.
build:ci --define BAZEL_NO_TEST_DEPS=true
test:ci --define BAZEL_NO_TEST_DEPS=false
# From https://git.corp.stripe.com/stripe-internal/zoolander/blob/master/.bazelrc#L35
# > without this, `bazel run/test` will leak in additional
# > env values from the host resulting in different graph
# > hashes for build/test/run. This yields a poor user experience,
# > as you'll wind up recompiling protobuf often.
build --incompatible_strict_action_env
# Use the new cc toolchain resolution mechanism.
build --incompatible_enable_cc_toolchain_resolution
# Generate a JSON trace profile that we can upload as a 'user file' for profiling.
build --experimental_generate_json_trace_profile --experimental_profile_cpu_usage
# Also include user-written Starlark functions in the profile. See:
# https://docs.bazel.build/versions/2.2.0/command-line-reference.html#flag--experimental_profile_additional_tasks
build --experimental_profile_additional_tasks=starlark_parser
build --experimental_profile_additional_tasks=starlark_user_fn
build --experimental_profile_additional_tasks=starlark_user_compiled_fn
build --experimental_profile_additional_tasks=skyframe_eval
build --experimental_profile_additional_tasks=skyfunction
# Uncomment to enable a "full" profile; this is large, around O(200+MB)
#build --noexperimental_slim_json_profile
# Block Bazel actions from picking up random detritus from Homebrew
build:macos --sandbox_block_path=/usr/local/bin \
--sandbox_block_path=/usr/local/include
# Remote asset downloader on devboxes
common:devbox-remote-downloader --experimental_remote_downloader=grpc://remotebuild-downloader.service.envoy:10080
common:devbox-remote-downloader --remote_cache=grpc://remotebuild-storage.service.envoy:10080
common:devbox-remote-downloader --remote_upload_local_results=false
build:devbox --config=devbox-remote-downloader
fetch:devbox --config=devbox-remote-downloader
query:devbox --config=devbox-remote-downloader
common:remote_common --bes_keywords=
# Enable Envoy retries when we're talking to the remotebuild infrastructure
common:remote_common --remote_header=x-envoy-retry-grpc-on=unavailable,resource-exhausted,cancelled
common:remote_common --remote_header=x-envoy-max-retries=5
# TODO(sushain): Remove once this is the default.
build:remote_common --remote_exec_header=x-stripe-firecracker-sandboxer=true
########################################################################
#
# ci_remote
#
# CI jobs are run with --config=ci --config=ci_stripe_bazel_build.
# This line enables --config=ci_remote for all CI builds.
build:ci_stripe_bazel_build --config=ci_remote
# Pull in remote_common
common:ci_remote --config=remote_common
# Tell Bazel where the remotebuild services live.
common:ci_remote --remote_cache=grpc://remotebuild-storage.service.envoy
common:ci_remote --remote_executor=grpc://remotebuild-distributor.service.envoy
common:ci_remote --experimental_remote_downloader=grpc://remotebuild-downloader.service.envoy
common:ci_remote --remote_proxy=unix:/run/envoy/build-container/remotebuild.sock
# Disable local disk cache. This can be revisited post Bazel 5 upgrade.
build:ci_remote --disk_cache=
build:ci_remote --remote_upload_local_results=false
# Use gocode-specific remote_platform
build:ci_remote --extra_execution_platforms=@//:remote_platform
# Optimization: avoid downloading intermediate action outputs to local disk.
build:ci_remote --remote_download_toplevel
# Optimization: --jobs doubles as the concurrent work factor for remote actions.
# See https://github.com/bazelbuild/bazel/issues/6394
build:ci_remote --jobs=200
# Optimization: Uncap the number of concurrent connections made to remotebuild
build:ci_remote --remote_max_connections=0
# Run ~all actions remotely, disabling other strategies.
build:ci_remote --spawn_strategy=remote
# This is enabled in order to bypass remotebuild for certain actions
# using the "no-remote" tag.
# Works around https://github.com/bazelbuild/bazel/issues/8830
build:ci_remote --experimental_allow_tags_propagation=true
# Allow PackageTar actions to run locally when "no-remote" tag is set.
build:ci_remote --strategy=PackageTar=remote,sandboxed
########################################################################
# The devbox_remote config should be suitable for running Go build/test and
# other targets against the remotebuild QA cluster. Eventually this may be our
# default, but for now we start with it opt-in (see "Make gocode
# remote-by-default on devboxen" [1])
#
# Some of the values here are equivalent to those in the `ci_remote` config. We
# could factor those into a common config shared by `devbox_remote` and
# `ci_remote`, but it seems clearer to duplicate them in each in case they need
# to diverge later.
#
# Note that the config here does not need to explicitly include
# devbox-remote-downloader, since it is included by the config `devbox` above,
# and the `devbox` config is sourced automatically during Bazel invocations on
# devboxen (via /etc/bazel.bazelrc there).
#
# [1] https://paper.dropbox.com/doc/remotebuild-and-gocode-improvements-H22021-XH3sDdav9grleXolsCZnE#:uid=651827802954910558297334&h2=Make-gocode-remote-by-default-
build:devbox_remote --spawn_strategy=remote
common:devbox_remote --remote_executor=grpc://remotebuild-distributor.service.envoy:10080
build:devbox_remote --disk_cache=
build:devbox_remote --extra_execution_platforms=@//:remote_platform
build:devbox_remote --remote_download_toplevel
common:devbox_remote --config=remote_common
# Shows logs when in all cases
build:show_logs --test_output=all
# Config that we can pass to 'bazel run' to make it not print any extraneous stuff to the terminal
run:quiet --show_result=0 --noshow_progress --noshow_loading_progress --ui_event_filters= --curses=no
# Config that we can pass to 'bazel test' to make it print all test output, even for passing tests
test:verbose --test_output=all --test_arg=-test.v
# Config that we can pass to build canary to run all gocode tests nightly
test:alltests --runs_per_test=10 --cache_test_results=no
# Config for skycfgtest / MSP Capacity Governance
build:skycfgtest --config=ci_remote
build:skycfgtest --spawn_strategy=processwrapper-sandbox
# Placing this at the bottom ensures that its configuration takes precedence over
# anything set above. See discussion in
# https://git.corp.stripe.com/stripe-internal/gocode/pull/23698 .
try-import /tmp/gocode-ci.bazelrc
# Make sure tests use a consistent `STRIPE_ENVIRONMENT` across CI, laptops, and
# devboxes. We use `build` instead of `test` so that the option remains
# identical across Bazel invocations even though it is a functional no-op for
# build targets.
build --test_env STRIPE_ENVIRONMENT=testing
# Allows users to build/test while disconnected from VPN or completely offline
# (assuming all the build inputs are already on disk, etc.)
#
# Enabled when `--config=offline` is added to a `bazel build` command.
build:offline --experimental_remote_downloader= --remote_cache= --remote_executor=
# Enables toolchains and platforms for linux-arm64 cross-compilation.
# This depends on Ubuntu's g{cc,++}-aarch64 and is unlikely to work outside CI.
build:armcross --extra_toolchains=//tools/toolchains:gcc_cross_aarch64
build:armcross --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64_cgo
# Enables toolchains and platforms for darwin-arm64 cross-compilation.
# Note that cgo is difficult to cross-compile from Linux to Darwin; we don't try.
build:darwincross --platforms=@io_bazel_rules_go//go/toolchain:darwin_arm64
# Disables nogo static analysis and builds everything with fastbuild.
# Useful for local development, if you prefer faster build cycle.
build:fast --compilation_mode=fastbuild --define BAZEL_FASTBUILD=true