bazel: Don't download any outputs

This should speed up CI and CQ builds by not requiring Bazel to actually
download any remotely cached artifacts, unless they're required for
another builds action.

This should have a substantial impact on runtime: looking at profiles
like
https://ui.perfetto.dev/#!/?s=b8194b3e6f9a88bf2f3036b89d3082e382cfd2e3,
it seems like much of the time is spent downloading these outputs. Many
of them we we don't use for anything: all we're doing here is verifying
that they _can_ be successfully built!

Change-Id: I04d6a8f96a16fadf1976a579b48a1a569fbc9791
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/238614
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
Commit-Queue: Rob Mohr <mohrr@google.com>
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Rob Mohr <mohrr@google.com>
Commit-Queue: Ted Pudlik <tpudlik@google.com>
diff --git a/recipe_modules/bazel/api.py b/recipe_modules/bazel/api.py
index 56c04f1..473dd05 100644
--- a/recipe_modules/bazel/api.py
+++ b/recipe_modules/bazel/api.py
@@ -101,6 +101,10 @@
         # Don't limit the amount Bazel will write to stdout/stderr.
         base_args.append('--experimental_ui_max_stdouterr_bytes=-1')
 
+        # Don't download the remote build outputs to the local machine, since we
+        # will not use them.
+        base_args.append('--remote_download_outputs=minimal')
+
         if config.get('remote'):
             # TODO: b/368128573 - Support remote execution on MacOS.
             if self.api.platform.is_linux:
diff --git a/recipes/bazel.expected/simple.json b/recipes/bazel.expected/simple.json
index a4f8b7d..e062ad6 100644
--- a/recipes/bazel.expected/simple.json
+++ b/recipes/bazel.expected/simple.json
@@ -1140,6 +1140,7 @@
       "build",
       "//...",
       "--experimental_ui_max_stdouterr_bytes=-1",
+      "--remote_download_outputs=minimal",
       "--config=remote_cache",
       "--bes_instance_name=pigweed-rbe-private",
       "--remote_instance_name=projects/pigweed-rbe-private/instances/default_instance",
@@ -1174,6 +1175,7 @@
       "test",
       "//...",
       "--experimental_ui_max_stdouterr_bytes=-1",
+      "--remote_download_outputs=minimal",
       "--config=remote_cache",
       "--bes_instance_name=pigweed-rbe-private",
       "--remote_instance_name=projects/pigweed-rbe-private/instances/default_instance",
@@ -1273,6 +1275,7 @@
       "build",
       "//...",
       "--experimental_ui_max_stdouterr_bytes=-1",
+      "--remote_download_outputs=minimal",
       "--config=remote_cache",
       "--bes_instance_name=pigweed-rbe-private",
       "--remote_instance_name=projects/pigweed-rbe-private/instances/default_instance",
@@ -1374,6 +1377,7 @@
       "test",
       "//...",
       "--experimental_ui_max_stdouterr_bytes=-1",
+      "--remote_download_outputs=minimal",
       "--config=remote_cache",
       "--bes_instance_name=pigweed-rbe-private",
       "--remote_instance_name=projects/pigweed-rbe-private/instances/default_instance",