Skip to content

Commit

Permalink
Control who gets notified by GerritStatusPush
Browse files Browse the repository at this point in the history
Allow the GerritStatusPush object to accept who to notify
as an argument. The notify argument is a string
which accepts values found in the gerrit documentation
for the --notify flag. The argument is set to "OWNER" by
default to reduce spam.

Signed-off-by: Giuseppe Di Natale <dinatale2@llnl.gov>
  • Loading branch information
dinatale2 committed Sep 23, 2016
1 parent 122f7da commit a702e1e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion master/buildbot/reporters/gerrit.py
Expand Up @@ -144,11 +144,12 @@ class GerritStatusPush(service.BuildbotService):
startArg = None
summaryCB = None
summaryArg = None
gerrit_notify = None

def reconfigService(self, server, username, reviewCB=DEFAULT_REVIEW,
startCB=None, port=29418, reviewArg=None,
startArg=None, summaryCB=DEFAULT_SUMMARY, summaryArg=None,
identity_file=None, builders=None):
identity_file=None, builders=None, notify='OWNER'):

# If neither reviewCB nor summaryCB were specified, default to sending
# out "summary" reviews. But if we were given a reviewCB and only a
Expand All @@ -175,6 +176,7 @@ def reconfigService(self, server, username, reviewCB=DEFAULT_REVIEW,
self.summaryCB = summaryCB
self.summaryArg = summaryArg
self.builders = builders
self.gerrit_notify = notify

def _gerritCmd(self, *args):
'''Construct a command as a list of strings suitable for
Expand Down Expand Up @@ -397,6 +399,10 @@ def sendCodeReview(self, project, revision, result):
return

command = self._gerritCmd("review", "--project %s" % (project,))

if self.gerrit_notify is not None:
command.extend(["--notify %s" % str(self.gerrit_notify)])

message = result.get('message', None)
if message:
command.append("--message '%s'" % message.replace("'", "\""))
Expand Down

0 comments on commit a702e1e

Please sign in to comment.