forked from Checkmk/checkmk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.bazelrc
More file actions
174 lines (146 loc) · 7.67 KB
/
Copy path.bazelrc
File metadata and controls
174 lines (146 loc) · 7.67 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
# Use local registry to add local download mirrors
common --registry="file:///%workspace%/bazel/thirdparty"
common --registry="file:///%workspace%/bazel/registry"
common --registry=https://bcr.bazel.build
# enable a local disk cache: this is especially relevant for local builds without an enabled bazel-remote
common:linux --disk_cache=~/.cache/bazel_disk_cache/
# reading WORKSPACE is disabled by default for Bazel 8
common --enable_workspace
# enable visibility checking for config_settings
common --incompatible_enforce_config_setting_visibility
common --incompatible_config_setting_private_default_visibility
# with rules_proto_grpc (5.0.1) we run into
# >>> Error in resolve_tools: Pass an executable or tools argument to ctx.actions.run
# without
common --noincompatible_disallow_ctx_resolve_tools
# default/common bazel args for all commands supporting it
common --experimental_ui_max_stdouterr_bytes=10000000
common --remote_cache_async
common --remote_cache_compression
# send pings after this time of no read operations on the connection, but only if there is at least one pending gRPC call
# only with this flag "grpc_keepalive_timeout" is enabled, defaults to 20s
common --grpc_keepalive_time=10s
# minimum blob size required to compress/decompress with zstd (1MB)
common --experimental_remote_cache_compression_threshold=1048576
common --remote_local_fallback
common --cycles
common --local_resources=cpu=HOST_CPUS-2
common --local_resources=memory=HOST_RAM*.5
common --@//bazel/cmk/distro="ubuntu-24.04"
# Enable Bzlmod for every Bazel command
common --enable_bzlmod
# Do not upload artifacts other than from CI, see below, CMK-18656
common --remote_upload_local_results=false
common --lockfile_mode=error
common --test_summary=detailed
## For specific commands
# Always require debug info.
# build --copt="-g"
build --flag_alias=cmk_version=//bazel/cmk/version
build --flag_alias=cmk_edition=//bazel/cmk/edition
build --flag_alias=cmk_distro=//bazel/cmk/distro
# For some obscure reason, the re2 project made itself valgrind-dirty by default:
# https://github.com/google/re2/commit/ce6f2884c4b52509fd6c5d12b8f1c40587067784
# Defining the symbol below has a small performance hit, but makes our stuff
# valgrind-clean again, which is a crucial feature for debugging the NEB & CMC!
build --copt="-DRE2_ON_VALGRIND"
clean --async
# all bazel-created temporary and build output files
# clean --expunge
# run ...
test --test_output=all
# Flags for CI builds
# Definition of "bazel x --config=ci -- ..."
## Common
common:ci --color=no
common:ci --show_progress_rate_limit=0
common:ci --show_timestamps
common:ci --memory_profile=bazel-memory.profile
common:ci --//bazel/toolchains/cc/gcc/local:gcc_path=opt
common:ci --local_resources=cpu=HOST_CPUS*.21
common:ci --local_resources=memory=HOST_RAM*.67
# the later flags will override the previous flags
# upload artifacts only from CI, CMK-18656
common:ci --remote_upload_local_results=true
common:ci --@//bazel/cmk/distro=UNSET
# For better performance - passes an argument `--skipLibCheck` to *every* spawn of tsc
common --@aspect_rules_ts//ts:skipLibCheck=always
# For more correct typechecks - honor the setting of `skipLibCheck` in the tsconfig.json file
# common --@aspect_rules_ts//ts:skipLibCheck=honor_tsconfig
## For specific commands
# build:ci ...
# Don't require system python for bootstrapping
# See: https://github.com/bazelbuild/rules_python/commit/f5b19dce7bc0837396ac03a425cdb9b64643cf61
# TODO: should be dropped as soon as this becomes the default
# TODO: this should be the overall default, see discussions in
# https://tribe29.slack.com/archives/C03PW9280U9/p1728303949973099
build:ci --@rules_python//python/config_settings:bootstrap_impl=script
build:ci --noshow_progress
# clean:ci ...
# run:ci ...
# test:ci ...
# Flags for Debug builds
# Definition of "bazel x --config=debug -- ..."
## Common
common:debug --announce_rc
# gRPC errors provide stack trace as well
common:debug --verbose_failures
## For specific commands
# build:debug ...
# clean:debug ...
# run:debug ...
# test:debug ...
################################################################################
# Example: bazel build --config clang-tidy //non-free/packages/cmc:all
################################################################################
build:clang-tidy --aspects @bazel_clang_tidy//clang_tidy:clang_tidy.bzl%clang_tidy_aspect
build:clang-tidy --output_groups=report
build:clang-tidy --@bazel_clang_tidy//:clang_tidy_executable=//bazel/tools:clangtidy_bin
build:clang-tidy --@bazel_clang_tidy//:clang_tidy_config=//bazel/tools:clang_tidy_config
build:clang-tidy --@bazel_clang_tidy//:clang_tidy_gcc_install_dir=@gcc-linux-x86_64//:x86_64-buildroot-linux-gnu
build:clang-tidy --@bazel_clang_tidy//:clang_tidy_additional_deps=@gcc-linux-x86_64//:toolchain_root
################################################################################
# Example: bazel build --config=iwyu //non-free/packages/cmc:all
################################################################################
build:iwyu --aspects @bazel_iwyu//bazel/iwyu:iwyu.bzl%iwyu_aspect
build:iwyu --output_groups=report
build:iwyu --@bazel_iwyu//:iwyu_executable=//bazel/tools:iwyu_bin
build:iwyu --@bazel_iwyu//:iwyu_opts="--error"
build:iwyu --@bazel_iwyu//:iwyu_mappings=//bazel/tools:iwyu_mappings
################################################################################
# Example: bazel build --config=mypy //packages/cmk-agent-based:all
################################################################################
build:mypy --aspects //bazel/tools:aspects.bzl%mypy_aspect
build:mypy --output_groups=mypy
################################################################################
# Example: bazel build --config=clippy //packages/host/cmk-agent-ctl:all
################################################################################
build:clippy --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect
build:clippy --output_groups=+clippy_checks
build:clippy --@rules_rust//:clippy_flags=-Dwarnings
# Turn off automatic capturing of environmental stuff like PATH - those will be set explicitly
# (see https://blog.aspect.build/bazelrc-flags)
build --incompatible_strict_action_env
# Set PATH manually (see above) for both action_env and host_action_env
# Note: in the future PATH might not be needed at all as long as Bazel provides all the tools
# currently taken from system. For now we still need `/usr/bin` and `/bin` for stuff like
# `git`, etc.
# Also note that in some distro specific exceptions we force tools to be located in
# `/usr/bin` (by symlinking) when building the build images
build --enable_platform_specific_config
build:linux --action_env=PATH="/usr/bin:/bin"
build:linux --host_action_env=PATH="/usr/bin:/bin"
build:windows --action_env=PATH="c:\\Windows;c:\\Windows\\system32;C:\\Program Files (x86)\\Windows Kits\\10\\App Certification Kit"
build:windows --host_action_env=PATH="c:\\Windows;c:\\Windows\\system32;C:\\Program Files (x86)\\Windows Kits\\10\\App Certification Kit"
# The remote.bazelrc file contains the secrets for accessing the remote cache and must be added by the corresponding
# Jenkins job (or a user) in the form of:
# common --remote_cache=grpcs://${USER}:${PASSWORD}@{URL}
try-import %workspace%/remote.bazelrc
# ci.bazelrc can override all of the above (except explicit user-defined stuff)
try-import /etc/ci.bazelrc
# Import a (non-tracked) `user.bazelrc` if available - put worktree specific
# options here you don't want to accidentally submit
try-import %workspace%/user.bazelrc
# Note: unfortunately there is no way to `try-import %home%/user.bazelrc`,
# in order to set user specific options in a worktree-independent way, but
# you can create ~/.bazelrc and put your global stuff there.