[Buildbot-devel] Using "Branch to build: " in master.cfg

John Stile john at stilen.com
Wed Jul 30 21:48:34 UTC 2008


I think I'm close, but I have something wrong. 

my master.cfg looks for the options passed to "force build" form using
buildbot.scripts.runner class ForceOptions.

The shell script called in factory.BuildFactory by shell.ShellCommand
also prints out the rev and branch it was passed.

When I "Force Build", the "Branch to build:" or "Revision to build:" are
not available using ForceOptions in master.cfg.

What object would have this?
Any help is greatly appreciated.

Below I have a relevant snip from master.cfg:
---------------------------------------------
# Read "Force Build" form's branch or revision.
from buildbot.scripts.runner import ForceOptions
options = ForceOptions()
for word in options.keys():
    print "%s:%s\n" % (word,options[word])
    if options['branch']:
        # build requested branch
        my_branch= "-b branches/"+options[branch]
    else:
        # default branch trunk
        my_branch="-b trunk"
    # print target branch name
    print "BRANCH:%s\n" % my_branch

    if options['revision']:
        # build requested revision
        my_revision="-r options['revision']"
    else:
        # default revision HEAD
        my_revision='-r HEAD'
    # print target revision name
    print "REVISION:%s\n" % my_revision

from buildbot.steps import source, shell
from buildbot.process import factory

h = factory.BuildFactory()
h.addStep(shell.ShellCommand,
          command=["/home/build/bin/build_myproject.bash", 
          my_branch, 
          my_revision]
         )
c['builders'] = [
{ 'name':'linux_europa_trunk',
  'slavename':'buildlinux2.mydomain.com',
  'builddir':'MyProject_linux',
  'factory':h },
]

The master's twistd.log does not show the rev or branch options chosen
from the 'Force Build' form.

On Wed, 2008-07-30 at 10:04 -0700, John Stile wrote:
> I really need some hint where to start looking to solve this problem.
> When one enters a revision and branch on 'force build', what part of
> buildbot code processes it?  
> What do I have to 'import from' to attain access to the entered revision
> and branch?
> I am learning python, but the most confusing part is figuring out what
> objects have access to the target data.
> 
> On Mon, 2008-07-28 at 13:35 -0700, John Stile wrote:
> > I probably shouldn't have posted right before the party.
> > 
> > Could someone show me how to configure master.conf to capture the
> > "Branch to build:", from the force build form, into a variable?
> > 
> > On Thu, 2008-07-24 at 17:06 -0700, John Stile wrote:
> > > How do I assign the value sent in "Branch to build:", for the force
> > > build form, to a variable in master.conf?  
> > > 
> > > I'm not a python programmer, but I have learned some basics.
> > > 
> > > My build factory looks like this:
> > >         from buildbot.steps import source, shell
> > >         from buildbot.process import factory
> > >         f = factory.BuildFactory()
> > >         f.addStep(shell.ShellCommand,
> > >         command=["/home/builder/bin/build_script.bash" ])
> > > 
> > > I would like to assign a variable the specified branch from the web
> > > form, and feed that variable as an option to the build_script.bash
> > > script.





More information about the devel mailing list