Merge "Remove source from reporter" into feature/zuulv3
This commit is contained in:
commit
ecdf5484f5
|
@ -25,14 +25,14 @@ class GerritReporter(BaseReporter):
|
|||
name = 'gerrit'
|
||||
log = logging.getLogger("zuul.GerritReporter")
|
||||
|
||||
def report(self, source, pipeline, item):
|
||||
def report(self, pipeline, item):
|
||||
"""Send a message to gerrit."""
|
||||
message = self._formatItemReport(pipeline, item)
|
||||
|
||||
self.log.debug("Report change %s, params %s, message: %s" %
|
||||
(item.change, self.config, message))
|
||||
changeid = '%s,%s' % (item.change.number, item.change.patchset)
|
||||
item.change._ref_sha = source.getRefSha(
|
||||
item.change._ref_sha = item.change.project.source.getRefSha(
|
||||
item.change.project, 'refs/heads/' + item.change.branch)
|
||||
|
||||
return self.connection.review(item.change.project.name, changeid,
|
||||
|
|
|
@ -39,7 +39,7 @@ class GithubReporter(BaseReporter):
|
|||
if not isinstance(self._unlabels, list):
|
||||
self._unlabels = [self._unlabels]
|
||||
|
||||
def report(self, source, pipeline, item):
|
||||
def report(self, pipeline, item):
|
||||
"""Comment on PR and set commit status."""
|
||||
if self._create_comment:
|
||||
self.addPullComment(pipeline, item)
|
||||
|
|
|
@ -24,7 +24,7 @@ class SMTPReporter(BaseReporter):
|
|||
name = 'smtp'
|
||||
log = logging.getLogger("zuul.SMTPReporter")
|
||||
|
||||
def report(self, source, pipeline, item):
|
||||
def report(self, pipeline, item):
|
||||
"""Send the compiled report message via smtp."""
|
||||
message = self._formatItemReport(pipeline, item)
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ class SQLReporter(BaseReporter):
|
|||
# TODO(jeblair): document this is stored as NULL if unspecified
|
||||
self.result_score = config.get('score', None)
|
||||
|
||||
def report(self, source, pipeline, item):
|
||||
def report(self, pipeline, item):
|
||||
"""Create an entry into a database."""
|
||||
|
||||
if not self.connection.tables_established:
|
||||
|
|
|
@ -146,20 +146,17 @@ class PipelineManager(object):
|
|||
|
||||
def reportStart(self, item):
|
||||
if not self.pipeline._disabled:
|
||||
source = item.change.project.source
|
||||
try:
|
||||
self.log.info("Reporting start, action %s item %s" %
|
||||
(self.pipeline.start_actions, item))
|
||||
ret = self.sendReport(self.pipeline.start_actions,
|
||||
source, item)
|
||||
ret = self.sendReport(self.pipeline.start_actions, item)
|
||||
if ret:
|
||||
self.log.error("Reporting item start %s received: %s" %
|
||||
(item, ret))
|
||||
except:
|
||||
self.log.exception("Exception while reporting start:")
|
||||
|
||||
def sendReport(self, action_reporters, source, item,
|
||||
message=None):
|
||||
def sendReport(self, action_reporters, item, message=None):
|
||||
"""Sends the built message off to configured reporters.
|
||||
|
||||
Takes the action_reporters, item, message and extra options and
|
||||
|
@ -168,7 +165,7 @@ class PipelineManager(object):
|
|||
report_errors = []
|
||||
if len(action_reporters) > 0:
|
||||
for reporter in action_reporters:
|
||||
ret = reporter.report(source, self.pipeline, item)
|
||||
ret = reporter.report(self.pipeline, item)
|
||||
if ret:
|
||||
report_errors.append(ret)
|
||||
if len(report_errors) == 0:
|
||||
|
@ -723,7 +720,6 @@ class PipelineManager(object):
|
|||
|
||||
def _reportItem(self, item):
|
||||
self.log.debug("Reporting change %s" % item.change)
|
||||
source = item.change.project.source
|
||||
ret = True # Means error as returned by trigger.report
|
||||
if item.getConfigError():
|
||||
self.log.debug("Invalid config for change %s" % item.change)
|
||||
|
@ -758,7 +754,7 @@ class PipelineManager(object):
|
|||
try:
|
||||
self.log.info("Reporting item %s, actions: %s" %
|
||||
(item, actions))
|
||||
ret = self.sendReport(actions, source, item)
|
||||
ret = self.sendReport(actions, item)
|
||||
if ret:
|
||||
self.log.error("Reporting item %s received: %s" %
|
||||
(item, ret))
|
||||
|
|
|
@ -37,7 +37,7 @@ class BaseReporter(object):
|
|||
self._action = action
|
||||
|
||||
@abc.abstractmethod
|
||||
def report(self, source, pipeline, item):
|
||||
def report(self, pipeline, item):
|
||||
"""Send the compiled report message."""
|
||||
|
||||
def getSubmitAllowNeeds(self):
|
||||
|
|
Loading…
Reference in New Issue