[Buildbot-devel] Extending buildbot to transmit xml result to the master

Andy Howell AndyHowell at austin.rr.com
Wed Oct 7 14:20:21 UTC 2009


Anthony Viallard wrote:
> Hello everybody,
> 
> I have some difficulties to extend buildbot. I explain: after successful 
> compile, i want to launch a functional test program. This program 
> generate a xml file. So, after finishing the functionnal test, i want to 
> transmit this xml file to the master to make it possible to see it in 
> the webStatus interface (after a transformation in html with xsltproc).
> 
> I want this:
> 
> !-----------------!
> !      tests      !
> !                 !
> !     [result]    !
> !                 !
> !-----------------!
> !     compile     !
> !                 !
> !     [stdio]     !
> !                 !
> !-----------------!
> ....
> 
> And when clicking the result link, the html result page (generated with 
> xml file transmited) is displayed.
> 
> 
> If i use shellCommand, when clicking on "stdio" link in waterfall 
> webStatus interface, there already a html header generate, some 
> informations on environnement, etc and finaly the result "backquotted" :(
> 
> I think i have to extend shellCommand class for generating my own page 
> containing the xltproc result of my xml file. But, i don't known what 
> class i must extend (ShellCommand of ./steps/shell.py, ShellCommand of 
> ./slave/commands.py, ...) ?
> 
> What is the better solution ?
> 
> Anthony.
> 

Anthony,

	I'm quite new to buildbot. I've been experimenting with some code to upload a binary 
distribution after a build:

class DistFileUpload(FileUpload):
     def __init__(self, slavesrc, masterdest,
                  workdir=None, maxsize=None, blocksize=16*1024, mode=None,
                  **kwargs):
         FileUpload.__init__(self, slavesrc, masterdest,
                             workdir, maxsize, blocksize, mode,
                             **kwargs)

     def finished(self, result):
  #       if result == SUCCESS:
         buildnumber = self.getProperty("buildnumber")
         buildername = self.getProperty("buildername")
         url = "http://<hostname>/hello-%s-%s.tar" % (buildnumber, buildername)
         self.addURL("Binary",url)
         return FileUpload.finished(self,result)

f1 = factory.BuildFactory()
f1.addStep(CVS(cvsroot=cvsroot, cvsmodule=cvsmodule, login=None, mode="copy"))
f1.addStep(Compile(
            command=["make"]))
# Pass the buildnumber and builder name to the make file so that it can
# use them as part of the file anme
f1.addStep(Compile(
            command=["make", "dist",
                     WithProperties("buildno=%s", "buildnumber"),
	            WithProperties("builder=%s", "buildername")],
            description = ["building dist"],
            descriptionDone = ["distribution"]))

# Upload the file to the master and add url link to it.
f1.addStep(DistFileUpload(
            mode = 0644,
            slavesrc=WithProperties("hello-%s-%s.tar", "buildnumber", "buildername"),
            masterdest=WithProperties("~/builds/hello-%s-%s.tar", "buildnumber", 
"buildername")))

The class DistFileUpload takes care of uploading the file and then adding the link to the 
waterfall display.

There may be better, cleaner ways to do this, but this is working except for the test for 
SUCCESS in DistFileUpload.finished.


Regards,

	Andy




More information about the devel mailing list