bazel_roll: Run 'bazel mod deps' from workspace
Also, update step name.
Bug: b/365847196
Change-Id: If8fd631ff5041078b16068c21a1b45be2f6c2be5
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/235216
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
Reviewed-by: Taylor Cramer <cramertj@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
diff --git a/recipe_modules/bazel_roll/__init__.py b/recipe_modules/bazel_roll/__init__.py
index 6c14066..ea98f79 100644
--- a/recipe_modules/bazel_roll/__init__.py
+++ b/recipe_modules/bazel_roll/__init__.py
@@ -19,6 +19,7 @@
DEPS = [
'fuchsia/git_roll_util',
'pigweed/bazel',
+ 'recipe_engine/context',
'recipe_engine/path',
'recipe_engine/step',
]
diff --git a/recipe_modules/bazel_roll/api.py b/recipe_modules/bazel_roll/api.py
index 400908e..6a44d16 100644
--- a/recipe_modules/bazel_roll/api.py
+++ b/recipe_modules/bazel_roll/api.py
@@ -146,9 +146,10 @@
options=BazelOptions(),
)
- self.m.step(
- 'bazelisk build --nobuild',
- [runner.ensure(), 'mod', 'deps', '--lockfile_mode=update'],
- )
+ with self.m.context(cwd=checkout.root):
+ self.m.step(
+ 'bazelisk mod deps --lockfile_mode=update',
+ [runner.ensure(), 'mod', 'deps', '--lockfile_mode=update'],
+ )
return [roll]
diff --git a/recipe_modules/bazel_roll/tests/full.expected/no-trigger.json b/recipe_modules/bazel_roll/tests/full.expected/no-trigger.json
index 2f2a210..02c1a96 100644
--- a/recipe_modules/bazel_roll/tests/full.expected/no-trigger.json
+++ b/recipe_modules/bazel_roll/tests/full.expected/no-trigger.json
@@ -611,6 +611,7 @@
"-json-output",
"/path/to/tmp/json"
],
+ "cwd": "[START_DIR]/checkout",
"name": "update MODULE.bazel.lock.ensure bazelisk",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@",
@@ -632,6 +633,7 @@
"[CLEANUP]/tmp_tmp_1/bazelisk",
"version"
],
+ "cwd": "[START_DIR]/checkout",
"name": "update MODULE.bazel.lock.bazel version",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
@@ -644,7 +646,8 @@
"deps",
"--lockfile_mode=update"
],
- "name": "update MODULE.bazel.lock.bazelisk build --nobuild",
+ "cwd": "[START_DIR]/checkout",
+ "name": "update MODULE.bazel.lock.bazelisk mod deps --lockfile_mode=update",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
diff --git a/recipe_modules/bazel_roll/tests/full.expected/success.json b/recipe_modules/bazel_roll/tests/full.expected/success.json
index d85feb4..557539e 100644
--- a/recipe_modules/bazel_roll/tests/full.expected/success.json
+++ b/recipe_modules/bazel_roll/tests/full.expected/success.json
@@ -740,6 +740,7 @@
"-json-output",
"/path/to/tmp/json"
],
+ "cwd": "[START_DIR]/checkout",
"luci_context": {
"realm": {
"name": "project:ci"
@@ -773,6 +774,7 @@
"[CLEANUP]/tmp_tmp_1/bazelisk",
"version"
],
+ "cwd": "[START_DIR]/checkout",
"luci_context": {
"realm": {
"name": "project:ci"
@@ -797,6 +799,7 @@
"deps",
"--lockfile_mode=update"
],
+ "cwd": "[START_DIR]/checkout",
"luci_context": {
"realm": {
"name": "project:ci"
@@ -809,7 +812,7 @@
"hostname": "rdbhost"
}
},
- "name": "update MODULE.bazel.lock.bazelisk build --nobuild",
+ "name": "update MODULE.bazel.lock.bazelisk mod deps --lockfile_mode=update",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
diff --git a/recipes/bazel_roller.expected/success.json b/recipes/bazel_roller.expected/success.json
index b984660..bcfa777 100644
--- a/recipes/bazel_roller.expected/success.json
+++ b/recipes/bazel_roller.expected/success.json
@@ -1690,6 +1690,7 @@
"-json-output",
"/path/to/tmp/json"
],
+ "cwd": "[START_DIR]/co",
"luci_context": {
"realm": {
"name": "project:ci"
@@ -1723,6 +1724,7 @@
"[CLEANUP]/tmp_tmp_1/bazelisk",
"version"
],
+ "cwd": "[START_DIR]/co",
"luci_context": {
"realm": {
"name": "project:ci"
@@ -1747,6 +1749,7 @@
"deps",
"--lockfile_mode=update"
],
+ "cwd": "[START_DIR]/co",
"luci_context": {
"realm": {
"name": "project:ci"
@@ -1759,7 +1762,7 @@
"hostname": "rdbhost"
}
},
- "name": "update MODULE.bazel.lock.bazelisk build --nobuild",
+ "name": "update MODULE.bazel.lock.bazelisk mod deps --lockfile_mode=update",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]