<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Builder Configuration — Buildbot 0.8.8 documentation</title> <link rel="stylesheet" href="../_static/agogo.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', VERSION: '0.8.8', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <link rel="shortcut icon" href="../_static/buildbot.ico"/> <link rel="top" title="Buildbot 0.8.8 documentation" href="../index.html" /> <link rel="up" title="Configuration" href="configuration.html" /> <link rel="next" title="Build Factories" href="cfg-buildfactories.html" /> <link rel="prev" title="Buildslaves" href="cfg-buildslaves.html" /> </head> <body> <div class="header-wrapper"> <div class="header"> <p class="logo"><a href="../index.html"> <img class="logo" src="../_static/header-text-transparent.png" alt="Logo"/> </a></p> <div class="headertitle"><a href="../index.html">Buildbot 0.8.8 documentation</a></div> <div class="rel"> <a href="cfg-buildslaves.html" title="Buildslaves" accesskey="P">previous</a> | <a href="cfg-buildfactories.html" title="Build Factories" accesskey="N">next</a> | <a href="../py-modindex.html" title="Python Module Index" >modules</a> | <a href="../genindex.html" title="General Index" accesskey="I">index</a> </div> </div> </div> <div class="content-wrapper"> <div class="content"> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="builder-configuration"> <span id="cfg-builders"></span><span id="id1"></span><h1>Builder Configuration<a class="headerlink" href="#builder-configuration" title="Permalink to this headline">¶</a></h1> <p>The <a class="reference internal" href="#cfg-builders" title="builders"><tt class="xref bb bb-cfg docutils literal"><span class="pre">builders</span></tt></a> configuration key is a list of objects giving configuration for the Builders. For more information on the function of Builders in Buildbot, see <a class="reference internal" href="concepts.html#builder"><em>the Concepts chapter</em></a>. The class definition for the builder configuration is in <tt class="file docutils literal"><span class="pre">buildbot.config</span></tt>. In the configuration file, its use looks like:</p> <div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">buildbot.config</span> <span class="kn">import</span> <span class="n">BuilderConfig</span> <span class="n">c</span><span class="p">[</span><span class="s">'builders'</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span> <span class="n">BuilderConfig</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">'quick'</span><span class="p">,</span> <span class="n">slavenames</span><span class="o">=</span><span class="p">[</span><span class="s">'bot1'</span><span class="p">,</span> <span class="s">'bot2'</span><span class="p">],</span> <span class="n">factory</span><span class="o">=</span><span class="n">f_quick</span><span class="p">),</span> <span class="n">BuilderConfig</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">'thorough'</span><span class="p">,</span> <span class="n">slavename</span><span class="o">=</span><span class="s">'bot1'</span><span class="p">,</span> <span class="n">factory</span><span class="o">=</span><span class="n">f_thorough</span><span class="p">),</span> <span class="p">]</span> </pre></div> </div> <p><tt class="docutils literal"><span class="pre">BuilderConfig</span></tt> takes the following keyword arguments:</p> <dl class="docutils"> <dt><tt class="docutils literal"><span class="pre">name</span></tt></dt> <dd>This specifies the Builder's name, which is used in status reports.</dd> </dl> <p><tt class="docutils literal"><span class="pre">slavename</span></tt></p> <dl class="docutils"> <dt><tt class="docutils literal"><span class="pre">slavenames</span></tt></dt> <dd>These arguments specify the buildslave or buildslaves that will be used by this Builder. All slaves names must appear in the <a class="reference internal" href="cfg-buildslaves.html#cfg-slaves" title="slaves"><tt class="xref bb bb-cfg docutils literal"><span class="pre">slaves</span></tt></a> configuration parameter. Each buildslave can accommodate multiple builders. The <tt class="docutils literal"><span class="pre">slavenames</span></tt> parameter can be a list of names, while <tt class="docutils literal"><span class="pre">slavename</span></tt> can specify only one slave.</dd> <dt><tt class="docutils literal"><span class="pre">factory</span></tt></dt> <dd>This is a <tt class="xref py py-class docutils literal"><span class="pre">buildbot.process.factory.BuildFactory</span></tt> instance which controls how the build is performed by defining the steps in the build. Full details appear in their own section, <a class="reference internal" href="cfg-buildfactories.html#build-factories"><em>Build Factories</em></a>.</dd> </dl> <p>Other optional keys may be set on each <tt class="docutils literal"><span class="pre">BuilderConfig</span></tt>:</p> <dl class="docutils"> <dt><tt class="docutils literal"><span class="pre">builddir</span></tt></dt> <dd>Specifies the name of a subdirectory of the master's basedir in which everything related to this builder will be stored. This holds build status information. If not set, this parameter defaults to the builder name, with some characters escaped. Each builder must have a unique build directory.</dd> <dt><tt class="docutils literal"><span class="pre">slavebuilddir</span></tt></dt> <dd>Specifies the name of a subdirectory (under the slave's configured 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 <tt class="docutils literal"><span class="pre">builddir</span></tt>. If a slave is connected to multiple builders that share the same <tt class="docutils literal"><span class="pre">slavebuilddir</span></tt>, 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.</dd> <dt><tt class="docutils literal"><span class="pre">category</span></tt></dt> <dd>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.</dd> <dt><tt class="docutils literal"><span class="pre">nextSlave</span></tt></dt> <dd>If provided, this is a function that controls which slave will be assigned future jobs. The function is passed two arguments, the <tt class="xref py py-class docutils literal"><span class="pre">Builder</span></tt> object which is assigning a new job, and a list of <tt class="xref py py-class docutils literal"><span class="pre">BuildSlave</span></tt> objects. The function should return one of the <tt class="xref py py-class docutils literal"><span class="pre">BuildSlave</span></tt> objects, or <tt class="docutils literal"><span class="pre">None</span></tt> if none of the available slaves should be used. The function can optionally return a Deferred, which should fire with the same results.</dd> <dt><tt class="docutils literal"><span class="pre">nextBuild</span></tt></dt> <dd>If provided, this is a function that controls which build request will be handled next. The function is passed two arguments, the <tt class="xref py py-class docutils literal"><span class="pre">Builder</span></tt> object which is assigning a new job, and a list of <tt class="xref py py-class docutils literal"><span class="pre">BuildRequest</span></tt> objects of pending builds. The function should return one of the <tt class="xref py py-class docutils literal"><span class="pre">BuildRequest</span></tt> objects, or <tt class="docutils literal"><span class="pre">None</span></tt> if none of the pending builds should be started. This function can optionally return a Deferred which should fire with the same results.</dd> <dt><tt class="docutils literal"><span class="pre">canStartBuild</span></tt></dt> <dd>If provided, this is a function that can veto whether a particular buildslave should be used for a given build request. The function is passed three arguments: the <tt class="xref py py-class docutils literal"><span class="pre">Builder</span></tt>, a <tt class="xref py py-class docutils literal"><span class="pre">BuildSlave</span></tt>, and a <tt class="xref py py-class docutils literal"><span class="pre">BuildRequest</span></tt>. The function should return <tt class="docutils literal"><span class="pre">True</span></tt> if the combination is acceptable, or <tt class="docutils literal"><span class="pre">False</span></tt> otherwise. This function can optionally return a Deferred which should fire with the same results.</dd> <dt><tt class="docutils literal"><span class="pre">locks</span></tt></dt> <dd>This argument specifies a list of locks that apply to this builder; see <a class="reference internal" href="cfg-interlocks.html#interlocks"><em>Interlocks</em></a>.</dd> <dt><tt class="docutils literal"><span class="pre">env</span></tt></dt> <dd><p class="first">A Builder may be given a dictionary of environment variables in this parameter. The variables are used in <a class="reference internal" href="cfg-buildsteps.html#step-ShellCommand" title="ShellCommand"><tt class="xref bb bb-step docutils literal"><span class="pre">ShellCommand</span></tt></a> steps in builds created by this builder. The environment variables will override anything in the buildslave's environment. Variables passed directly to a <tt class="xref py py-class docutils literal"><span class="pre">ShellCommand</span></tt> will override variables of the same name passed to the Builder.</p> <p>For example, if you have a pool of identical slaves it is often easier to manage variables like <span class="target" id="index-0"></span><tt class="xref std std-envvar docutils literal"><span class="pre">PATH</span></tt> from Buildbot rather than manually editing it inside of the slaves' environment.</p> <div class="last highlight-python"><div class="highlight"><pre><span class="n">f</span> <span class="o">=</span> <span class="n">factory</span><span class="o">.</span><span class="n">BuildFactory</span> <span class="n">f</span><span class="o">.</span><span class="n">addStep</span><span class="p">(</span><span class="n">ShellCommand</span><span class="p">(</span> <span class="n">command</span><span class="o">=</span><span class="p">[</span><span class="s">'bash'</span><span class="p">,</span> <span class="s">'./configure'</span><span class="p">]))</span> <span class="n">f</span><span class="o">.</span><span class="n">addStep</span><span class="p">(</span><span class="n">Compile</span><span class="p">())</span> <span class="n">c</span><span class="p">[</span><span class="s">'builders'</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span> <span class="n">BuilderConfig</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">'test'</span><span class="p">,</span> <span class="n">factory</span><span class="o">=</span><span class="n">f</span><span class="p">,</span> <span class="n">slavenames</span><span class="o">=</span><span class="p">[</span><span class="s">'slave1'</span><span class="p">,</span> <span class="s">'slave2'</span><span class="p">,</span> <span class="s">'slave3'</span><span class="p">,</span> <span class="s">'slave4'</span><span class="p">],</span> <span class="n">env</span><span class="o">=</span><span class="p">{</span><span class="s">'PATH'</span><span class="p">:</span> <span class="s">'/opt/local/bin:/opt/app/bin:/usr/local/bin:/usr/bin'</span><span class="p">}),</span> <span class="p">]</span> </pre></div> </div> </dd> </dl> <dl class="docutils" id="index-1"> <dt><tt class="docutils literal"><span class="pre">mergeRequests</span></tt></dt> <dd>Specifies how build requests for this builder should be merged. See <a class="reference internal" href="#merging-build-requests"><em>Merging Build Requests</em></a>, below.</dd> </dl> <dl class="docutils" id="index-2"> <dt><tt class="docutils literal"><span class="pre">properties</span></tt></dt> <dd>A builder may be given a dictionary of <a class="reference internal" href="concepts.html#build-properties"><em>Build Properties</em></a> specific for this builder in this parameter. Those values can be used later on like other properties. <a class="reference internal" href="cfg-properties.html#interpolate"><em>Interpolate</em></a>.</dd> <dt><tt class="docutils literal"><span class="pre">description</span></tt></dt> <dd>A builder may be given an arbitrary description, which will show up in the web status on the builder's page.</dd> </dl> <div class="section" id="merging-build-requests"> <span id="index-3"></span><span id="id2"></span><h2>Merging Build Requests<a class="headerlink" href="#merging-build-requests" title="Permalink to this headline">¶</a></h2> <p>When more than one build request is available for a builder, Buildbot can "merge" the requests into a single build. This is desirable when build requests arrive more quickly than the available slaves can satisfy them, but has the drawback that separate results for each build are not available.</p> <p>Requests are only candidated for a merge if both requests have exactly the same <a class="reference internal" href="concepts.html#attr-codebase"><em>codebases</em></a>.</p> <p>This behavior can be controlled globally, using the <a class="reference internal" href="cfg-global.html#cfg-mergeRequests" title="mergeRequests"><tt class="xref bb bb-cfg docutils literal"><span class="pre">mergeRequests</span></tt></a> parameter, and on a per-<tt class="xref py py-class docutils literal"><span class="pre">Builder</span></tt> basis, using the <tt class="docutils literal"><span class="pre">mergeRequests</span></tt> argument to the <tt class="xref py py-class docutils literal"><span class="pre">Builder</span></tt> configuration. If <tt class="docutils literal"><span class="pre">mergeRequests</span></tt> is given, it completely overrides the global configuration.</p> <p>For either configuration parameter, a value of <tt class="docutils literal"><span class="pre">True</span></tt> (the default) causes buildbot to merge BuildRequests that have "compatible" source stamps. Source stamps are compatible if:</p> <ul class="simple"> <li>their codebase, branch, project, and repository attributes match exactly;</li> <li>neither source stamp has a patch (e.g., from a try scheduler); and</li> <li>either both source stamps are associated with changes, or neither ar associated with changes but they have matching revisions.</li> </ul> <p>This algorithm is implemented by the <tt class="xref py py-class docutils literal"><span class="pre">SourceStamp</span></tt> method <tt class="xref py py-func docutils literal"><span class="pre">canBeMergedWith</span></tt>.</p> <p>A configuration value of <tt class="docutils literal"><span class="pre">False</span></tt> indicates that requests should never be merged.</p> <p>The configuration value can also be a callable, specifying a custom merging function. See <a class="reference internal" href="customization.html#merge-request-functions"><em>Merge Request Functions</em></a> for details.</p> </div> <div class="section" id="prioritizing-builds"> <span id="index-4"></span><span id="id3"></span><h2>Prioritizing Builds<a class="headerlink" href="#prioritizing-builds" title="Permalink to this headline">¶</a></h2> <p>The <tt class="xref py py-class docutils literal"><span class="pre">BuilderConfig</span></tt> parameter <tt class="docutils literal"><span class="pre">nextBuild</span></tt> can be use to prioritize build requests within a builder. Note that this is orthogonal to <a class="reference internal" href="cfg-global.html#prioritizing-builders"><em>Prioritizing Builders</em></a>, which controls the order in which builders are called on to start their builds. The details of writing such a function are in <a class="reference internal" href="customization.html#build-priority-functions"><em>Build Priority Functions</em></a>.</p> <p>Such a function can be provided to the BuilderConfig as follows:</p> <div class="highlight-python"><pre>def pickNextBuild(builder, requests): # ... c['builders'] = [ BuilderConfig(name='test', factory=f, nextBuild=pickNextBuild, slavenames=['slave1', 'slave2', 'slave3', 'slave4']), ]</pre> </div> </div> </div> </div> </div> </div> </div> <div class="sidebar"> <h3>Table Of Contents</h3> <ul class="current"> <li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Buildbot Tutorial</a></li> <li class="toctree-l1 current"><a class="reference internal" href="index.html">Buildbot Manual</a><ul class="current"> <li class="toctree-l2"><a class="reference internal" href="introduction.html">Introduction</a></li> <li class="toctree-l2"><a class="reference internal" href="installation.html">Installation</a></li> <li class="toctree-l2"><a class="reference internal" href="concepts.html">Concepts</a></li> <li class="toctree-l2 current"><a class="reference internal" href="configuration.html">Configuration</a><ul class="current"> <li class="toctree-l3"><a class="reference internal" href="cfg-intro.html">Configuring Buildbot</a></li> <li class="toctree-l3"><a class="reference internal" href="cfg-global.html">Global Configuration</a></li> <li class="toctree-l3"><a class="reference internal" href="cfg-changesources.html">Change Sources</a></li> <li class="toctree-l3"><a class="reference internal" href="cfg-schedulers.html">Schedulers</a></li> <li class="toctree-l3"><a class="reference internal" href="cfg-buildslaves.html">Buildslaves</a></li> <li class="toctree-l3 current"><a class="current reference internal" href="">Builder Configuration</a><ul class="simple"> </ul> </li> <li class="toctree-l3"><a class="reference internal" href="cfg-buildfactories.html">Build Factories</a></li> <li class="toctree-l3"><a class="reference internal" href="cfg-properties.html">Properties</a></li> <li class="toctree-l3"><a class="reference internal" href="cfg-buildsteps.html">Build Steps</a></li> <li class="toctree-l3"><a class="reference internal" href="cfg-interlocks.html">Interlocks</a></li> <li class="toctree-l3"><a class="reference internal" href="cfg-statustargets.html">Status Targets</a></li> </ul> </li> <li class="toctree-l2"><a class="reference internal" href="customization.html">Customization</a></li> <li class="toctree-l2"><a class="reference internal" href="cmdline.html">Command-line Tool</a></li> <li class="toctree-l2"><a class="reference internal" href="resources.html">Resources</a></li> <li class="toctree-l2"><a class="reference internal" href="optimization.html">Optimization</a></li> </ul> </li> <li class="toctree-l1"><a class="reference internal" href="../developer/index.html">Buildbot Development</a></li> <li class="toctree-l1"><a class="reference internal" href="../relnotes/index.html">Release Notes for Buildbot v0.8.8</a></li> </ul> <h3 style="margin-top: 1.5em;">Search</h3> <form class="search" action="../search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <div class="clearer"></div> </div> </div> <div class="footer-wrapper"> <div class="footer"> <div class="left"> <a href="cfg-buildslaves.html" title="Buildslaves" >previous</a> | <a href="cfg-buildfactories.html" title="Build Factories" >next</a> | <a href="../py-modindex.html" title="Python Module Index" >modules</a> | <a href="../genindex.html" title="General Index" >index</a> <br/> <a href="../_sources/manual/cfg-builders.txt" rel="nofollow">Show Source</a> </div> <div class="right"> <div class="footer"> © Copyright Buildbot Team Members. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3. </div> </div> <div class="clearer"></div> </div> </div> </body> </html>