[Buildbot-devel] multi-repo support: per-repo-workdirs

Tobias Oberstein tobias.oberstein at tavendo.de
Sun Apr 11 12:03:21 UTC 2010


This one is about the "workdir" question.

=================================================================================

When multiple repos are involved, a buildslave likely will need to build stuff from
different repos.

As long as you use mode = clobber

build.addStep (Git (mode = "clobber"))

on the sourcing step, the workdir will be thrown away on each build and everything
will work fine, since the full checkout is done, and the checkout can come from
any repo.

But: as soon as you want to use mode = "update", problems will arise, since the
workdir will contain a checkout of repo 1, and can't do an update therein for
repo 2.

So what is needed is some control over the workdir used.

My idea was to make workdir a parameter on the factory for the builder and make
it possibly a function of the sourcestamp to be built.

I think it's easier to get by example:

#
# pre-repository working directory
#
def workdir (source_stamp):
    return hashlib.md5 (source_stamp.repository).hexdigest ()[:8]

build = factory.BuildFactory()
build.workdir = workdir

build.addStep (Git (mode = "update"))
...
builders.append ({'name': 'mybuilder',
                  'slavename': 'myslave',
                  'builddir': 'mybuilder',
                  'factory': build})

You'll end up with workdirs like:

Repo1		=> 	<buildslave-base>/mybuilder/a78890ba
Repo2		=> 	<buildslave-base>/mybuilder/0823ba88
...


You could make the workdir() function compute other paths, based on
parts of the repo URL in the sourcestamp, or lookup in a lookup table
based on repo URL.

As long as there is a permanent 1:1 mapping between repos and workdir
this will work.


More information about the devel mailing list