forked from DataDog/datadog-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.bazelrc
More file actions
128 lines (112 loc) · 9.71 KB
/
Copy path.bazelrc
File metadata and controls
128 lines (112 loc) · 9.71 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
# Do not edit this file without a review from @DataDog/agent-build
# ADMS config ----------------------------------------------------------------------------------------------------------
# Ensure access to DataDog internal artifact repositories in CI
import %workspace%/.adms/adms.bazelrc
# Use --config=adms to use adms for upstream dependency caching.
# TOOD: rename dd-internal in the .adms tree to adms-internal. That
# will be easier to understand.
common:adms --config=dd-internal
# Startup options ------------------------------------------------------------------------------------------------------
startup --max_idle_secs=28800 # Keep the server alive for at most 8 hours of inactivity
# Common options -------------------------------------------------------------------------------------------------------
common --@rules_python//python/config_settings:bootstrap_impl=script # https://github.com/bazel-contrib/rules_python/blob/main/BZLMOD_SUPPORT.md
common --check_direct_dependencies=error # Escalate any bypassed `bazel_dep` to a resolution failure
common --credential_helper_cache_duration=55m # Refresh a little earlier than the Vault OIDC token TTL (1h)
common --credential_helper_timeout=2m # Interactive Vault login might involve a browser and exceed the 10s default
common --enable_platform_specific_config # Supported OS identifiers are linux, macos, windows, freebsd, and openbsd
common --experimental_disk_cache_gc_max_size=30G # Cap applied whenever --disk_cache is also set, no-op otherwise. Override in user.bazelrc (50G good, 100G ideal)
common --experimental_proto_descriptor_sets_include_source_info # Preserve comments in generated pb.go
common --experimental_strict_repo_env # Do not leak uncontrolled environment variables into repository rules
common --experimental_ui_max_stdouterr_bytes=1073741819 # why?
common --http_timeout_scaling=3.0 # At least one attempt reaches 30s (3,6,12,24,30,30,30,30) instead of only 10s (1,2,4,8,10,10,10,10)
common --incompatible_default_to_explicit_init_py # https://github.com/bazel-contrib/rules_python/issues/2945
common --incompatible_remote_local_fallback_for_remote_cache # works only if --remote_local_fallback is also set
common --nobuild_event_json_file_path_conversion # don't fail the build on a transient BEP-upload error (no such host)
common --remote_instance_name=ci/datadog-agent # entries missing from datadog-agent will be searched in remote-caching
common --remote_local_fallback # best-effort on transient connection errors (no such host)
common --remote_retries=1
common --remote_timeout=60
common --rewind_lost_inputs # https://github.com/bazelbuild/bazel/pull/25477
common --repo_env=DEPLOY_AGENT # Keep in sync with env_vars in MODULE.bazel
common --repo_env=FORCED_PACKAGE_COMPRESSION_LEVEL # Keep in sync with env_vars in MODULE.bazel
common --repo_env=GOCACHE # https://pkg.go.dev/cmd/go#hdr-Build_and_test_caching
common --repo_env=GOMODCACHE # https://wiki.archlinux.org/title/XDG_Base_Directory#Partial
common --repo_env=GOTOOLCHAIN=local # Extend https://github.com/bazel-contrib/rules_go/pull/3660 to Go SDK patching rules
common --repo_env=PACKAGE_VERSION # Keep in sync with env_vars in MODULE.bazel
common --repo_env=REPIN=1 # Reduce MODULE.bazel.lock churn when --lockfile_mode=[update|refresh] trigger
common --repo_env=SIGN_MAC # Keep in sync with env_vars in MODULE.bazel
common --repo_env=BAZEL_TOOLCHAINS_MSVC_ACCEPT_MICROSOFT_VISUAL_STUDIO_BUILDTOOLS_EULA=1 # common so bazel mod tidy resolves the MSVC extension on every host
common --repo_env=XDG_CACHE_HOME # https://wiki.archlinux.org/title/XDG_Base_Directory
# Variables to override release.json values
common --repo_env=INTEGRATIONS_CORE_VERSION
common --repo_env=INTEGRATIONS_WHEELS_STORAGE
common --run_env=GOTOOLCHAIN=local # Extend https://github.com/bazel-contrib/rules_go/pull/3660 to `bazel run //:go`
common --run_env=RULES_PYTHON_ADDITIONAL_INTERPRETER_ARGS=-I # Prevent user env, path, and site from shadowing runfiles
common --skip_incompatible_explicit_targets # Let target_compatible_with skip rather than fail
common --test_output=errors # Print test errors to console output instead of only capturing them in buried test.log
common --verbose_failures
# Lint config (static code analyzers) ----------------------------------------------------------------------------------
# Go -TODO(agent-build)
# Python -TODO(agent-build)
# Rust
common:lint --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect --output_groups=+clippy_checks
common:lint --aspects=@rules_rust//rust:defs.bzl%rustfmt_aspect --output_groups=+rustfmt_checks
# Linux config ---------------------------------------------------------------------------------------------------------
common:linux --credential_helper=buildbarn-edge-cache.buildbarn.local-cluster.local-dc.fabric.dog=%workspace%/bazel/tools/credential-helper
common:linux --credential_helper=buildbarn-frontend-datadog-agent.us1.ddbuild.io=%workspace%/bazel/tools/credential-helper
common:linux --strategy=sandboxed
# macOS config ---------------------------------------------------------------------------------------------------------
common:macos --credential_helper=buildbarn-edge-cache.buildbarn.local-cluster.local-dc.fabric.dog=%workspace%/bazel/tools/credential-helper
common:macos --credential_helper=buildbarn-frontend-datadog-agent.us1.ddbuild.io=%workspace%/bazel/tools/credential-helper
common:macos --features=-macos_default_link_flags # https://github.com/bazelbuild/bazel/issues/23312
common:macos --macos_minimum_os=12.0 # Keep in sync with https://docs.datadoghq.com/agent/supported_platforms/?tab=macos
common:macos --strategy=sandboxed
# Windows config -------------------------------------------------------------------------------------------------------
common:windows --credential_helper=buildbarn-edge-cache.buildbarn.local-cluster.local-dc.fabric.dog=%workspace%/bazel/tools/credential-helper.bat
common:windows --credential_helper=buildbarn-frontend-datadog-agent.us1.ddbuild.io=%workspace%/bazel/tools/credential-helper.bat
common:windows --strategy=standalone # Valid values are: [dynamic_worker, standalone, dynamic, remote, worker, local]
# rules_python 1.9.0 transitions enable_runfiles to `true` for every py_ target on Windows. Pre-setting it here makes
# that transition a no-op, so Bazel deduplicates python_win and avoids 2 concurrent MSBuild racing on shared resources.
common:windows --enable_runfiles
common:windows --repo_env=BAZEL_SH=C:/tools/msys64/usr/bin/bash.exe # for https://github.com/bazelbuild/bazel/pull/26927
common:windows --repo_env=PIP_CACHE_DIR # https://pip.pypa.io/en/stable/topics/caching/#default-paths
common:windows --repo_env=SYSTEMDRIVE # needed by vswhere to locate the VS installer instance database
common:windows --repo_env=SYSTEMROOT # used by COM to load system DLLs, needed by vswhere
common:windows --repo_env=USERPROFILE # used by MSYS2 bash to emulate HOME, needed by git to fetch repositories
common:windows --repo_env=VSTUDIO_ROOT # visual_studio(path_variable) in MODULE.bazel; MSBuild-only
common:windows --run_env=__COMPAT_LAYER=RunAsInvoker # install*.exe may otherwise fail claiming unneeded admin elevation
common:windows --test_env=__COMPAT_LAYER=RunAsInvoker # same, for bazel test
common:windows --shell_executable=C:/tools/msys64/usr/bin/bash.exe
# Force the x86_64-pc-windows-gnu Rust toolchain (compact name for rust_windows_gnu_x86_64)
# to take priority over the default MSVC toolchain, since the CI cc_toolchain is MinGW/GCC.
common:windows --extra_toolchains=@rust_toolchains//:rw-2070622084
# Remote cache config --------------------------------------------------------------------------------------------------
# Available remote cache endpoints - only Linux CI runs in k8s and can reach the in-cluster edge cache
common:cache:edge --remote_cache=grpc://buildbarn-edge-cache.buildbarn.local-cluster.local-dc.fabric.dog:443
common:cache:frontend --remote_cache=grpcs://buildbarn-frontend-datadog-agent.us1.ddbuild.io:443
# Developer cache config, kept as `--config=cache` for backward compatibility
common:cache --config=cache:frontend
common:cache --noremote_upload_local_results
# Explicit local-only config: disable the remote cache while keeping the
# wrapper-injected --disk_cache. Use `--config=no-remote-cache` (or
# DD_BAZEL_REMOTE_CACHE=off) to opt out of tools/bazel auto-selection.
common:no-remote-cache --remote_cache=
# CI config ------------------------------------------------------------------------------------------------------------
common:ci --config=adms
common:ci --config=lint
common:ci --noexperimental_convenience_symlinks # not CI-suitable: "These symlinks are only for the user's convenience"
common:ci --remote_download_regex=.*/test\.xml$ # force-download test.xml even under --remote_download_outputs=toplevel, so junit collection can read it locally
# Project/Language configs --------------------------------------------------------------------------------------
import %workspace%/bazel/configs/go_tests.bazelrc
import %workspace%/bazel/configs/rust.bazelrc
# Global release config ------------------------------------------------------------------------------------------------
# This should aggregate all the release configs for all the languages with enabled optimizations,
# stripping, etc. It does not strictly mean that this build is the one to be released as a product.
# It just selects all the flags we should use on product builds. For example, we need to build with
# optimization and compress packages in CI so that we can run performance and size gates, even
# though we will never release that instance of the package to customers.
common:release --config=rust-release
common:release --//:release
common --config=release
# Local development options --------------------------------------------------------------------------------------------
try-import %workspace%/user.bazelrc