bazel_roll: Return a list of Roll objects
Bug: b/341756093
Change-Id: If52df924329bd0cf8e561f2edfa24cfc6881d71c
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/230834
Commit-Queue: Rob Mohr <mohrr@google.com>
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Danielle Kay <danikay@google.com>
diff --git a/recipe_modules/bazel_roll/api.py b/recipe_modules/bazel_roll/api.py
index dd8ff71..5fa2bb4 100644
--- a/recipe_modules/bazel_roll/api.py
+++ b/recipe_modules/bazel_roll/api.py
@@ -107,7 +107,7 @@
self,
checkout: checkout_self.m.CheckoutContext,
git_repository: GitRepository,
- ) -> dict[str, self.m.roll_util.Roll]:
+ ) -> list[roll_util_api.Roll]:
workspace_path = self.workspace_path(
checkout.root,
git_repository.workspace_path,
@@ -157,7 +157,7 @@
self.m.roll_util.skip_roll_step(
git_repository.remote, update_result.old_revision, new_revision
)
- return
+ return []
project_name = git_repository.name or update_result.project_name
if not project_name:
@@ -166,14 +166,14 @@
status='FAILURE',
)
- rolls: dict[str, self.m.roll_util.Roll] = {
- workspace_path: self.m.roll_util.create_roll(
+ return [
+ self.m.roll_util.create_roll(
project_name=project_name,
old_revision=update_result.old_revision,
new_revision=new_revision,
proj_dir=project_dir,
direction=direction,
),
- }
+ ]
return rolls
diff --git a/recipes/bazel_roller.py b/recipes/bazel_roller.py
index 3a1ed91..270a520 100644
--- a/recipes/bazel_roller.py
+++ b/recipes/bazel_roller.py
@@ -90,9 +90,7 @@
if not rolls:
return # pragma: no cover
- authors: Sequence[api.roll_util.Account] = api.roll_util.authors(
- *rolls.values()
- )
+ authors = api.roll_util.authors(*rolls)
author_override: Optional[api.roll_util.Account] = None
if len(authors) == 1 and props.forge_author:
@@ -103,7 +101,7 @@
change: api.auto_roller.GerritChange = api.auto_roller.attempt_roll(
props.auto_roller_options,
repo_dir=checkout.root,
- commit_message=api.roll_util.message(*rolls.values()),
+ commit_message=api.roll_util.message(*rolls),
author_override=author_override,
)