2

I'm using buildbot as continuous integration tool. It's working perfectly to run commit builds and nightly builds on both Linux and Windows platforms.

For the commit builds (triggered at each commit) and for the nightly builds (every night, building from a clean repository checkout) I use two different builders. But in the end, they both run the same commands, apart from the source repository get step. Furthermore, in the http waterfall view, they occupy two columns, whereas one is used only at day time, and the other only once during the night.

I was wondering if it was possible to have a configuration with only one single builder that would perform both the nightly builds and the daily commit builds?

(It would add as a benefit to reset the commit builds every night!)


Edit: A solution

Following Tom Prince answer, I managed to setup all this using the 'doStepIf'. It requires to set a property in the nightly scheduler, and to use this property for the doStepIf of a RemoveDirectory step right before the SVN step.

commit = AnyBranchScheduler( name="commit", treeStableTimer=5*60,
                             builderNames=["builder"] )

nightly = Nightly( name='nightly', hour=23, minute=40,
                   properties={'full':True},
                   builderNames=["builder"] )

def IsFullBuild(step):
     return step.build.getProperties().has_key('full')
            and step.build.getProperty('full')

factory.addStep( RemoveDirectory( dir="build", doStepIf=IsFullBuild ) )
factory.addStep( SVN( ... ) )
Didier Trosset
  • 36,376
  • 13
  • 83
  • 122
  • Did this end up working out for you? I did a very similar thing: my nightly scheduler sets a 'clean' property to True, and I only do the `RemoveDirectory` step if the 'clean' property is set. However, after my nightly scheduler has run, every subsequent force build always has the 'clean' property set to true as well! – Sam Nov 27 '16 at 14:07
  • @Sam Here's my lastest iteration of the various ways to find out whether to run the RemoveDirectory step or not: I use an IsNotIncremental function for doStepIf that checks whether the scheduler name starts with 'commit'. Naming the schedulers correctly (commitXxx, nightlyXxx, forceXxx) is then enough. No need for a specific property. – Didier Trosset Nov 28 '16 at 08:37
  • Thanks Didier, that's a nice idea, I might try that! – Sam Nov 28 '16 at 11:14

1 Answers1

3

You could do this currently by setting a property in one of the schedulers, and using two steps, controlled by doStepIf, so only one runs.

Another option, which would require a minor change to buildbot, is to make the mode parameter renderable, which would allow you to use a property to control the mode used to update the repository.

Tom Prince
  • 682
  • 3
  • 9
  • What do you mean by *renderable*? – Didier Trosset Jun 14 '12 at 14:52
  • renderable means that it can be rendered at build time from a property. So you can set a 'mode' property in your scheduler, and in your SVN step say mode=util.Property('mode'). This is not supported by buildbot currently – yhager Feb 01 '16 at 17:58