bazel: Don't use CQ RBE instances
Temporarily, so that they can be renamed.
Bug: 371043540
Change-Id: I8b885f96f70d669722d72817f43d62d3875f0777
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/260114
Commit-Queue: Ted Pudlik <tpudlik@google.com>
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
Reviewed-by: Rob Mohr <mohrr@google.com>
diff --git a/recipe_modules/bazel/api.py b/recipe_modules/bazel/api.py
index 2532749..3a8a4bf 100644
--- a/recipe_modules/bazel/api.py
+++ b/recipe_modules/bazel/api.py
@@ -122,32 +122,25 @@
# --config=remote already implies --config=remote_cache.
base_args.append('--config=remote_cache')
+ # TODO: b/371043540 - Use dedicated instance for CQ.
if self.api.buildbucket.build.builder.project == 'pigweed':
instance_name = 'pigweed-rbe-open'
else:
instance_name = 'pigweed-rbe-private'
- if self.api.buildbucket_util.is_tryjob:
- instance_name += '-pre'
+ if not self.api.buildbucket_util.is_tryjob:
+ base_args.append(f'--bes_instance_name={instance_name}')
- base_args.append(f'--bes_instance_name={instance_name}')
-
- if instance_name == 'pigweed-rbe-open':
- # Ted messed up and gave the pigweed-rbe-open RBE instance a
- # different name (default-instance instead of default_instance).
- # Sadly this is annoying to fix because instances cannot be renamed,
- # and you can't have more than one instance in a GCP region.
- #
- # TODO: b/312215590 - Fix this.
- base_args.append(
- '--remote_instance_name=projects/pigweed-rbe-open/instances/default-instance'
- )
- else:
- base_args.append(
- f'--remote_instance_name=projects/{instance_name}/instances/default_instance'
- )
+ base_args.append(
+ f'--remote_instance_name=projects/{instance_name}/instances/default-instance'
+ )
if config.get('upload_local_results'):
+ # TODO: b/371043540 - Use dedicated instance for CQ and write results.
+ if self.api.buildbucket_util.is_tryjob:
+ self.api.step.empty(
+ 'ignoring upload_local_results because running in CQ'
+ )
if not config.get('remote_cache'):
self.api.step.empty(
'ignoring upload_local_results since remote_cache is False'
diff --git a/recipe_modules/bazel/tests/full.py b/recipe_modules/bazel/tests/full.py
index dff2ea0..68bdf87 100644
--- a/recipe_modules/bazel/tests/full.py
+++ b/recipe_modules/bazel/tests/full.py
@@ -182,8 +182,7 @@
post_process.StepCommandContains,
'bazel build //...',
[
- '--bes_instance_name=pigweed-rbe-private-pre',
- '--remote_instance_name=projects/pigweed-rbe-private-pre/instances/default_instance',
+ '--remote_instance_name=projects/pigweed-rbe-private/instances/default-instance',
],
),
api.post_process(post_process.DropExpectation),
diff --git a/recipes/bazel.expected/simple.json b/recipes/bazel.expected/simple.json
index eb407f7..dc27298 100644
--- a/recipes/bazel.expected/simple.json
+++ b/recipes/bazel.expected/simple.json
@@ -143,7 +143,7 @@
"--remote_download_outputs=minimal",
"--config=remote_cache",
"--bes_instance_name=pigweed-rbe-private",
- "--remote_instance_name=projects/pigweed-rbe-private/instances/default_instance",
+ "--remote_instance_name=projects/pigweed-rbe-private/instances/default-instance",
"--remote_upload_local_results=true"
],
"cwd": "[START_DIR]/co",
@@ -178,7 +178,7 @@
"--remote_download_outputs=minimal",
"--config=remote_cache",
"--bes_instance_name=pigweed-rbe-private",
- "--remote_instance_name=projects/pigweed-rbe-private/instances/default_instance",
+ "--remote_instance_name=projects/pigweed-rbe-private/instances/default-instance",
"--remote_upload_local_results=true"
],
"cwd": "[START_DIR]/co",
@@ -278,7 +278,7 @@
"--remote_download_outputs=minimal",
"--config=remote_cache",
"--bes_instance_name=pigweed-rbe-private",
- "--remote_instance_name=projects/pigweed-rbe-private/instances/default_instance",
+ "--remote_instance_name=projects/pigweed-rbe-private/instances/default-instance",
"--remote_upload_local_results=true"
],
"cwd": "[START_DIR]/co",
@@ -380,7 +380,7 @@
"--remote_download_outputs=minimal",
"--config=remote_cache",
"--bes_instance_name=pigweed-rbe-private",
- "--remote_instance_name=projects/pigweed-rbe-private/instances/default_instance",
+ "--remote_instance_name=projects/pigweed-rbe-private/instances/default-instance",
"--remote_upload_local_results=true"
],
"cwd": "[START_DIR]/co",