blob: 18253f10c8a73804a73dd6448023e490bc2ab851 [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.
Leopold Schabel9508b122023-07-14 17:54:17 +02006build --experimental_use_hermetic_linux_sandbox
Leopold7fbf1042023-01-06 19:57:37 +01007build --action_env=MONOGON_SANDBOX_DIGEST
8import %workspace%/.bazelrc.sandbox
9
Leopold Schabel9508b122023-07-14 17:54:17 +020010# Hardwire all action envs to just use /usr/bin from the above sandbox. This is
11# necessary on NixOS Bazel builds, as they really like to inject /nix/store/*
12# paths otherwise. We also explicitly set it to /usr/bin only (no /bin) as
13# otherwise calling gcc from /bin/gcc breaks its own resolution of subordinate
14# commands (like cc1, as, etc.).
15build --action_env=PATH=/usr/bin
16build --host_action_env=PATH=/usr/bin
17
18# Make all shell run actions use /bin/bash instead of whatever the host might
19# have set. Again, looking at you, Bazel-on-NixOS.
20build --shell_executable=/bin/bash
21
Leopoldbc93c2b2023-01-14 13:12:23 +010022# No local CPP toolchain resolution. In our sandbox root, it doesn't make sense -
23# anything auto-detected during analysis stage is on the host instead of the sandbox.
24# Sysroot rebuild is pure Go and doesn't need it either.
25# The flag ensures we fail early if we somehow depend on the host toolchain,
26# and do not spend unnecessary time on autodiscovery.
27build --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
28
29# Use new-style C++ toolchain resolution.
30build --incompatible_enable_cc_toolchain_resolution
31
32# In our monorepo, we mostly ignore the host platform since we bring our own
33# execution environment. However, we still need to run a small number of tools
34# such as gazelle. We can just use rules_go's pure-Go platform. Attempting to
35# build CGO binaries for the host will fail (and does not make sense).
36# The host is lava - it could be NixOS (or even potentially macOS/Windows).
37build --host_platform=@io_bazel_rules_go//go/toolchain:linux_amd64
38
39# Target platform for the monorepo is currently the same as the host platform,
40# but we'll support cross-compilation at some point. Do not rely on it.
41build --platforms=//build/platforms:linux_amd64
42# Make sure our platform is picked instead of the --host_platform.
43build --extra_execution_platforms=//build/platforms:linux_amd64
44
Leopoldeb2fb7b2022-06-08 13:18:51 +020045# Build resources
Leopold Schabel5c80aca2019-10-22 15:48:58 +020046startup --batch_cpu_scheduling --io_nice_level 7
Leopoldafb925b2023-01-08 16:57:28 +010047test --test_output=errors
Lorenz Brun5d7d2a42020-04-06 14:11:02 +020048
Leopold96b03c72022-06-08 12:59:58 +020049# selinux:
50# build with SELinux (containerd, kubelet)
51# no_zfs,no_aufs,no_devicemapper:
52# disable containerd features we don't need
53# providerless,dockerless:
54# build k8s without cloud provider and docker support
Serge Bazanski46e72ab2022-09-05 15:13:22 +020055# nowasm:
56# disable wasm plugin support in sqlc
Serge Bazanskieca5af92023-06-20 13:31:37 +020057build --@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 +020058
59# Build with C++17.
60build --cxxopt=-std=c++17
61
Lorenz Brunf6402112020-05-04 16:50:31 +020062# Set workspace status file and stamp
63build --stamp --workspace_status_command=./build/print-workspace-status.sh
Serge Bazanski385c12f2020-06-17 12:12:42 +020064
Serge Bazanskic3ad8462021-01-08 16:45:51 +010065# Load CI bazelrc if present.
66try-import %workspace%/ci.bazelrc
Leopold31545872022-06-08 13:22:32 +020067
68# Load custom per-user settings.
69try-import %workspace%/.bazelrc.user