First attempt to implement sending root e-mail
This commit is contained in:
parent
2d8c87ef12
commit
42027ddf8d
1 changed files with 43 additions and 3 deletions
46
master.cfg
46
master.cfg
|
@ -56,6 +56,9 @@ gdb_web_base = os.path.expanduser (os.path.join (basedir,
|
||||||
'results'))
|
'results'))
|
||||||
set_web_base (gdb_web_base)
|
set_web_base (gdb_web_base)
|
||||||
|
|
||||||
|
GDB_MAIL_FROM = 'sergiodj@redhat.com'
|
||||||
|
GDB_MAIL_TO = 'gdb-testers@sourceware.org'
|
||||||
|
|
||||||
# 'protocols' contains information about protocols which master will use for
|
# 'protocols' contains information about protocols which master will use for
|
||||||
# communicating with slaves.
|
# communicating with slaves.
|
||||||
c['protocols'] = {'pb': {'port': 16123}}
|
c['protocols'] = {'pb': {'port': 16123}}
|
||||||
|
@ -132,12 +135,48 @@ c['status'].append (html.WebStatus (http_port = 8010, authz = authz_cfg))
|
||||||
#c['status'].append(words.IRC(host="irc.yyz.redhat.com", nick="sdj-gdbbot",
|
#c['status'].append(words.IRC(host="irc.yyz.redhat.com", nick="sdj-gdbbot",
|
||||||
# channels=["#gdbbuild"]))
|
# channels=["#gdbbuild"]))
|
||||||
|
|
||||||
|
import smtplib
|
||||||
|
import socket
|
||||||
|
from email.mime.text import MIMEText
|
||||||
|
|
||||||
|
def SendRootMessageGDBTesters (branch, rev, change):
|
||||||
|
global GDB_MAIL_TO, GDB_MAIL_FROM
|
||||||
|
f = "/tmp/gdb-buildbot-%s.lock" % rev
|
||||||
|
|
||||||
|
if os.path.exists (f):
|
||||||
|
# The message has already been sent
|
||||||
|
return
|
||||||
|
|
||||||
|
open ("/tmp/%s" % rev, 'w').close ()
|
||||||
|
|
||||||
|
text = ""
|
||||||
|
text += "*** TEST RESULTS FOR COMMIT %s ***\n\n" % rev
|
||||||
|
|
||||||
|
text += "Author: %s\n" % change.who
|
||||||
|
text += "Branch: %s\n" % branch
|
||||||
|
text += "Commit: %s\n\n" % rev
|
||||||
|
|
||||||
|
text += change.comments + "\n"
|
||||||
|
|
||||||
|
mail = MIMEText (text)
|
||||||
|
mail['Subject'] = "Test results for commit %s on branch %s" % (rev, branch)
|
||||||
|
mail['From'] = GDB_MAIL_FROM
|
||||||
|
mail['To'] = GDB_MAIL_TO
|
||||||
|
mail['Message-Id'] = "%s@%s" (rev, socket.gethostname ())
|
||||||
|
|
||||||
|
s = smtplib.SMTP ('localhost')
|
||||||
|
s.sendmail (GDB_MAIL_FROM, [ GDB_MAIL_TO ], mail.as_string ())
|
||||||
|
s.quit ()
|
||||||
|
|
||||||
def MessageGDBTesters (mode, name, build, results, master_status):
|
def MessageGDBTesters (mode, name, build, results, master_status):
|
||||||
"""This function is responsible for composing the message that will be
|
"""This function is responsible for composing the message that will be
|
||||||
send to the gdb-testers mailing list."""
|
send to the gdb-testers mailing list."""
|
||||||
git_url = "http://gdb-build.sergiodj.net/cgit"
|
git_url = "http://gdb-build.sergiodj.net/cgit"
|
||||||
branch = build.getSourceStamps ()[0].branch
|
branch = build.getSourceStamps ()[0].branch
|
||||||
|
|
||||||
|
# Sending the root message to gdb-testers.
|
||||||
|
SendRootMessageGDBTesters (branch, name, ss_list[0].changes[0])
|
||||||
|
|
||||||
# Subject
|
# Subject
|
||||||
subj = "Failures on %s, branch %s" % (name, branch)
|
subj = "Failures on %s, branch %s" % (name, branch)
|
||||||
|
|
||||||
|
@ -241,12 +280,13 @@ send to the gdb-testers mailing list."""
|
||||||
'subject' : subj }
|
'subject' : subj }
|
||||||
|
|
||||||
from buildbot.status import mail
|
from buildbot.status import mail
|
||||||
mn = mail.MailNotifier(fromaddr = "sergiodj@redhat.com",
|
mn = mail.MailNotifier(fromaddr = GDB_MAIL_FROM,
|
||||||
sendToInterestedUsers = False,
|
sendToInterestedUsers = False,
|
||||||
extraRecipients = ['gdb-testers@sourceware.org'],
|
extraRecipients = [ GDB_MAIL_TO ],
|
||||||
mode = ('failing'),
|
mode = ('failing'),
|
||||||
messageFormatter = MessageGDBTesters,
|
messageFormatter = MessageGDBTesters,
|
||||||
extraHeaders = { 'X-GDB-Buildbot' : '1' })
|
extraHeaders = { 'X-GDB-Buildbot' : '1',
|
||||||
|
'In-Reply-To' : WithProperties ("%(got_revision)s@%s" % socket.gethostname ()) })
|
||||||
|
|
||||||
c['status'].append (mn)
|
c['status'].append (mn)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue