rerunner: Add property for number of builds
Bug: b/290611584
Change-Id: I511ada160008f13dcc87594e19f72c3e72a72092
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/154690
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.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/rerunner.proto b/recipes/rerunner.proto
index d7bb790..dc2c5d5 100644
--- a/recipes/rerunner.proto
+++ b/recipes/rerunner.proto
@@ -17,7 +17,8 @@
package recipes.pigweed.rerunner;
message InputProperties {
- // Buckets to include from rerunning. Uses glob-style matching.
+ // Buckets to include in rerunning. Uses glob-style matching. Defaults to
+ // ["*.ci", "ci"].
repeated string included_buckets = 1;
// Buckets to exclude from rerunning. Uses glob-style matching. Overrides
@@ -26,4 +27,7 @@
// Don't do anything that has external effects.
bool dry_run = 3;
+
+ // Number of past builds to check. Defaults to 10.
+ int32 num_builds = 4;
}
diff --git a/recipes/rerunner.py b/recipes/rerunner.py
index 7b583ec..bbc6eae 100644
--- a/recipes/rerunner.py
+++ b/recipes/rerunner.py
@@ -85,13 +85,15 @@
with api.step.nest(bucket.name):
for builder in bucket.swarming.builders:
+ num_builds = props.num_builds or 10
+
with api.step.nest(builder.name):
# Don't DoS buildbucket. (And there's no need for this
# builder to run quickly.)
api.time.sleep(1)
status = api.builder_status.retrieve(
- bucket=bucket.name, builder=builder.name,
+ bucket=bucket.name, builder=builder.name, n=num_builds
)
# If the builder is currently running, don't start a new