The buildbots help us make sure monotone continues to work on lots of platforms and configurations, and debug what's going wrong when things break.

General information: http://buildbot.net/

Our buildbots: http://buildbot.monotone.ca/

There is a single "buildmaster" that runs on a central server (monotone.ca in this case), that watches for new changes in the repo, and controls several "buildslaves". Buildslaves are run by helpful people out on the internet who have access to whatever weird configuration they'd like to make sure keeps being supported, and the cycles to spare on these boxes to do continuous rebuilds.

We are always interested in getting new buildslaves; send a note to the list if you have one to offer, and we'll help you get it set up!

See Windows for setting up a Buildslave on Windows

Setting up a Buildslave on non-Windows

  1. Install Twisted from http://twistedmatrix.com/trac/

  2. Install buildbot

As of version 0.8.4 of buildbot, support for monotone should work fine, again. It was broken around 0.7.12 and lacking entirely in the earlier 0.8.x versions. Most distributions provide a ready to install buildbot-slave package to use.

  1. Create a new user to run the builds:

For security reasons as well as for easier administration, it is recommended to run the buildbot slaves with a dedicated user.

On debian this is:

    # adduser --disabled-password mtbuildbot

On gentoo it is:

    # adduser /home/mtbuildbot -m mtbuildbot

Other systems, I don't know, probably something like the above.
  1. Make sure all the required libraries and tools are available.

Usually, you've successfully built monotone by hand on the target system, before trying to set-up a buildbot slave. In addition to the usual build requirements, the buildbot also needs a working monotone binary to checkout the sources to test. You can either use a mtn executable compiled before (and don't worry about accidentally breaking the buildbbot when upgrading) or use a system-provided monotone version, where available.

  1. Create a buildbot instance:

     $ buildbot create-slave slave-dir monotone.ca:9001 <NAME> <PASSWORD>
    

    (replacing and by the name of this slave and the password that it was assigned). You can either run this command as the buildbot user you have created or re-assign the files to that user later on - just make sure it has write access to the directory created. The name and password have to come from the buildbot master admin, so ask on the list for a bot name and password.

  2. Make sure that permissions are correct.

The mtbuildbot user needs write access to slave-dir, and should not have write access to anything else. For additional safety, you can now disable logins for the buildbot user.

Running the Buildslave

There are several ways to run a buildslave. Here are a few examples:

Running the Buildslave with cron

  1. Start the slave now:

     # su mtbuildbot -c 'buildbot start slave-dir'
    
  2. Check slave-dir/twistd.log to see it starting up and check for errors.

  3. Set up the slave to be automatically started at boot:

     # echo '@reboot buildbot start slave-dir' | su mtbuildbot -c 'crontab -e -'
    

Running the Buildslave with runit

  1. Install runit, http://smarden.org/runit or apt-get install runit or whatever.

  2. Create a file called ~mtbuildbot/run:

     #!/bin/sh
     cd $HOME/slave-dir
     exec nice twistd --nodaemon --no_save -y buildbot.tac -l twistd.log
    

    and make it executable. (If you're on win32, you may need to add a --reactor=win32 argument to that command line. But then, you're probably not using runit in that case anyway, I guess...)

  3. Make sure that permissions are correct. The mtbuildbot user needs write access to slave-dir, and should not have write access to anything else.

  4. Start the slave now:

     # su mtbuildbot -c 'runsv .' &
    
  5. Check slave-dir/twistd.log to see it starting up and check for errors.

  6. Set up the slave to be automatically started at boot:

     # echo '@reboot runsv .' | su mtbuildbot -c 'crontab -e -'
    

Monotone Buildbot Wishlist

  • a way to run the whole testsuite under valgrind and collect the results

Setting up a Buildbot for your own Project

Currently, you will need the above patch for buildbot to work with monotone. Make sure to make yourself familiar with the buildbot infrastructure, they have a nice manual: HTML PDF

You will most probably want to try the netsync hooks to notify the buildbot upon changes, see the monotone sources: contrib/monotone-buildbot-notification.lua

Maybe, an example of a working configuration helps, here is what the master.cfg for the monotone.ca buildbot could look like:

# -*- python -*-

c = BuildmasterConfig = {}
c['bots'] = [("i386-debian-testing", "YOU-CHOOSE-A-PASSWORD-HERE")]
c['slavePortnum'] = 9001

from buildbot.changes.pb import PBChangeSource
c['sources'] = [PBChangeSource()]

from buildbot.scheduler import Scheduler
c['schedulers'] = []
c['schedulers'].append(Scheduler(name="all", branch="net.venge.monotone",
                 treeStableTimer=2*60,
                 builderNames=["i386-debian-testing"]))

builders = []

from buildbot.process import factory
from buildbot.steps.source import Monotone
from buildbot.steps.shell import ShellCommand
from buildbot.steps.shell import Configure
from buildbot.steps.shell import Compile
from buildbot.steps.shell import Test

f_unix_general = factory.BuildFactory()
f_unix_general.addStep(Monotone,
           repourl="monotone.ca", branch="net.venge.monotone")
f_unix_general.addStep(ShellCommand, command=["autoreconf", "-i"])
f_unix_general.addStep(Configure)
f_unix_general.addStep(Compile)
f_unix_general.addStep(Test, command=["make", "check"])

b_i386_debian_testing = {'name': "i386-debian-testing",
             'slavename': "i386-debian-testing",
             'builddir': "full-i386-debian-testing",
             'factory': f_unix_general,
            }
c['builders'] = [b_i386_debian_testing]


from buildbot.status import html
c['status'] = [html.Waterfall(http_port=9000)]


c['projectName'] = "Monotone"
c['projectURL'] = "http://monotone.ca/"

c['buildbotURL'] = "http://buildbot.monotone.ca/"