4
votes

buildbot version being used is:

$ buildbot --version
Buildbot version: 0.8.3p1
Twisted version: 10.1.0

Checkconfig, gives me errors:

$ buildbot checkconfig
/usr/lib/python2.6/dist-packages/twisted/mail/smtp.py:10: DeprecationWarning: the MimeWriter module is deprecated; use the email package instead
  import MimeWriter, tempfile, rfc822
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/buildbot-0.8.3p1-py2.6.egg/buildbot/scripts/runner.py", line 1071, in doCheckConfig
    ConfigLoader(configFileName=configFileName)
  File "/usr/local/lib/python2.6/dist-packages/buildbot-0.8.3p1-py2.6.egg/buildbot/scripts/checkconfig.py", line 46, in __init__
    self.loadConfig(configFile, check_synchronously_only=True)
  File "/usr/local/lib/python2.6/dist-packages/buildbot-0.8.3p1-py2.6.egg/buildbot/master.py", line 883, in loadConfig
    % (b['name'], n))
ValueError: builder runtests uses undefined slave example-slave
$ 

Here is one example i looked at :

http://agiletesting.blogspot.com/2006/02/continuous-integration-with-buildbot.html

2

2 Answers

4
votes

This pertains to:

Buildbot version: 0.8.8
Twisted version: 13.2.0

I had some serious issues to get it working with a simple hg repo, while the same project worked fine with git and the appropriate functions. So here it is.

There are three places deal with our repo in master.cfg: changesources, schedulers and builders, with only changesources and builders that use mercurial specific functions.

In changesources section:

from buildbot.changes.hgpoller import HgPoller
therepo=HgPoller(repourl="/home/user/test/my_project/",
                           branch='default',
                           pollInterval=30,
                           workdir='myrepo')

c['change_source'] = []
c['change_source'].append(therepo)

Here I use HgPoller, instead of PBChangeSource. The latter is more sophisticated but also requires more configuration steps (provide a port and yet another username and password).

repourl must point to the root of your hg repository. Any URL that could be used for "hg pull" or "hg clone" is acceptable. This example involves a local repository, but it could be on a server, then you would specify http something or else.

The default branch on mercurial is 'default'. pollInterval=30 says every 30 seconds, check for a new commit (this is from a toy example, in reality >30 would be more suitable).

Now the builder, which builds after a commit is detected and passed on by the scheduler(s):

from buildbot.process.factory import BuildFactory
from buildbot.steps.source.mercurial import Mercurial

factory = BuildFactory()

#watch out: this function is Mercurial, NOT Hg

checkout_default = Mercurial(repourl="/home/user/test/my_project/",
                      defaultBranch='default',
                      branchType='inrepo',
                      haltOnFailure = True)

factory.addStep(checkout_default)

# then you add some build instructions and don't forget to import the necessary...

What explains why my thing did not work is that I did not specify defaultBranch and branchType. Those keywords are not the same as with Git(), so beware. This is a little tricky as I did not find them in the user manual online, but it's there if you take a moment within the python interpreter:

import buildbot
help(buildbot.steps.source.mercurial)

Also, note that this is the function Mercurial imported from buildbot.steps.source.mercurial, which is not the same Mercurial function that you would import imported from buildbot.steps.source.Mercurial. The latter is deprecated (or that which you would use on an older version). My thanks to tomprince from the IRC buildbot channel on freenode for pointing that out.

2
votes

The example you looked at is very old; c['bots'] was renamed to c['slaves'] a while ago, as well as many more changes.

I'd suggest taking a look at the Buildbot manual for configuration:

http://buildbot.net/buildbot/docs/current/Configuration.html#Configuration

And possibly also the installation section, to make sure you did what was required to set up the more recent versions of BuildBot, not just older versions:

http://buildbot.net/buildbot/docs/current/Installation.html#Installation

One example that was offered was the IcedTea buildbot, which builds from Mercurial repos. Configuration is browsable here:

http://icedtea.classpath.org/hg/buildbot/file

You're also welcome to drop by #buildbot on irc.freenode.net for help.