Report correctly when dequeuing dependent changes
The change in commit b7179777f4df9d0832abb12c2fb055ab60b4499d
(change I98eb8b8817bbda57efc2ef5bfcc2a5076fe8f4fd) erroneously
altered the logic in formatReport. The "dequeued_needing_change"
flag was only checked if the merger encountered a merge conflict.
So, a change whose parent was dequeued would only be reported as
having been dequeued if it had a merge conflict. In the (frequent)
case that a change is dequeued because its parent failed tests or
otherwise failed to merge, but has no merge conflicts itself, the
flag was not checked and the usual path of displaying job results
was taken. In our configuration, it is not possible to format
those job results (they are all SKIPPED), so Zuul would log an
exception and not report.
This change restores the original hierarchy of report types:
1. Dequeued because it depends on a change that failed to merge.
2. Merge conflict.
3. Job report.
It also moves the bulk of the job report formatting to its own
method so that the logic around the report types is more clear,
and reduces redundancy introduced by the report footer option.
Finally, it updates a test to verify that the correct report types
are issued.
Story: #147
Change-Id: If1fe3af8b4d0896a9e43d8163bc2690663df0637
Co-Authored-By: James E. Blair <jeblair@hp.com>
diff --git a/zuul/scheduler.py b/zuul/scheduler.py
index c7ab3aa..5e20e58 100644
--- a/zuul/scheduler.py
+++ b/zuul/scheduler.py
@@ -1460,19 +1460,25 @@
def formatReport(self, item):
ret = ''
- if not self.pipeline.didMergerSucceed(item):
+ if item.dequeued_needing_change:
+ ret += 'This change depends on a change that failed to merge.\n'
+ elif not self.pipeline.didMergerSucceed(item):
ret += self.pipeline.merge_failure_message
- if item.dequeued_needing_change:
- ret += ('\n\nThis change depends on a change that failed to '
- 'merge.')
- if self.pipeline.footer_message:
- ret += '\n\n' + self.pipeline.footer_message
- return ret
-
- if self.pipeline.didAllJobsSucceed(item):
- ret += self.pipeline.success_message + '\n\n'
else:
- ret += self.pipeline.failure_message + '\n\n'
+ if self.pipeline.didAllJobsSucceed(item):
+ ret += self.pipeline.success_message + '\n\n'
+ else:
+ ret += self.pipeline.failure_message + '\n\n'
+ ret += self._formatReportJobs(item)
+
+ if self.pipeline.footer_message:
+ ret += '\n' + self.pipeline.footer_message
+
+ return ret
+
+ def _formatReportJobs(self, item):
+ # Return the list of jobs portion of the report
+ ret = ''
if self.sched.config.has_option('zuul', 'url_pattern'):
url_pattern = self.sched.config.get('zuul', 'url_pattern')
@@ -1523,8 +1529,6 @@
name = job.name + ' '
ret += '- %s%s : %s%s%s\n' % (name, url, result, elapsed,
voting)
- if self.pipeline.footer_message:
- ret += '\n' + self.pipeline.footer_message
return ret
def formatDescription(self, build):