[151820] contrib/buildbot-test/master.cfg
mojca at macports.org
mojca at macports.org
Mon Aug 22 13:01:43 PDT 2016
Revision: 151820
https://trac.macports.org/changeset/151820
Author: mojca at macports.org
Date: 2016-08-22 13:01:43 -0700 (Mon, 22 Aug 2016)
Log Message:
-----------
buildbot: send emails to responsible maintainers
Modified Paths:
--------------
contrib/buildbot-test/master.cfg
Modified: contrib/buildbot-test/master.cfg
===================================================================
--- contrib/buildbot-test/master.cfg 2016-08-22 19:49:28 UTC (rev 151819)
+++ contrib/buildbot-test/master.cfg 2016-08-22 20:01:43 UTC (rev 151820)
@@ -499,15 +499,17 @@
cancelPendingBuild = 'auth',
)
+from buildbot.status.mail import MailNotifier
+from twisted.internet import defer
+
# TODO: This is the old mail notifier;
# - useful functionality could be copied
# - then the code should be removed
#
import subprocess
from twisted.internet import defer
-from buildbot.status.mail import MailNotifier
# notifier that sends mail to last committers and maintainers of failed ports
-class PortsMailNotifier(MailNotifier):
+class OldPortsMailNotifier(MailNotifier):
# would make more sense to override getInterestedUsers() in BuildStatus,
# but it seems almost impossible to tell a builder to use a different
# class for status in its Build objects
@@ -548,10 +550,36 @@
dl.append(d)
return defer.gatherResults(dl)
+class PortsMailNotifier(MailNotifier):
+ def __init__(self, fromaddr, *args, **kwargs):
+ self.interested_users = set()
+ self.portMessageFormatter = kwargs.pop('portMessageFormatter')
+ super(PortsMailNotifier, self).__init__(fromaddr=fromaddr, *args, **kwargs)
+
+ # same as original, but calls portMessageFormatter with access to interested_users
+ def buildMessageDict(self, name, build, results):
+ msgdict = self.portMessageFormatter(self.mode, name, build, results,
+ self.master_status, self.interested_users)
+ return msgdict
+
+ def useLookup(self, build):
+ dl = []
+
+ # add additional recipients
+ for u in self.interested_users:
+ d = defer.maybeDeferred(self.lookup.getAddress, u)
+ dl.append(d)
+
+ # original list of recipients
+# for u in build.getResponsibleUsers() + build.getInterestedUsers():
+# d = defer.maybeDeferred(self.lookup.getAddress, u)
+# dl.append(d)
+ return defer.gatherResults(dl)
+
from buildbot.plugins import util
import datetime
-def portWatcherMessageFormatter(mode, name, build, results, master_status):
+def portWatcherMessageFormatter(mode, name, build, results, master_status, interested_users):
result = util.Results[results]
text = list()
text.append("Status: {:s}".format(result.title()))
@@ -593,6 +621,8 @@
if len(maintainers_to_notify) > 0:
text.append("\nResponsible maintainers:\n\t- {}".format("\n\t- ".join(sorted(maintainers_to_notify))))
+ for user in maintainers_to_notify:
+ interested_users.add(user)
# links to individual builds
text.append("\nLinks to individual build jobs:")
@@ -620,23 +650,30 @@
if production:
# send mail about base failures to users on the blamelist
- from buildbot.status.mail import MailNotifier
mn = MailNotifier(
fromaddr="noreply at macports.org",
+ # unless lookup is defined, users have to be configured locally
+ # maybe a smarter function is needed, but lookup="" does it for now
lookup="",
- relayhost="localhost",
+ mode=("problem"),
builders=base_buildernames,
- mode="problem")
+ #extraRecipients=["..."],
+ #smtpPort=25,
+ #relayhost="localhost",
+ sendToInterestedUsers=True)
c['status'].append(mn)
- mn = MailNotifier(
+ mn = PortsMailNotifier(
fromaddr="noreply at macports.org",
+ lookup="",
mode=("failing"),
builders=portwatcher_buildernames,
#extraRecipients=["..."],
- sendToInterestedUsers=False, # True
- messageFormatter=portWatcherMessageFormatter)
- # c['status'].append(mn)
+ #smtpPort=25,
+ #relayhost="localhost",
+ sendToInterestedUsers=True,
+ portMessageFormatter=portWatcherMessageFormatter)
+ c['status'].append(mn)
# notifications about exceptions
mn = MailNotifier(
@@ -646,10 +683,6 @@
sendToInterestedUsers=False)
# c['status'].append(mn)
-# mn = PortsMailNotifier(fromaddr="noreply at macports.org", lookup="", relayhost="localhost",
-# builders=ports_buildernames, mode="failing")
-# c['status'].append(mn)
-
####### PROJECT IDENTITY
from buildbot.plugins import util
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160822/edba1750/attachment-0001.html>
More information about the macports-changes
mailing list