Skip to content

Commit

Permalink
Merge #79360
Browse files Browse the repository at this point in the history
79360: bazel: disable sandboxing and avoid stamping r=irfansharif a=irfansharif

- Sandboxing on MacOS have measurable overhead. See
  bazelbuild/bazel#8230; it comes from
  symlinks being much slower to create. This commit disables sandboxing
  on local builds (still present in CI) to hopefully speed up builds.
  - If this proves to be buggy for whatever reason, we could opt out of
    sandboxing for go package compiles specifically using
    --strategy=GoCompilePkg=local.
  - In the future if we want local sandboxing, we could explore
    sandboxfs: https://bazel.build/docs/sandboxing
- When used with a remote build cache, these stamps (despite being marked
  as volatile), induce an unnecessary golink step when switching back
  and forth between branches. See bazelbuild/bazel#10075. Opting out
  here shaves a few precious seconds if the previously built binary is
  already available.

Release note: None

Jira issue: CRDB-14748

Co-authored-by: irfan sharif <[email protected]>
  • Loading branch information
craig[bot] and irfansharif committed Apr 7, 2022
2 parents 38a3442 + ca37906 commit 9cffc04
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ build:crosslinuxarmbase --config=cross
# NB: This is consumed in `BUILD` files (see build/toolchains/BUILD.bazel).
build:devdarwinx86_64 --platforms=//build/toolchains:darwin_x86_64
build:devdarwinx86_64 --config=dev
build:dev --stamp --workspace_status_command=./build/bazelutil/stamp.sh
build:dev --workspace_status_command=./build/bazelutil/stamp.sh
build:dev --action_env=PATH
build:dev --host_action_env=PATH
build:dev --spawn_strategy=local --strategy=Genrule=sandboxed

try-import %workspace%/.bazelrc.user

Expand Down
1 change: 0 additions & 1 deletion pkg/cmd/dev/doctor.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ Please perform the following steps:
}
if failedStampTestMsg != "" {
failedStampTestMsg = failedStampTestMsg + fmt.Sprintf(`
This may be because your Bazel is not configured to "stamp" built executables.
Make sure one of the following lines is in the file %s/.bazelrc.user:
`, workspace)
if runtime.GOOS == "darwin" && runtime.GOARCH == "amd64" {
Expand Down

0 comments on commit 9cffc04

Please sign in to comment.