blob: 9734f977176e3531f53a899a34ac764f4c3b8a3e [file] [log] [blame]
Leopoldeb2fb7b2022-06-08 13:18:51 +02001# Enable strict_action_env (use static PATH and do not inherit environment variables).
2# This avoids unnecessary cache invalidations.
3build --incompatible_strict_action_env=true
4
Leopoldbc93c2b2023-01-14 13:12:23 +01005# Run all spawns in our own hermetic sandbox sysroot.
6#build --experimental_use_hermetic_linux_sandbox
7# TODO: https://github.com/bazelbuild/rules_go/issues/1910
Leopold7fbf1042023-01-06 19:57:37 +01008build --action_env=MONOGON_SANDBOX_DIGEST
9import %workspace%/.bazelrc.sandbox
10
Leopoldbc93c2b2023-01-14 13:12:23 +010011# No local CPP toolchain resolution. In our sandbox root, it doesn't make sense -
12# anything auto-detected during analysis stage is on the host instead of the sandbox.
13# Sysroot rebuild is pure Go and doesn't need it either.
14# The flag ensures we fail early if we somehow depend on the host toolchain,
15# and do not spend unnecessary time on autodiscovery.
16build --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
17
18# Use new-style C++ toolchain resolution.
19build --incompatible_enable_cc_toolchain_resolution
20
21# In our monorepo, we mostly ignore the host platform since we bring our own
22# execution environment. However, we still need to run a small number of tools
23# such as gazelle. We can just use rules_go's pure-Go platform. Attempting to
24# build CGO binaries for the host will fail (and does not make sense).
25# The host is lava - it could be NixOS (or even potentially macOS/Windows).
26build --host_platform=@io_bazel_rules_go//go/toolchain:linux_amd64
27
28# Target platform for the monorepo is currently the same as the host platform,
29# but we'll support cross-compilation at some point. Do not rely on it.
30build --platforms=//build/platforms:linux_amd64
31# Make sure our platform is picked instead of the --host_platform.
32build --extra_execution_platforms=//build/platforms:linux_amd64
33
Leopoldeb2fb7b2022-06-08 13:18:51 +020034# Build resources
Leopold Schabel5c80aca2019-10-22 15:48:58 +020035startup --batch_cpu_scheduling --io_nice_level 7
Leopoldafb925b2023-01-08 16:57:28 +010036test --test_output=errors
Lorenz Brun5d7d2a42020-04-06 14:11:02 +020037
Leopold96b03c72022-06-08 12:59:58 +020038# selinux:
39# build with SELinux (containerd, kubelet)
40# no_zfs,no_aufs,no_devicemapper:
41# disable containerd features we don't need
42# providerless,dockerless:
43# build k8s without cloud provider and docker support
Serge Bazanski46e72ab2022-09-05 15:13:22 +020044# nowasm:
45# disable wasm plugin support in sqlc
Serge Bazanskieca5af92023-06-20 13:31:37 +020046build --@io_bazel_rules_go//go/config:tags=selinux,seccomp,no_zfs,no_aufs,no_devicemapper,providerless,dockerless,nowasm,netgo,osusergo
Serge Bazanskibb7db922020-04-30 12:43:10 +020047
48# Build with C++17.
49build --cxxopt=-std=c++17
50
Lorenz Brunf6402112020-05-04 16:50:31 +020051# Set workspace status file and stamp
52build --stamp --workspace_status_command=./build/print-workspace-status.sh
Serge Bazanski385c12f2020-06-17 12:12:42 +020053
Serge Bazanskic3ad8462021-01-08 16:45:51 +010054# Load CI bazelrc if present.
55try-import %workspace%/ci.bazelrc
Leopold31545872022-06-08 13:22:32 +020056
57# Load custom per-user settings.
58try-import %workspace%/.bazelrc.user