Remote Build Execution
This guide shows how to configure remote build execution (RBE) for your Bazel projects with the NativeLink Cloud. Before using this guide make sure you have followed our Bazel Quickstart.
Basic Configuration
To enable RBE all you need to do is add the below flag to your Bazel builds:
This will run your builds on a Ubuntu 22.04 image without any dependencies installed. For most users we don’t expect this to work out of the box as your project most likely depends on installations like GCC/Java/etc. To remedy that, continue with the instructions below to pass in your own images.
Custom Images
To support most RBE builds you will most likely need to pass in your own image with the correct toolchains installed to support your build. To use your own public image you can pass it using this configuration:
Or a public image on Docker Hub is accessible via:
Private Images
If your images are in your own private repository, you can pass your repository credentials to allow us to pull your RBE images.
Hermetic Bazel Builds
An alternative option to passing in your own custom image is using a fully hermetic Bazel build. This will allow you to use our default Ubuntu 22.04 image and your Bazel commands will install all needed dependencies.
You can see a sample of that in the WORKSPACE file of our Hermetic CC example repository here.
Recommended Flags
Bazel has many flags you can pass to it to modify RBE. We recommend three main flags to start.
--jobs
This is the number of concurrent jobs to run. We recommend starting with 50
but
you can readily scale up to 200
. Past this we recommend reaching out to us with help
understanding your build and what optimal settings may be.
--remote_download_minimal
This flag enables “Build Without Bytes” which means Bazel will skip downloading intermediate artifacts that aren’t necessary for your builds to complete. This can greatly increase the speed of your builds.
--remote_timeout
This is how long a job will run before timing out. The default is 60
seconds but we
recommend setting 600
.
Further configurations
You can see the rest of the Bazel command line arguments here, and don’t hesitate to reach out to us with any questions!
Execution Properties
You may have jobs that you need to configure to run on specific hardware, whether that’s GPUs
or High Memory
. In
order to enable this, we utilize Bazel’s exec_properties
. Inside a specific rule you can pass a node
value
that will map those tasks to the type of worker node you want to run your task on.
To configure accepted values of Pool
for your builds please reach out to us to get setup.