grpc/tools/remote_build
Jan Tattermusch 30b3d5061a
[test-infra] Switch RBE linux build to a new custom image rbe_ubuntu2004. (#32748)
- Add a new docker image "rbe_ubuntu2004" that is built in a way that's
analogous to how our other testing docker images are built (this gives
us control over what exactly is contained in the docker image and
ability to fine-tune our RBE configuration)
- Switch RBE on linux to the new image (which gives us ubuntu20.04-based
builds)

For some reason, RBE seems to have trouble pulling the docker image from
Google Artifact Registry (GAR), which is where our public testing images
normally live, so for now, I used a workaround and I upload a copy of
the rbe_ubuntu2004 docker image to GCR as well, and that makes RBE works
just fine (see comment in the `renerate_linux_rbe_configs.sh` script).

More followup items (config cleanup, getting local sanitizer builds
working etc.) are in go/grpc-rbe-tech-debt-2023
2023-05-01 11:47:27 -07:00
..
include Switch linux RBE to ubuntu18.04, get rid of rbe_autoconfig (#32559) 2023-03-10 09:34:53 +01:00
README.md Update tools/remote_build/README.md (#31727) 2022-11-22 13:16:20 -08:00
linux.bazelrc [test-infra] Switch RBE linux build to a new custom image rbe_ubuntu2004. (#32748) 2023-05-01 11:47:27 -07:00
linux_kokoro.bazelrc Cleanup bazel RBE configs (#29281) 2022-04-04 09:47:43 +02:00
mac.bazelrc Cleanup bazel RBE configs (#29281) 2022-04-04 09:47:43 +02:00
windows.bazelrc Switch linux RBE to ubuntu18.04, get rid of rbe_autoconfig (#32559) 2023-03-10 09:34:53 +01:00
workspace_status_kokoro.bat add extra kokoro build info to Win RBE runs 2019-10-04 11:38:30 +02:00
workspace_status_kokoro.sh inject extra details to Bazel RBE links 2018-12-21 11:09:51 +01:00

README.md

Running Remote Builds with bazel

This allows you to spawn gRPC C/C++ remote build and tests from your workstation with configuration that's very similar to what's used by our CI Kokoro.

Note that this will only work for gRPC team members (it requires access to the remote build and execution cluster), others will need to rely on local test runs and tests run by Kokoro CI.

Prerequisites

  • See Installing Bazel for instructions how to install bazel on your system.

  • Setup Application Default Credentials (ADC) for running remote builds by following the "Set credentials" section. (Note: make sure that quota project "grpc-testing" was added to your ADC, you can double check the credential file at ${HOME}/.config/gcloud/application_default_credentials.json)

Running remote build manually from dev workstation

IMPORTANT: The OS from which you run the bazel command needs to always match your desired build & execution platform. If you want to run tests on linux, you need to run bazel from a linux machine, to execute tests on windows you need to be on windows etc. If you don't follow this guideline, the build might still appear like it's working, but you'll get nonsensical results (e.g. will be test configured as if on mac, but actually running on linux).

Linux

For opt or dbg run this command:

# manual run of bazel tests remotely on Foundry
bazel --bazelrc=tools/remote_build/linux.bazelrc test --config=opt //test/...

This also works for sanitizer runs (asan, msan, tsan, ubsan):

# manual run of bazel tests remotely on Foundry with given sanitizer
bazel --bazelrc=tools/remote_build/linux.bazelrc test --config=asan //test/...

NOTE: If you see errors about Build Event Protocol upload failure (e.g. ERROR: The Build Event Protocol upload failed: All retry attempts failed. PERMISSION_DENIED...), try running bazel shutdown and try again.

Windows

# manual run of bazel tests remotely on RBE Windows (must be run from Windows machine)
bazel --bazelrc=tools/remote_build/windows.bazelrc test --config=windows_opt //test/...

NOTE: Unlike on Linux and Mac, the bazel version won't get autoselected for you, so check that you're using the right bazel version.

MacOS

There is no such thing as Mac RBE cluster, so a real remote build on Macs is currently impossible. The following setup will build and run test on you local mac machine, but will give you the RBE-like look & feel (e.g. a results link will be generated and some extra configuration will be used).

# manual run of bazel tests on Mac (must be run from Mac machine)
# NOTE: it's not really a "remote execution", but uploads results to ResultStore
bazel --bazelrc=tools/remote_build/mac.bazelrc test --config=opt //test/...

NOTE: Because this is essentially a local run, you'll need to run start port server first (tools/run_tests/start_port_server.py)

Running local builds with bazel

On all platforms, you can generally still use bazel builds & tests locally without any extra settings, but you might need to start port server first (tools/run_tests/start_port_server.py) to be able to run the tests locally.

E.g.: bazel test --config=opt //test/...

Bazel command line options

Available command line options can be found in Bazel command line reference