rerunner: Add RawResult returns
Bug: b/288464961
Change-Id: I8f74930c892f08aaafcf83b4b33a6228729dfd99
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/154502
Reviewed-by: Oliver Newman <olivernewman@google.com>
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/recipes/rerunner.py b/recipes/rerunner.py
index 279ab5d..7b583ec 100644
--- a/recipes/rerunner.py
+++ b/recipes/rerunner.py
@@ -34,6 +34,8 @@
import fnmatch
from typing import Sequence, Tuple
+from PB.recipe_engine import result as result_pb2
+from PB.go.chromium.org.luci.buildbucket.proto import common as common_pb2
from PB.go.chromium.org.luci.buildbucket.proto import project_config as bb_cfg
from PB.recipes.pigweed.rerunner import InputProperties
from PB.recipe_engine import result
@@ -120,22 +122,50 @@
if not schedule_requests:
api.step('nothing to launch', None)
- return
+ return result_pb2.RawResult(
+ summary_markdown='nothing to launch', status=common_pb2.SUCCESS,
+ )
if props.dry_run:
with api.step.nest('dry-run, not launching builds'):
+ links = []
for req in schedule_requests:
- api.step(
- f'{req.builder.bucket}/{req.builder.builder}', None,
+ bucket_builder = f'{req.builder.bucket}/{req.builder.builder}'
+ api.step(bucket_builder, None)
+ links.append(
+ (
+ bucket_builder,
+ f'https://ci.chromium.org/ui/p/{req.builder.project}/'
+ f'builders/{bucket_builder}',
+ )
)
- return
+
+ links_combined = ''.join(
+ f'<br/>[{name}]({link})' for name, link in links
+ )
+
+ return result_pb2.RawResult(
+ summary_markdown=f'dry-run, would have launched: {links_combined}',
+ status=common_pb2.SUCCESS,
+ )
with api.step.nest('launch') as pres:
builds = api.buildbucket.schedule(schedule_requests)
+ links = []
for build in builds:
- pres.links[
- f'{build.builder.bucket}/{build.builder.builder}'
- ] = api.buildbucket.build_url(build_id=build.id)
+ bucket_builder = f'{build.builder.bucket}/{build.builder.builder}'
+ link = api.buildbucket.build_url(build_id=build.id)
+ pres.links[bucket_builder] = link
+ links.append((bucket_builder, link))
+
+ links_combined = ''.join(
+ f'<br/>[{name}]({link})' for name, link in links
+ )
+
+ return result_pb2.RawResult(
+ summary_markdown=f'launched: {links_combined}',
+ status=common_pb2.SUCCESS,
+ )
def GenTests(api): # pylint: disable=invalid-name