[Buildbot-devel] small patch for better build information

Alexander Lorenz lorenz at testingtech.de
Fri Aug 25 15:18:34 UTC 2006


hello,

i have always found it peculiar that a certain build shows the name of 
the slave on which it was built only after it has finished, and even 
that only if the build was successful.
while a build is running or  - much more important - when a build has 
failed, this information is not posted on the build's html page.
the only way of finding out where it was built was by parsing the 
environment of one of its buildsteps for the '$HOST' variable.

if you use multiple buildslaves per builder, like i do, you will 
understand how annoying it is to not have fast and easy info on where a 
certain build is being/was built.


so here comes a small patch that fixes this issue, comstisting of three 
parts.

- first of all, html.py is patched, so that the slave info is _always_ 
shown on the html page of a build and not only on finish.

- since this worked fine for failed builds, but ws unsuccessful for 
running builds (the slavename just showing '???'), i had to patch 
process/base.py to pass the slavename to the build at the _beginning_ of 
a build and not at the the end, like it did.

- and last but not least i patched mail.py, so that the buildslave 
information gets included in the notification emails.


this makes (location) tracing of builds much easier, and i think that 
especially people with multiple slaves per builder will appreciate this 
enhancement, and if brian likes it he could include it in the main trunk.


a word of caution though:
since i am running bb 0.7.2 and have not yet managed to upgrade to 0.7.4 
, the line numbers - especially for html.py - might not be correct.

there should be no merge conflicts though.



have fun!

alex


----------------------------------------

status/html.py:


--- html_old.py 2006-08-25 16:45:41.000000000 +0200
+++ html.py     2006-08-25 16:51:20.000000000 +0200
@@ -325,11 +325,11 @@
         data = "<a href=\"%s\">%s</a>\n" % (buildbotURL, projectName)
         # the color in the following line gives python-mode trouble
         data += ("<h1>Build <a href=\"%s\">%s</a>:#%d</h1>\n"
-                 "<h2>Reason:</h2>\n%s\n"
                  % (self.status.getURLForThing(b.getBuilder()),
-                    b.getBuilder().getName(), b.getNumber(),
-                    html.escape(b.getReason())))
-
+                    b.getBuilder().getName(), b.getNumber()))
+        data += "<h2>Buildslave:</h2>\n %s\n" % 
html.escape(b.getSlavename())
+        data += "<h2>Reason:</h2>\n%s\n" % html.escape(b.getReason())
+
         branch, revision, patch = b.getSourceStamp()
         data += "<h2>SourceStamp:</h2>\n"
         data += " <ul>\n"
@@ -346,7 +346,6 @@
             data += "  <li>build of most recent revision</li>\n"
         data += " </ul>\n"
         if b.isFinished():
-            data += "<h4>Buildslave: %s</h4>\n" % 
html.escape(b.getSlavename())
             data += "<h2>Results:</h2>\n"
             data += " ".join(b.getText()) + "\n"
             if b.getTestResults():

-------------------------------------------------------

process/base.py:


--- base_old.py 2006-08-25 17:03:06.000000000 +0200
+++ base.py     2006-08-25 17:00:41.000000000 +0200
@@ -267,6 +267,7 @@
         self.build_status = build_status
         self.slavebuilder = slavebuilder
         self.slavename = slavebuilder.slave.slavename
+        self.build_status.setSlavename(self.slavename)
         # convert all locks into their real forms
         self.locks = [self.builder.botmaster.getLockByID(l)
                       for l in self.locks]
@@ -514,7 +515,6 @@
         self.results = results

         log.msg(" %s: build finished" % self)
-        self.build_status.setSlavename(self.slavename)
         self.build_status.setText(text)
         self.build_status.setColor(color)
         self.build_status.setResults(results)

-------------------------------------------------------------

status/mail.py:


--- mail_old.py 2006-08-25 17:06:02.000000000 +0200
+++ mail.py     2006-08-25 16:15:52.000000000 +0200
@@ -251,6 +251,7 @@
         if url:
             text += "Buildbot URL: %s\n\n" % urllib.quote(url, '/:')

+        text += "Buildslave for this Build: %s\n\n" % build.getSlavename()
         text += "Build Reason: %s\n" % build.getReason()

         patch = None

---------------------------------------------------------------







More information about the devel mailing list