[Buildbot-devel] buildbot notification emails - adding got_revision numbers
Chris Kwan
chriswkwan at gmail.com
Mon May 4 10:37:29 UTC 2009
Hi all,
I want to get the Got_Revision number for the latest build that certain
builder has finished building and also the Got_Revision number of the build
built just before it. I want to append these two numbers to the email that
buildbot sends out once it finishes a build. The problems I am running into
are how to get these numbers and then how to get them to the mail notifier.
I have been able to access these numbers in ...buildbot\status\web\build.py
(which dynamically generates the buildbot web-interface webpage for a build
given its number) with the following code:
#Get the build number and get_revision of the current build
#I believe that the “b” referred to below comes from line 33: b =
self.build_status
myBuildNum = b.getProperty("buildnumber")
myGotRev = b.getProperty("got_revision")
#Get the build number and get_revision of the last build
#We get the last build by looking at all the previous builds
#starting at our build number and decrementing
#We stop when we hit a build whose got_revision number
#is less than the current build's got_revision
myBuilder = b.getBuilder() #the builder
numBuildsLeft = myBuildNum #how many builds are left to check
lastGotRev = myGotRev #got_revision number of last build
while numBuildsLeft >= 0 and lastGotRev >= myGotRev:
lastBuild = myBuilder.getBuild(numBuildsLeft)
try:
if lastBuild:
lastGotRev = lastBuild.getProperty("got_revision")
except KeyError:
print "None. This build failed.\n"
except:
print "Unexpected Error \n"
numBuildsLeft = numBuildsLeft-1
With the above method, I am able to get the two numbers that I need. However,
the problem is how to get them to the mail notifier which is in
…buildbot\status\mail.py, so that they can be put into the emails.
· What is the best way to access these properties (the get_revision
numbers of builds) in mail.py?
· Is there a way that I put the above code inside of mail.py
directly?
Any help or suggestions would be greatly appreciated.
Thank you,
Christopher
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20090504/b01d209b/attachment.html>
More information about the devel
mailing list