Nasty BuildBot hack

Published on

So today I started setting up my continuous integration environment (centred around Buildbot) for some freelance development I’m getting paid for. I got rid of world read-access to that subdirectory of my SVN and set up my builder in Buildbot as per usual.

However, this didn’t work; none of the changes in my new private project were picked up by Buildbot. It’s fairly obvious why – Buildbot was configured to access the site anonymously, so could not access the new private project. A quick read of the Buildbot manual later revealed that there was the option to add authentication to Buildbot (using the svnuser option in the poller, but the username option in the checkout phase…), yet even after adding these, the polling was failing.

Curious, I ran the command line (svn log —username …) and noticed that once again, it wasn’t showing the relevant information. Curious, I checked Apache’s logs and lo-and-behold, no authentication was being sent. Then it struck me, the root of my repository is public, no 401 error is returned, so SVN probably doesn’t send the credentials – running svn log directly on the project worked, and with no option to force credentials being sent against the more generic root, a clever solution was required.

So, Buildbot has to poll the SVN project directly, but I still want Buildbot to monitor all changes on my repository (for the other projects I want unit tests running on). And this leads to the following little hack:


from buildbot.changes.svnpoller import SVNPoller
c[‘change_source’] = [SVNPoller(svnurl=“http://www.pling.org.uk/svn/”,
                                pollinterval=20,
                                split_file=split_file_branches),
                      SVNPoller(svnurl=“http://www.pling.org.uk/svn/mofunzone/trunk/”,
                                pollinterval=20,
                                svnuser=‘buildbot’, svnpasswd=‘********’,
                                split_file=lambda path:(‘mofunzone/trunk’, path))]

Nasty, but it works.