[Buildbot-devel] Need example using BzrPoller

Kristian Nielsen knielsen at knielsen-hq.org
Wed Jun 24 06:36:45 UTC 2009


Lee Bieber <kalebral at gmail.com> writes:

> Could anyone provide an example for using BzrPoller. I'm using

Here is what I used to do to track lp:maria (abbreviated for clarity, we use
more branches):

    from bzr_buildbot import BzrPoller
    bzr_5_1 = BzrPoller(url="http://bazaar.launchpad.net/%7Emaria-captains/maria/5.1", poll_interval=5*60, branch_name="5.1")
    c['change_source'] = [bzr_5_1]

    from buildbot.scheduler import AnyBranchScheduler
    c['schedulers'] = []
    c['schedulers'].append(AnyBranchScheduler(
        name="mariadb",
        branches=["5.1"],
        treeStableTimer=1, # 1 sec for bzr
        builderNames=["hardy-amd64-valgrind", "centos5-debug", "hardy-x86-rtai",
                      "hardy-amd64-dbg", "lenny-amd64-dbg", "adutko-alpha",
                      "jaunty-x86-valgrind", "jaunty-amd64-rel",
                      "gentoo-x86-dbg", "sol10-amd64-dbg"]))

(You can see this running on http://askmonty.org/buildbot/).

If you do not need multiple branches, I suppose you would not need the
AnyBranchScheduler of course.

> import bzr_buildbot
> from buildbot.scheduler import Scheduler, Periodic
>
> # periodic scheduler
> sixhours = Periodic("every_6_hrs", [
>                    "centos5.32.1",
>                    "debian.sparc.64.1"], 6*60*60)
>
> # scheduled builds 5 minutes after the source has been updated
> ondemand = Scheduler("ondemand", None, 5*60, [
>                   "ubuntu904.64.1"
>                    ])
> c['schedulers'] = [sixhours, ondemand]
>
> in bzr_buildbot.py I have only changed the following line to add in
> our repository name:

You should not have to change bzr_buildbot.py to do this. Instead, you need to
instantiate a BzrPoller object in your config and install it in
c['change_source'] like in my example above. It seems you did not do that, so
I would guess that is what is causing your problem.

Two other suggestions:

1. I had issues with using the abbreviated lp: Launchpad URIs, solved by using
the full URI as above. If you hit this problem as well, try using this instead
of lp:drizzle:

    http://bazaar.launchpad.net/%7Edrizzle-developers/drizzle/development

2. Since you are using Launchpad, you might want to consider using
BzrLaunchpadEmailMaildirSource, as that does not require any polling:

    from buildbot.changes import mail
    myBranchMap = { "lp:~maria-captains/maria/5.1" : "5.1"
                    }
    mailSource = mail.BzrLaunchpadEmailMaildirSource("/var/lib/buildbot/Maildir",
                                                     branchMap=myBranchMap)
    c['change_source'] = [mailSource]

This requires that you can set up your buildbot to receive mail. It also
requires using latest git revision, as BzrLaunchpadEmailMaildirSource is not
in any release yet.

The main advantage is that you do not need to poll, reducing the load you put
on Launchpad and decreasing the latency between push and start of build. It is
also more robust to revision numbers changing after pushes, but since Drizzle
people are careful to avoid that this is less of an issue for you.

Hope this helps,

 - Kristian.




More information about the devel mailing list