13. Use Bazel’s cloud features#
Caution
This section is optional. Feel free to skip to the next one if you’re impatient to try the air quality app!
One of Bazel’s defining features is that it’s a cloud build system. Team members can easily share artifacts (including test logs), builds can be run in parallel on hundreds of machines in the cloud, and build artifacts that were built once (by anyone) don’t need to be rebuilt from scratch.
This section gives you a taste of these features of Bazel using BuildBuddy.
BuildBuddy setup#
To use cloud features, you need to get set up with some cloud provider.
Note
Googlers: see additional instructions at go/pw-sense-googlers.
Go to https://app.buildbuddy.io/ and log in via Google or GitHub.
Click Quickstart Guide.
In 1. Configure your .bazelrc enable the following options:
API Key
Enable cache
Full cache
Caution
b/364781685: Sense does not support remote execution yet, so don’t enable that option.
Copy the provided snippet to your
.bazelrc
.
Remote caching#
Bazel supports remote caching: if you (or someone else in your organization) already built an artifact, you can simply retrieve it from the cache instead of building it from scratch. Let’s test it out.
Remove all local Bazel build results.
$ bazelisk clean
Run
blinky_test
again. It should be quite fast, even though you discarded all the build artifacts. Bazel simply downloads them from the remote cache that your previous invocation populated!You can click the CACHE tab in the BuildBuddy invocation UI to see more details on cache performance (how many hits there were, how much data was uploaded and downloaded, etc).
Summary#
In this section, you’ve gotten a taste of the cloud features of Bazel: generating easily shareable URLs for build and test invocations, and speeding up your builds by leveraging remote caching.
Next, head over to 14. Run the air quality monitor app to try out the air quality monitoring application.