[Buildbot-devel] Sharing SVN checkout between multiple builders
Patrick Näf
herzbube at herzbube.ch
Sat Jan 12 18:10:21 UTC 2008
On Sat, January 12, 2008 14:10, Max Horn wrote:
> is there a good way to share a single SVN checkout dir between
> multiple builders, without copying it?
>
[...]
What about a configuration like this?
* have a special builder that runs first and checks out/updates the sources?
* run all the regular builders after the checkout builder
* use locks.SlaveLock to make sure that builders run sequentially
* create a simple custom scheduler class that makes sure that the sequence
of builders is correct
Below I have added a bit of (untested) sample code that might work in a
simple setup that involves no branches, no special revisions, everything
running strictly sequentally.
Please note: I wrote the original code (from which the sample is adapted)
when I did my first experiments with buildbot 0.7.5, so it's probable that
some changes are necessary to make it work for buildbot 0.7.6.
Cheers
Patrick
----------snip----------
# Extend the Nightly scheduler class so that all builds are triggered
# in the order that builders were specified
class Nightly_Sequential(Nightly):
def doPeriodicBuild(self):
# Schedule the next run
self.setTimer()
# Trigger builds
for builderName in self.builderNames:
bs = buildset.BuildSet([builderName],
SourceStamp(branch=self.branch),
self.reason)
self.submit(bs)
allBuilderNames = ["builder_checkout", "builder_platform1"]
scheduler_nightly = Nightly_Sequential('scheduler_nightly', builderNames =
allBuilderNames, hour = 3, minute = 0)
c['schedulers'] = []
c['schedulers'].append(scheduler_nightly)
c['builders'] = []
# Define a lock that forces builders to be run sequentially
lock_sequential = locks.SlaveLock("lock_sequential")
# Define the builder that gets the sources
f_checkout = factory.BuildFactory()
f_checkout.addStep(source.SVN, mode = 'update', svnurl =
'http://foo.org/svn/bar/trunk/', alwaysUseLatest = True)
builder_checkout = {'name': "builder_checkout",
'slavename': "bot1",
'builddir': "sources",
'factory': f_checkout,
'locks' : [lock_sequential],
}
c['builders'].append(builder_checkout)
# Define builder for platform "platform1"
f_platform1 = factory.BuildFactory()
f_platform1.addStep(shell.Compile, command = ".
../sources/build/env_platform1.sh; make -f ../sources/build/Makefile
target_platform1")
f_platform1.addStep(shell.Compile, command = ".
../sources/build/env_platform1.sh; make -f ../sources/build/Makefile
install_platform1")
builder_platform1 = {'name': "builder_platform1",
'slavename': "bot1",
'builddir': "platform1",
'factory': f_platform1,
'locks' : [lock_sequential],
}
c['builders'].append(builder_platform1)
More information about the devel
mailing list