Next: , Up: Builders


4.9.1 Builder Configuration

The c['builders'] key is a list of objects giving configuration for the Builders. For more information, See Builder. The class definition for the builder configuration is in buildbot.config. In the configuration file, its use looks like:

     from buildbot.config import BuilderConfig
     c['builders'] = [
         BuilderConfig(name='quick', slavenames=['bot1', 'bot2'], factory=f_quick),
         BuilderConfig(name='thorough', slavename='bot1', factory=f_thorough),
     ]

The constructor takes the following keyword arguments:

name
This specifies the Builder's name, which is used in status reports.
slavename
slavenames
These arguments specify the buildslave or buildslaves that will be used by this Builder. All slaves names must appear in the c['slaves'] list. Each buildslave can accomodate multiple Builders. The slavenames parameter can be a list of names, while slavename can specify only one slave.
factory
This is a buildbot.process.factory.BuildFactory instance which controls how the build is performed. Full details appear in their own section, See Build Factories. Parameters like the location of the CVS repository and the compile-time options used for the build are generally provided as arguments to the factory's constructor.

Other optional keys may be set on each Builder:

builddir
Specifies the name of a subdirectory (under the base directory) in which everything related to this builder will be placed on the buildmaster. This holds build status information. If not set, defaults to name with some characters escaped. Each builder must have a unique build directory.
slavebuilddir
Specifies the name of a subdirectory (under the base directory) in which everything related to this builder will be placed on the buildslave. This is where checkouts, compiles, and tests are run. If not set, defaults to builddir. If a slave is connected to multiple builders that share the same slavebuilddir, make sure the slave is set to run one build at a time or ensure this is fine to run multiple builds from the same directory simultaneously.
category
If provided, this is a string that identifies a category for the builder to be a part of. Status clients can limit themselves to a subset of the available categories. A common use for this is to add new builders to your setup (for a new module, or for a new buildslave) that do not work correctly yet and allow you to integrate them with the active builders. You can put these new builders in a test category, make your main status clients ignore them, and have only private status clients pick them up. As soon as they work, you can move them over to the active category.
nextSlave
If provided, this is a function that controls which slave will be assigned future jobs. The function is passed two arguments, the Builder object which is assigning a new job, and a list of BuildSlave objects. The function should return one of the BuildSlave objects, or None if none of the available slaves should be used.
nextBuild
If provided, this is a function that controls which build request will be handled next. The function is passed two arguments, the Builder object which is assigning a new job, and a list of BuildRequest objects of pending builds. The function should return one of the BuildRequest objects, or None if none of the pending builds should be started.
locks
This argument specifies a list of locks that apply to this builder; See Interlocks.
env
A Builder may be given a dictionary of environment variables in this parameter. The variables are used in see ShellCommand steps in builds created by this builder. The environment variables will override anything in the buildslave's environment. Variables passed directly to a ShellCommand will override variables of the same name passed to the Builder.

For example, if you have a pool of identical slaves, it is often easier to manage variables like PATH from Buildbot, rather than manually editing it inside of the slaves' environment.

          f = factory.BuildFactory
          f.addStep(ShellCommand(
                        command=['bash', './configure']))
          f.addStep(Compile())
          
          c['builders'] = [
            BuilderConfig(name='test', factory=f,
                  slavenames=['slave1', 'slave2', 'slave3', 'slave4'],
                  env={'PATH': '/opt/local/bin:/opt/app/bin:/usr/local/bin:/usr/bin'}),
          ]

mergeRequests
This boolean defaults to True, which means that the Builder might attempt to merge BuildRequests into a single build. If False, the Builder will never attempt to merge requests.

Merging requests helps to reduce the total number of builds, but loses information about which exact change might have caused a build problem. Requests can only be merged for compatible SourceStamps, for example two Changes that occur on the same branch, or two requests to build 'HEAD' (i.e. the latest checkin) on the same branch.

The buildmaster's c['mergeRequests'] hook function is evaluated only if the Builder's mergeRequests key is True, so merging only takes place if both allow it. see Merging BuildRequests.

properties
A builder may be given a dictionary of see Build Properties specific for this builder in this parameter. Those values can be used later on like other properties. see WithProperties.