[auto_roller] Make gerrit link more prominent
This will add a "gerrit link" to a roller CL in the "summary" column on
a builder page and in the "Overview" box on a build results page. Those
are both much more prominent locations than the link's current location
buried under a bunch of steps. This should hopefully help build cops and
other Fuchsia developers more easily access roll CLs.
There are two caveats:
- There's a LUCI bug that hides summaries for successful builds, so we
can't show this for green rolls. So I only bother showing it for
failed rolls.
- Due to another bug where led doesn't handle overall build statuses
correctly, I can't use led to test whether the markdown will be
properly displayed as a hyperlink. However, I think this is very
unlikely to break anything, so it should be safe to just deploy it and
see what happens.
Change-Id: I73fa03f0d9a3b98baab542def5c2db1ae9d63f7e
diff --git a/recipe_modules/auto_roller/api.py b/recipe_modules/auto_roller/api.py
index 787d3c6..0240e73 100644
--- a/recipe_modules/auto_roller/api.py
+++ b/recipe_modules/auto_roller/api.py
@@ -380,16 +380,19 @@
self.m.gerrit.abandon('abandon roll: ' + reason, change.full_id)
else:
self.m.step(reason, None)
+ cl_url = self._gerrit_link(change.id)
self.m.step.active_result.presentation.links[
- self._gerrit_link_name] = self._gerrit_link(change.id)
+ self._gerrit_link_name] = cl_url
- raise self.m.step.StepFailure(
- 'Failed to roll changes: {reason}.\n\n'
- 'See the link titled "{link}" in the build console to access the Gerrit '
- 'change.'.format(
- reason=reason,
- link=self._gerrit_link_name,
- ))
+ # TODO(olivernewman): Display the gerrit link in the build summary_markdown
+ # once luci_runner is deployed and Milo is able to display summary_markdown
+ # for passed builds.
+ raise self.m.step.StepFailure('Failed to roll changes: {reason}.\n\n'
+ '[{link_name}]({url})'.format(
+ reason=reason,
+ link_name=self._gerrit_link_name,
+ url=cl_url,
+ ))
def _gerrit_link(self, change_id):
return self.m.url.join(self.m.gerrit.host, 'q', change_id)
@@ -402,7 +405,6 @@
otherwise, no new entries are added.
Args:
- api (RecipeApi): Recipe API object.
manifest (Path): Path to the Jiri manifest to update.
project_name (str): Name of the project in the Jiri manifest to update.
revision (str): SHA-1 hash representing the updated revision for
@@ -465,7 +467,6 @@
otherwise, no new entries are added.
Args:
- api (RecipeApi): Recipe API object.
manifest (Path): Path to the Jiri manifest to update.
package_name (str): Name of the package in the Jiri manifest to update.
version (str): String representing the updated version for package_name
diff --git a/recipe_modules/auto_roller/examples/full.expected/zircon_abandoned.json b/recipe_modules/auto_roller/examples/full.expected/zircon_abandoned.json
index 87fbaab..ff3fc35 100644
--- a/recipe_modules/auto_roller/examples/full.expected/zircon_abandoned.json
+++ b/recipe_modules/auto_roller/examples/full.expected/zircon_abandoned.json
@@ -365,7 +365,7 @@
{
"failure": {
"failure": {},
- "humanReason": "Failed to roll changes: CL manually abandoned.\n\nSee the link titled \"gerrit link\" in the build console to access the Gerrit change."
+ "humanReason": "Failed to roll changes: CL manually abandoned.\n\n[gerrit link](https://fuchsia-review.googlesource.com/q/Iabc123)"
},
"name": "$result"
}
diff --git a/recipe_modules/auto_roller/examples/full.expected/zircon_cq_failure.json b/recipe_modules/auto_roller/examples/full.expected/zircon_cq_failure.json
index 788df00..73727ba 100644
--- a/recipe_modules/auto_roller/examples/full.expected/zircon_cq_failure.json
+++ b/recipe_modules/auto_roller/examples/full.expected/zircon_cq_failure.json
@@ -375,7 +375,7 @@
{
"failure": {
"failure": {},
- "humanReason": "Failed to roll changes: CQ failed.\n\nSee the link titled \"gerrit link\" in the build console to access the Gerrit change."
+ "humanReason": "Failed to roll changes: CQ failed.\n\n[gerrit link](https://fuchsia-review.googlesource.com/q/Iabc123)"
},
"name": "$result"
}
diff --git a/recipe_modules/auto_roller/examples/full.expected/zircon_timeout.json b/recipe_modules/auto_roller/examples/full.expected/zircon_timeout.json
index 82d65dd..f00cca7 100644
--- a/recipe_modules/auto_roller/examples/full.expected/zircon_timeout.json
+++ b/recipe_modules/auto_roller/examples/full.expected/zircon_timeout.json
@@ -403,7 +403,7 @@
{
"failure": {
"failure": {},
- "humanReason": "Failed to roll changes: auto-roller timeout.\n\nSee the link titled \"gerrit link\" in the build console to access the Gerrit change."
+ "humanReason": "Failed to roll changes: auto-roller timeout.\n\n[gerrit link](https://fuchsia-review.googlesource.com/q/Iabc123)"
},
"name": "$result"
}
diff --git a/recipes/cipd_with_dependencies_roller.expected/dependencies_satisfied.json b/recipes/cipd_with_dependencies_roller.expected/dependencies_satisfied.json
index 41854ad..5ad0588 100644
--- a/recipes/cipd_with_dependencies_roller.expected/dependencies_satisfied.json
+++ b/recipes/cipd_with_dependencies_roller.expected/dependencies_satisfied.json
@@ -512,7 +512,7 @@
{
"failure": {
"failure": {},
- "humanReason": "Failed to roll changes: CQ failed.\n\nSee the link titled \"gerrit link\" in the build console to access the Gerrit change."
+ "humanReason": "Failed to roll changes: CQ failed.\n\n[gerrit link](https://fuchsia-review.googlesource.com/q/Iabc123)"
},
"name": "$result"
}