forked from pixie-io/pixie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bazelrc
232 lines (188 loc) · 9.61 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
# 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
# podman requires $HOME to be set to pull images from gcr.
test --action_env=HOME
# Passthrough GH_API_KEY from the environment.
build --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
test --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
# 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
# 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
build:gcc --test_tag_filters=-no_gcc,-requires_root,-requires_bpf,-disabled
build:gcc --//bazel/cc_toolchains:compiler=gcc
# 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
# 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
# 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
# Put your own configurations into user.bazelrc, which is ignored by git.
try-import %workspace%/user.bazelrc
# Import a machine specific bazelrc. This can be used to enable caching.
try-import /etc/bazelrc
try-import %workspace%/bes.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