I am using buildbot
in a project and I have a setup of a scheduler, that automatically builds the project every time when there is a change, to test whether it compiles fine. This works and buildbot detects the changes on all branches but the scheduler always builds the master
branch, no matter which branch the change is on. I want it to build the branch that the change is on but I have trouble making that work. Here are the relevant parts of the buildbot configuration:
GitPoller:
c['change_source'].append(GitPoller(
repourl='git@git.somewhere.com:someproject.git',
branches=True,
pollinterval=60))
Scheduler:
c['schedulers'].append(AnyBranchScheduler(
name='all',
treeStableTimer=2*60,
builderNames=['builder 1', 'builder 2']))
This is a helper function that I use on several builders to checkout the code. I am almost always calling it with no parameters. Using the parameter is a rare case for a specific branch, and the above scheduler does not run such a builder. I assume that when I use no parameters, I am always running in the else
block:
def CheckoutFactory(whichBranch = ''):
factory = BuildFactory()
if whichBranch:
factory.addStep(Git(repourl='git@git.somewhere.com:someproject.git', branch=whichBranch, mode='full', method='fresh', alwaysUseLatest=True, progress=True))
else:
factory.addStep(Git(repourl='git@git.somewhere.com:someproject.git', mode='full', method='fresh', alwaysUseLatest=True, progress=True))
return factory
What is wrong here? Am I doing something wrong and how do I make buildbot run the builds on the branches with the changes?
Configuration:
16.04.1
64-bit.0.8.12
. (from the repos)2.7.4
. (from the repos)I've fixed it. It seems that is not as automatic as I had thought. The branch has to be passed to the Git
step, using the value of the branch
property. I did it like this:
factory.addStep(Git(repourl='git@git.somewhere.com:someproject.git', branch=WithProperties('%s', 'branch'), mode='full', method='fresh', alwaysUseLatest=True, progress=True))
The relevant change is that this parameter has been added:
branch=WithProperties('%s', 'branch')
I am using the deprecated WithProperties
and not Propery
because that would trigger this problem, and I didn't want to change my configuration too much.