I must admin setting up a buildbot was very entertaining. Of course this is because I read Grig tutorial. With well-written HOWTO nothing is hard. I’ll just write down few things that wasn’t already mentioned by Grig.
Oh, and if you can’t wait, Cheesecake buildbot is available here.
installation
Before we can install buildbot, few prerequisites have to be met. First, Zope Interface. I’ve chosen stable 3.0.1 version. After downloading and unpacking, I’ve tried:
# python setup.py install
This unfortunately failed with error:
error: static declaration of ‘SpecType’ follows non-static declaration
With minimal googling around I’ve managed to find a fix. Bug has been described on Zope issue tracker. Trivial fix is also available for download.
$ cd Dependencies/zope.interface-ZopeInterface-3.0.1/\
zope.interface/
$ patch -p4 < fix-zope-compilation.patch
patching file _zope_interface_coptimizations.c
After that I could try my luck again with setup.py install. Installation was successfull this time. Next prerequisite is Twisted and TwistedWeb packages. I’ve downloaded a TwistedSumo tarball and installed Twisted-2.2.0 and TwistedWeb-0.5.0 with the help of almighty setup.py install command.
Installing last package is pretty easy. You just have to execute one command:
# easy_install http://twistedmatrix.com/users/acapnotic/wares/code/CVSToys/CVSToys-1.0.9.tar.bz2
If you have any problems with easy_install (it may throw error Not a recognized archive type at you on some systems) you may also download, unpack and install the package manually. easy_install just automates this process.
Builbot 0.7.3 was realeased this Tuesday. You can grab any version at sourceforge. Install with standard python setup.py install. You should get buildbot in /usr/bin/ installed.
buildmaster
To set up a buildmaster few steps have to be followed. First create a separate user:
# adduser buildmaster
Now su to this newly created account and execute these commands:
$ mkdir conf
$ buildbot master conf/
$ cd conf/
$ mv master.cfg.sample master.cfg
In conf/master.cfg you will get a configuration template you should modify to get appropriate results. My complete master.cfg file follow (without comments).
import os.path
from buildbot.changes.freshcvs import FreshCVSSource
from buildbot.scheduler import Scheduler, Periodic
from buildbot.process import step, factory
from buildbot.status import html
s = factory.s
c = BuildmasterConfig = {}
c['bots'] = [("x86_rh9", "*PASSWORD*")]
c['sources'] = []
c['schedulers'] = [
Periodic("every_6_hours", ["x86_rh9_trunk"], 6*60*60),
Periodic("every_6_hours2", ["x86_rh9_mk"], 6*60*60)
]
make_source = lambda branch: s(step.SVN, mode='update',
baseURL='http://svn.pycheesecake.org/',
defaultBranch=branch)
source_mk = make_source('branches/mk/')
source_trunk = make_source('trunk')
class StepTest(step.ShellCommand):
name = "nose tests"
description = ["running nose tests"]
descriptionDone = [name]
nose_tests = s(StepTest, command="/usr/bin/python setup.py test")
make_factory = lambda source: factory.BuildFactory([source, nose_tests])
f_mk = make_factory(source_mk)
f_trunk = make_factory(source_trunk)
c['builders'] = [
{'name':'x86_rh9_mk',
'slavename':'x86_rh9',
'builddir':'test-mk',
'factory':f_mk
},
{'name': 'x86_rh9_trunk',
'slavename': 'x86_rh9',
'builddir': 'test-trunk',
'factory': f_trunk
},
]
c['slavePortnum'] = 9999
c['status'] = []
c['status'].append(html.Waterfall(http_port=8888))
c['projectName'] = "Cheesecake"
c['projectURL'] = "http://pycheesecake.org/"
c['buildbotURL'] = "http://agilistas.org:8888"
Note that you should set up password yourself.
buildslave
After buildmaster setup is complete, we can configure build slaves, which is far easier as no configuration files come into play. Simply add a slave user:
# adduser buildslave
and make a directory:
$ mkdir conf
$ buildbot slave /home/buildslave/conf localhost:9999 x86_rh9 *PASSWORD*
Note that the port given here and c[‘slavePortnum’] in master configuration must match.
running
To start a build slave, run following command as user buildslave:
buildbot start /home/buildslave/conf
Then start a build master with simillar command (run as user buildmaster):
buildbot start /home/buildmaster/conf
That’s it! You can now access your buildbot through web interface at an address you’ve specified in c[‘buildbotURL’] configuration option. If this doesn’t work check out logs (twistd.log) in your slave and master directories.
References