cipd_roller: Add overall "name" option
Bug: b/352815723
Change-Id: Ib48ceb11ce76796093498312c61bcc30b8ecde5e
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/223094
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: Ted Pudlik <tpudlik@google.com>
diff --git a/recipes/cipd_roller.proto b/recipes/cipd_roller.proto
index d48a358..4ea7143 100644
--- a/recipes/cipd_roller.proto
+++ b/recipes/cipd_roller.proto
@@ -53,4 +53,8 @@
// Auto roller module options.
recipe_modules.fuchsia.auto_roller.Options auto_roller_options = 10;
+
+ // Name to use in the commit message ("roll: <roll_name>"). Defaults to a list
+ // of the basenames of package names.
+ string roll_name = 2;
}
diff --git a/recipes/cipd_roller.py b/recipes/cipd_roller.py
index ad80fc0..2077466 100644
--- a/recipes/cipd_roller.py
+++ b/recipes/cipd_roller.py
@@ -132,11 +132,14 @@
class Commit:
rolls: List[Roll] = dataclasses.field(default_factory=list)
- def message(self):
+ def message(self, name: str | None = None):
rolls = sorted(self.rolls)
+ if not name:
+ name = ", ".join(x.package_name for x in rolls)
+
result = []
- result.append(f'roll: {", ".join(x.package_name for x in rolls)}')
+ result.append(f'roll: {name}')
if len(rolls) == 1:
result.append('')
@@ -296,7 +299,7 @@
change = api.auto_roller.attempt_roll(
props.auto_roller_options,
repo_dir=checkout.root,
- commit_message=commit.message(),
+ commit_message=commit.message(name=props.roll_name),
)
return api.auto_roller.raw_result(change)