roll_commenter: Add builder name to comment
Adding the builder name to any comments written to Gerrit. This will
make it obvious to users that we're dealing with public
("roll-commenter-pigweed") or internal
("roll-commenter-pigweed-internal") rollers.
Bug: b/369718402
Change-Id: Ic1091a1547e423ffd19ad0a8b912e0efbdf0f226
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/254932
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dave Roth <davidroth@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
diff --git a/recipes/roll_commenter.expected/new_roller.json b/recipes/roll_commenter.expected/new_roller.json
index 3617c23..cf536cf 100644
--- a/recipes/roll_commenter.expected/new_roller.json
+++ b/recipes/roll_commenter.expected/new_roller.json
@@ -631,7 +631,7 @@
"-host",
"https://pigweed-review.googlesource.com",
"-input",
- "{\"change_id\": \"1234\", \"input\": {\"message\": \"Successfully rolled into 3 projects\", \"notify\": \"OWNER\", \"tag\": \"autogenerated:project:builder:bbid=8945511751514863184\"}, \"revision_id\": \"current\"}",
+ "{\"change_id\": \"1234\", \"input\": {\"message\": \"builder: Successfully rolled into 3 projects\", \"notify\": \"OWNER\", \"tag\": \"autogenerated:project:builder:bbid=8945511751514863184\"}, \"revision_id\": \"current\"}",
"-output",
"/path/to/tmp/json"
],
@@ -652,14 +652,14 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_SUMMARY_TEXT@Successfully rolled into 3 projects@@@",
+ "@@@STEP_SUMMARY_TEXT@builder: Successfully rolled into 3 projects@@@",
"@@@STEP_LOG_END@json.output (invalid)@@@",
"@@@STEP_LOG_LINE@json.output (exception)@No JSON object could be decoded@@@",
"@@@STEP_LOG_END@json.output (exception)@@@",
"@@@STEP_LOG_LINE@json.input@{@@@",
"@@@STEP_LOG_LINE@json.input@ \"change_id\": \"1234\",@@@",
"@@@STEP_LOG_LINE@json.input@ \"input\": {@@@",
- "@@@STEP_LOG_LINE@json.input@ \"message\": \"Successfully rolled into 3 projects\",@@@",
+ "@@@STEP_LOG_LINE@json.input@ \"message\": \"builder: Successfully rolled into 3 projects\",@@@",
"@@@STEP_LOG_LINE@json.input@ \"notify\": \"OWNER\",@@@",
"@@@STEP_LOG_LINE@json.input@ \"tag\": \"autogenerated:project:builder:bbid=8945511751514863184\"@@@",
"@@@STEP_LOG_LINE@json.input@ },@@@",
diff --git a/recipes/roll_commenter.expected/no_forward_progress.json b/recipes/roll_commenter.expected/no_forward_progress.json
index 3eb05c1..e95d432 100644
--- a/recipes/roll_commenter.expected/no_forward_progress.json
+++ b/recipes/roll_commenter.expected/no_forward_progress.json
@@ -652,7 +652,7 @@
"-host",
"https://pigweed-review.googlesource.com",
"-input",
- "{\"change_id\": \"1234\", \"input\": {\"message\": \"1 roller failing:\\n\\n* [project/roll/foo-roller](https://cr-buildbucket.appspot.com/builder/project/roll/foo-roller)\", \"notify\": \"OWNER\", \"tag\": \"autogenerated:project:builder:bbid=8945511751514863184\"}, \"revision_id\": \"current\"}",
+ "{\"change_id\": \"1234\", \"input\": {\"message\": \"builder:\\n1 roller failing:\\n\\n* [project/roll/foo-roller](https://cr-buildbucket.appspot.com/builder/project/roll/foo-roller)\", \"notify\": \"OWNER\", \"tag\": \"autogenerated:project:builder:bbid=8945511751514863184\"}, \"revision_id\": \"current\"}",
"-output",
"/path/to/tmp/json"
],
@@ -673,14 +673,14 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_SUMMARY_TEXT@1 roller failing:\n\n* [project/roll/foo-roller](https://cr-buildbucket.appspot.com/builder/project/roll/foo-roller)@@@",
+ "@@@STEP_SUMMARY_TEXT@builder:\n1 roller failing:\n\n* [project/roll/foo-roller](https://cr-buildbucket.appspot.com/builder/project/roll/foo-roller)@@@",
"@@@STEP_LOG_END@json.output (invalid)@@@",
"@@@STEP_LOG_LINE@json.output (exception)@No JSON object could be decoded@@@",
"@@@STEP_LOG_END@json.output (exception)@@@",
"@@@STEP_LOG_LINE@json.input@{@@@",
"@@@STEP_LOG_LINE@json.input@ \"change_id\": \"1234\",@@@",
"@@@STEP_LOG_LINE@json.input@ \"input\": {@@@",
- "@@@STEP_LOG_LINE@json.input@ \"message\": \"1 roller failing:\\n\\n* [project/roll/foo-roller](https://cr-buildbucket.appspot.com/builder/project/roll/foo-roller)\",@@@",
+ "@@@STEP_LOG_LINE@json.input@ \"message\": \"builder:\\n1 roller failing:\\n\\n* [project/roll/foo-roller](https://cr-buildbucket.appspot.com/builder/project/roll/foo-roller)\",@@@",
"@@@STEP_LOG_LINE@json.input@ \"notify\": \"OWNER\",@@@",
"@@@STEP_LOG_LINE@json.input@ \"tag\": \"autogenerated:project:builder:bbid=8945511751514863184\"@@@",
"@@@STEP_LOG_LINE@json.input@ },@@@",
@@ -803,7 +803,7 @@
"-host",
"https://pigweed-review.googlesource.com",
"-input",
- "{\"change_id\": \"1234\", \"input\": {\"message\": \"1 roller failing:\\n\\n* [project/roll/foo-roller](https://cr-buildbucket.appspot.com/builder/project/roll/foo-roller)\", \"notify\": \"OWNER\", \"tag\": \"autogenerated:project:builder:bbid=8945511751514863184\"}, \"revision_id\": \"current\"}",
+ "{\"change_id\": \"1234\", \"input\": {\"message\": \"builder:\\n1 roller failing:\\n\\n* [project/roll/foo-roller](https://cr-buildbucket.appspot.com/builder/project/roll/foo-roller)\", \"notify\": \"OWNER\", \"tag\": \"autogenerated:project:builder:bbid=8945511751514863184\"}, \"revision_id\": \"current\"}",
"-output",
"/path/to/tmp/json"
],
@@ -824,14 +824,14 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_SUMMARY_TEXT@1 roller failing:\n\n* [project/roll/foo-roller](https://cr-buildbucket.appspot.com/builder/project/roll/foo-roller)@@@",
+ "@@@STEP_SUMMARY_TEXT@builder:\n1 roller failing:\n\n* [project/roll/foo-roller](https://cr-buildbucket.appspot.com/builder/project/roll/foo-roller)@@@",
"@@@STEP_LOG_END@json.output (invalid)@@@",
"@@@STEP_LOG_LINE@json.output (exception)@No JSON object could be decoded@@@",
"@@@STEP_LOG_END@json.output (exception)@@@",
"@@@STEP_LOG_LINE@json.input@{@@@",
"@@@STEP_LOG_LINE@json.input@ \"change_id\": \"1234\",@@@",
"@@@STEP_LOG_LINE@json.input@ \"input\": {@@@",
- "@@@STEP_LOG_LINE@json.input@ \"message\": \"1 roller failing:\\n\\n* [project/roll/foo-roller](https://cr-buildbucket.appspot.com/builder/project/roll/foo-roller)\",@@@",
+ "@@@STEP_LOG_LINE@json.input@ \"message\": \"builder:\\n1 roller failing:\\n\\n* [project/roll/foo-roller](https://cr-buildbucket.appspot.com/builder/project/roll/foo-roller)\",@@@",
"@@@STEP_LOG_LINE@json.input@ \"notify\": \"OWNER\",@@@",
"@@@STEP_LOG_LINE@json.input@ \"tag\": \"autogenerated:project:builder:bbid=8945511751514863184\"@@@",
"@@@STEP_LOG_LINE@json.input@ },@@@",
diff --git a/recipes/roll_commenter.expected/no_forward_progress_dry_run_already_warned.json b/recipes/roll_commenter.expected/no_forward_progress_dry_run_already_warned.json
index c114092..e7e32ef 100644
--- a/recipes/roll_commenter.expected/no_forward_progress_dry_run_already_warned.json
+++ b/recipes/roll_commenter.expected/no_forward_progress_dry_run_already_warned.json
@@ -650,7 +650,7 @@
"name": "c000011.warning",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_SUMMARY_TEXT@1 roller failing:\n\n* [88001](https://cr-buildbucket.appspot.com/build/88001)@@@"
+ "@@@STEP_SUMMARY_TEXT@builder:\n1 roller failing:\n\n* [88001](https://cr-buildbucket.appspot.com/build/88001)@@@"
]
},
{
@@ -785,7 +785,7 @@
"name": "c000009.warning",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_SUMMARY_TEXT@1 roller failing:\n\n* [88001](https://cr-buildbucket.appspot.com/build/88001)@@@"
+ "@@@STEP_SUMMARY_TEXT@builder:\n1 roller failing:\n\n* [88001](https://cr-buildbucket.appspot.com/build/88001)@@@"
]
},
{
diff --git a/recipes/roll_commenter.expected/one_successful_comment.json b/recipes/roll_commenter.expected/one_successful_comment.json
index 5bdaddd..e3a8772 100644
--- a/recipes/roll_commenter.expected/one_successful_comment.json
+++ b/recipes/roll_commenter.expected/one_successful_comment.json
@@ -571,7 +571,7 @@
"-host",
"https://pigweed-review.googlesource.com",
"-input",
- "{\"change_id\": \"1234\", \"input\": {\"message\": \"Successfully rolled into 3 projects\", \"notify\": \"OWNER\", \"tag\": \"autogenerated:project:builder:bbid=8945511751514863184\"}, \"revision_id\": \"current\"}",
+ "{\"change_id\": \"1234\", \"input\": {\"message\": \"builder: Successfully rolled into 3 projects\", \"notify\": \"OWNER\", \"tag\": \"autogenerated:project:builder:bbid=8945511751514863184\"}, \"revision_id\": \"current\"}",
"-output",
"/path/to/tmp/json"
],
@@ -592,14 +592,14 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_SUMMARY_TEXT@Successfully rolled into 3 projects@@@",
+ "@@@STEP_SUMMARY_TEXT@builder: Successfully rolled into 3 projects@@@",
"@@@STEP_LOG_END@json.output (invalid)@@@",
"@@@STEP_LOG_LINE@json.output (exception)@No JSON object could be decoded@@@",
"@@@STEP_LOG_END@json.output (exception)@@@",
"@@@STEP_LOG_LINE@json.input@{@@@",
"@@@STEP_LOG_LINE@json.input@ \"change_id\": \"1234\",@@@",
"@@@STEP_LOG_LINE@json.input@ \"input\": {@@@",
- "@@@STEP_LOG_LINE@json.input@ \"message\": \"Successfully rolled into 3 projects\",@@@",
+ "@@@STEP_LOG_LINE@json.input@ \"message\": \"builder: Successfully rolled into 3 projects\",@@@",
"@@@STEP_LOG_LINE@json.input@ \"notify\": \"OWNER\",@@@",
"@@@STEP_LOG_LINE@json.input@ \"tag\": \"autogenerated:project:builder:bbid=8945511751514863184\"@@@",
"@@@STEP_LOG_LINE@json.input@ },@@@",
diff --git a/recipes/roll_commenter.expected/one_successful_comment_dry_run_suppress.json b/recipes/roll_commenter.expected/one_successful_comment_dry_run_suppress.json
index 7a0baca..55e1df4 100644
--- a/recipes/roll_commenter.expected/one_successful_comment_dry_run_suppress.json
+++ b/recipes/roll_commenter.expected/one_successful_comment_dry_run_suppress.json
@@ -569,7 +569,7 @@
"name": "c000011.comment",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_SUMMARY_TEXT@Successfully rolled into 3 projects@@@"
+ "@@@STEP_SUMMARY_TEXT@builder: Successfully rolled into 3 projects@@@"
]
},
{
diff --git a/recipes/roll_commenter.expected/two_successful_comments.json b/recipes/roll_commenter.expected/two_successful_comments.json
index 0a82cdf..05c6d4c 100644
--- a/recipes/roll_commenter.expected/two_successful_comments.json
+++ b/recipes/roll_commenter.expected/two_successful_comments.json
@@ -571,7 +571,7 @@
"-host",
"https://pigweed-review.googlesource.com",
"-input",
- "{\"change_id\": \"1234\", \"input\": {\"message\": \"Successfully rolled into 3 projects\", \"notify\": \"OWNER\", \"tag\": \"autogenerated:project:builder:bbid=8945511751514863184\"}, \"revision_id\": \"current\"}",
+ "{\"change_id\": \"1234\", \"input\": {\"message\": \"builder: Successfully rolled into 3 projects\", \"notify\": \"OWNER\", \"tag\": \"autogenerated:project:builder:bbid=8945511751514863184\"}, \"revision_id\": \"current\"}",
"-output",
"/path/to/tmp/json"
],
@@ -592,14 +592,14 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_SUMMARY_TEXT@Successfully rolled into 3 projects@@@",
+ "@@@STEP_SUMMARY_TEXT@builder: Successfully rolled into 3 projects@@@",
"@@@STEP_LOG_END@json.output (invalid)@@@",
"@@@STEP_LOG_LINE@json.output (exception)@No JSON object could be decoded@@@",
"@@@STEP_LOG_END@json.output (exception)@@@",
"@@@STEP_LOG_LINE@json.input@{@@@",
"@@@STEP_LOG_LINE@json.input@ \"change_id\": \"1234\",@@@",
"@@@STEP_LOG_LINE@json.input@ \"input\": {@@@",
- "@@@STEP_LOG_LINE@json.input@ \"message\": \"Successfully rolled into 3 projects\",@@@",
+ "@@@STEP_LOG_LINE@json.input@ \"message\": \"builder: Successfully rolled into 3 projects\",@@@",
"@@@STEP_LOG_LINE@json.input@ \"notify\": \"OWNER\",@@@",
"@@@STEP_LOG_LINE@json.input@ \"tag\": \"autogenerated:project:builder:bbid=8945511751514863184\"@@@",
"@@@STEP_LOG_LINE@json.input@ },@@@",
@@ -668,7 +668,7 @@
"-host",
"https://pigweed-review.googlesource.com",
"-input",
- "{\"change_id\": \"1234\", \"input\": {\"message\": \"Successfully rolled into 3 projects\", \"notify\": \"OWNER\", \"tag\": \"autogenerated:project:builder:bbid=8945511751514863184\"}, \"revision_id\": \"current\"}",
+ "{\"change_id\": \"1234\", \"input\": {\"message\": \"builder: Successfully rolled into 3 projects\", \"notify\": \"OWNER\", \"tag\": \"autogenerated:project:builder:bbid=8945511751514863184\"}, \"revision_id\": \"current\"}",
"-output",
"/path/to/tmp/json"
],
@@ -689,14 +689,14 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_SUMMARY_TEXT@Successfully rolled into 3 projects@@@",
+ "@@@STEP_SUMMARY_TEXT@builder: Successfully rolled into 3 projects@@@",
"@@@STEP_LOG_END@json.output (invalid)@@@",
"@@@STEP_LOG_LINE@json.output (exception)@No JSON object could be decoded@@@",
"@@@STEP_LOG_END@json.output (exception)@@@",
"@@@STEP_LOG_LINE@json.input@{@@@",
"@@@STEP_LOG_LINE@json.input@ \"change_id\": \"1234\",@@@",
"@@@STEP_LOG_LINE@json.input@ \"input\": {@@@",
- "@@@STEP_LOG_LINE@json.input@ \"message\": \"Successfully rolled into 3 projects\",@@@",
+ "@@@STEP_LOG_LINE@json.input@ \"message\": \"builder: Successfully rolled into 3 projects\",@@@",
"@@@STEP_LOG_LINE@json.input@ \"notify\": \"OWNER\",@@@",
"@@@STEP_LOG_LINE@json.input@ \"tag\": \"autogenerated:project:builder:bbid=8945511751514863184\"@@@",
"@@@STEP_LOG_LINE@json.input@ },@@@",
diff --git a/recipes/roll_commenter.py b/recipes/roll_commenter.py
index 5ff6b40..53cc336 100644
--- a/recipes/roll_commenter.py
+++ b/recipes/roll_commenter.py
@@ -246,6 +246,7 @@
}
summary = (
+ f'{api.buildbucket.build.builder.builder}: '
f'Successfully rolled into {len(current_rolls)} '
f'project{"" if len(current_rolls) == 1 else "s"}'
)
@@ -362,6 +363,7 @@
num_failing = len(trailing_failing_rollers)
comment = [
+ f'{api.buildbucket.build.builder.builder}:',
f'{num_failing} roller{"" if num_failing == 1 else "s"} failing:',
'',
]