[Buildbot-devel] Possibilities for GotRevision on email notification?
Aaron_Hsieh at PlayStation.Sony.Com
Aaron_Hsieh at PlayStation.Sony.Com
Fri Sep 19 00:34:41 UTC 2008
I actually didn't know you could access build properties like that. Well,
I have this so far as a patch for mail.py for now:
--- mail.py_bak 2008-09-18 15:31:05.000000000 -0700
+++ mail.py 2008-09-18 16:57:23.000000000 -0700
@@ -248,6 +248,7 @@
source = ""
if ss.branch:
source += "[branch %s] " % ss.branch
+ self.subject += " [branch %s]" % ss.branch
if ss.revision:
source += ss.revision
else:
@@ -312,10 +313,18 @@
m.set_payload(text)
m['Date'] = formatdate(localtime=True)
+ try:
+ revision = "r" + build.getProperty("got_revision")
+ except KeyError:
+ revision = None
+ if (revision is not None):
+ self.subject += " at %s" % revision
+
m['Subject'] = self.subject % { 'result': res,
'projectName': projectName,
'builder': name,
}
+
m['From'] = self.fromaddr
# m['To'] is added later
I even added a little bit to deal with branches just to shut some
developers up before they even bring it up. :P It's not the cleanest
patch in the world, nor is it very expandable, but it works well enough in
this scenario for now.
Aaron
Brian Warner <warner-buildbot at lothar.com>
09/18/2008 02:54 PM
To
Aaron Hsieh/R&D/SCEA at PLAYSTATION
cc
buildbot-devel at lists.sourceforge.net
Subject
Re: [Buildbot-devel] Possibilities for GotRevision on email notification?
> I just got a request from one of the developers here to include the
> revision number of the build into the subject of the build
> notification email that gets sent out at the end of every build. So
> far, I am unable to do this, and was wondering if anybody else out
> there has done this before.
I haven't done this before, but I'd try subclassing MailNotifier, override
buildMessage (you may have to copy most of it into your subclass.. it
isn't
very well designed for this sort of thing), and add code like:
try:
revision = "r" + build.getProperty("got_revision")
except KeyError:
revision = ""
m['Subject'] = "stuff rev=%s" % revision
We could probably use an extra delegate-to-self call in the end of
MailNotifier, to make this easier: a method that could be overridden to
modify the email before it gets handed off to the SMTP delivery method.
Patches welcome :).
cheers,
-Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20080918/c1e7072f/attachment.html>
More information about the devel
mailing list