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

At the time of writing (2011), monotone support in buildbot is broken (in 0.7.12) or lacking entirely (in 0.8.x). Some development has been made, and there is a update (0.7.12+RL-5), currently only available from a monotone repository:

mtn://mtn.levitte.org/monotone-integration?richard.levitte.org:monotone-integration.buildbot-0_7_12

The recommendation is that you clone that branch into a directory somewhere and install it using easy_install:

cd /usr/local/src
mtn clone -d ./monotone-integration.mtn -b richard.levitte.org:monotone-integration.buildbot-0_7_12 \
    'mtn://mtn.levitte.org/monotone-integration?richard.levitte.org:monotone-integration.buildbot-0_7_12*' \
    buildbot-0.7.12
easy_install buildbot-0.7.12

Debian packages for it aren't yet available.

  1. Create a new user to run the builds: [[!comment need rationale on this; what's wrong with an existing user?]] On debian this is:

    # adduser --disabled-login --disabled-password mtbuildbot
    

    On gentoo it is:

    # adduser -s /bin/false -d /home/mtbuildbot -m mtbuildbot
    

    Other systems, I don't know, probably something like the above.

    NOTE: The above seems wrong, in that later you'll need to 'su' to the user and you can't do that if it's disabled. I enabled mine and disabled it after everything was working.

  2. Install a monotone binary into the new user's home directory; this is better than using the system-installed one, because it means that you don't have to worry about accidentally breaking the buildbot when upgrading. (On the other hand, it also means that whenever the netsync server protocol changes, you'll have to upgrade the copy of monotone installed here.)

    # cp /path/to/working/mtn mtn
    

    You should let me know where the binary you want to use is located, since the path to the binary has to be set on the server side. [[!comment who is "me" here? the buildmaster admin, apparently. need a canonical email address, or something]]

  3. 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). Note that you MUST run this command as the buildbot user you have created. The name and password have to come from the buildbot master admin, so ask on the list for a bot name and password.

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

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/"
Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status