<!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>A Quick Tour — Buildbot v0.8.5rc2-29-g80a524b 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.5rc2-29-g80a524b', 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 v0.8.5rc2-29-g80a524b documentation" href="../index.html" /> <link rel="up" title="Buildbot Tutorial" href="index.html" /> <link rel="next" title="Buildbot Manual" href="../manual/index.html" /> <link rel="prev" title="First Run" href="firstrun.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> <h1><a href="../index.html">Buildbot v0.8.5rc2-29-g80a524b documentation</a></h1> <div class="rel"> <a href="firstrun.html" title="First Run" accesskey="P">previous</a> | <a href="../manual/index.html" title="Buildbot Manual" 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="a-quick-tour"> <span id="quick-tour-label"></span><h1>A Quick Tour<a class="headerlink" href="#a-quick-tour" title="Permalink to this headline">¶</a></h1> <div class="section" id="goal"> <h2>Goal<a class="headerlink" href="#goal" title="Permalink to this headline">¶</a></h2> <p>This tutorial will expand on the <a class="reference internal" href="firstrun.html#first-run-label"><em>First Run</em></a> tutorial by taking a quick tour around some of the features of buildbot that are hinted at in the comments in the sample configuration. We will simply change parts of the default configuration and explain the activated features.</p> <p>As a part of this tutorial, we will make buildbot do a few actual builds.</p> <dl class="docutils"> <dt>This section will teach you how to:</dt> <dd><ul class="first last simple"> <li>make simple configuration changes and activate them</li> <li>deal with configuration errors</li> <li>force builds</li> <li>enable and control the IRC bot</li> <li>enable ssh debugging</li> <li>add a 'try' scheduler</li> </ul> </dd> </dl> </div> <div class="section" id="setting-project-name-and-url"> <h2>Setting Project Name and URL<a class="headerlink" href="#setting-project-name-and-url" title="Permalink to this headline">¶</a></h2> <p>Let's start simple by looking at where you would customize the buildbot's project name and URL.</p> <p>We continue where we left off in the <a class="reference internal" href="firstrun.html#first-run-label"><em>First Run</em></a> tutorial.</p> <p>Open a new terminal, and first enter the same sandbox you created before (where $EDITOR is your editor of choice like vim, gedit, or emacs):</p> <div class="highlight-python"><pre>cd cd tmp/buildbot source sandbox/bin/activate $EDITOR master/master.cfg</pre> </div> <p>Now, look for the section marked <em>PROJECT IDENTITY</em> which reads:</p> <div class="highlight-python"><div class="highlight"><pre><span class="c">####### PROJECT IDENTITY</span> <span class="c"># the 'title' string will appear at the top of this buildbot</span> <span class="c"># installation's html.WebStatus home page (linked to the</span> <span class="c"># 'titleURL') and is embedded in the title of the waterfall HTML page.</span> <span class="n">c</span><span class="p">[</span><span class="s">'title'</span><span class="p">]</span> <span class="o">=</span> <span class="s">"Pyflakes"</span> <span class="n">c</span><span class="p">[</span><span class="s">'titleURL'</span><span class="p">]</span> <span class="o">=</span> <span class="s">"http://divmod.org/trac/wiki/DivmodPyflakes"</span> </pre></div> </div> <p>If you want, you can change either of these links to anything you want to see what happens when you change them. After making a change go into the terminal and type:</p> <div class="highlight-python"><pre>buildbot reconfig master</pre> </div> <p>You will see a handful of lines of output from the master log, much like this:</p> <div class="highlight-python"><pre>2009-08-01 13:38:21+0200 [-] loading configuration from /home/thomas/dev/ext/buildbot/sandbox/master/master.cfg 2009-08-01 13:38:21+0200 [-] builder buildbot-full is unchanged 2009-08-01 13:38:21+0200 [-] removing IStatusReceiver <WebStatus on port tcp:8010 at 0x11a5290> 2009-08-01 13:38:21+0200 [-] configuration update started 2009-08-01 13:38:21+0200 [-] (Port 8010 Closed) 2009-08-01 13:38:21+0200 [-] Stopping factory <twisted.web.server.Site instance at 0x11a5518> 2009-08-01 13:38:21+0200 [-] adding IStatusReceiver <WebStatus on port tcp:8010 at 0x14f9050> 2009-08-01 13:38:21+0200 [-] twisted.web.server.Site starting on 8010 2009-08-01 13:38:21+0200 [-] Starting factory <twisted.web.server.Site instance at 0x14f90e0> 2009-08-01 13:38:21+0200 [-] WebStatus using (/home/thomas/dev/ext/buildbot/sandbox/master/public_html) 2009-08-01 13:38:21+0200 [-] adding 0 new schedulers, removed 0 2009-08-01 13:38:21+0200 [-] adding 0 new changesources, removing 0 2009-08-01 13:38:21+0200 [-] configuration update complete Reconfiguration appears to have completed successfully.</pre> </div> <p>The important lines are the ones telling you that it is loading the new configuration at the top, and the one at the bottom saying that the update is complete.</p> <p>Now, if you go back to <a class="reference external" href="http://localhost:8010/waterfall">the waterfall page</a>, you will see that the project's name is whatever you may have changed it to and when you click on the the URL of the project name at the bottom of the page it should take you to the link you put in the configuration.</p> </div> <div class="section" id="configuration-errors"> <h2>Configuration Errors<a class="headerlink" href="#configuration-errors" title="Permalink to this headline">¶</a></h2> <p>It is very common to make a mistake when configuring buildbot, so you might as well see now what happens in that case and what you can do to fix the error.</p> <p>Open up the config again and introduce a syntax error by removing the first single quote in the two lines you changed, so they read:</p> <div class="highlight-python"><pre>c[title'] = "Pyflakes" c['titleURL'] = "http://divmod.org/trac/wiki/DivmodPyflakes"</pre> </div> <p>This creates a Python SyntaxError. Now go ahead and reconfig the buildmaster:</p> <div class="highlight-python"><pre>buildbot reconfig master</pre> </div> <p>This time, the output looks like:</p> <div class="highlight-python"><pre>2009-08-01 13:52:23+0200 [-] loading configuration from /home/thomas/dev/ext/buildbot/sandbox/master/master.cfg 2009-08-01 13:52:23+0200 [-] error while parsing config file 2009-08-01 13:52:23+0200 [-] error during loadConfig 2009-08-01 13:52:23+0200 [-] Unhandled Error Traceback (most recent call last): File "/home/thomas/dev/ext/buildbot/sandbox/lib/python2.6/site-packages/Twisted-8.2.0-py2.6-linux-x86_64.egg/twisted/application/app.py", line 348, in runReactorWithLogging reactor.run() File "/home/thomas/dev/ext/buildbot/sandbox/lib/python2.6/site-packages/Twisted-8.2.0-py2.6-linux-x86_64.egg/twisted/internet/base.py", line 1128, in run self.mainLoop() File "/home/thomas/dev/ext/buildbot/sandbox/lib/python2.6/site-packages/Twisted-8.2.0-py2.6-linux-x86_64.egg/twisted/internet/base.py", line 1137, in mainLoop self.runUntilCurrent() File "/home/thomas/dev/ext/buildbot/sandbox/lib/python2.6/site-packages/Twisted-8.2.0-py2.6-linux-x86_64.egg/twisted/internet/base.py", line 757, in runUntilCurrent call.func(*call.args, **call.kw) --- <exception caught here> --- File "/home/thomas/dev/ext/buildbot/src/buildbot/master.py", line 511, in loadTheConfigFile self.loadConfig(f) File "/home/thomas/dev/ext/buildbot/src/buildbot/master.py", line 529, in loadConfig exec f in localDict exceptions.SyntaxError: EOL while scanning string literal (master.cfg, line 191) 2009-08-01 13:52:23+0200 [-] The new config file is unusable, so I'll ignore it. 2009-08-01 13:52:23+0200 [-] I will keep using the previous config file instead. Reconfiguration failed. Please inspect the master.cfg file for errors, correct them, then try 'buildbot reconfig' again.</pre> </div> <p>This time, it's clear that there was a mistake. in the configuration. Luckily, the buildbot master will ignore the wrong configuration and keep running with the previous configuration.</p> <p>The message is clear enough, so open the configuration again, fix the error, and reconfig the master.</p> </div> <div class="section" id="your-first-build"> <h2>Your First Build<a class="headerlink" href="#your-first-build" title="Permalink to this headline">¶</a></h2> <p>By now you're probably thinking: "All this time spent and still not done a single build ? What was the name of this project again ?"</p> <p>On the <a class="reference external" href="http://localhost:8010/waterfall">waterfall</a>. page, click on the runtests link, and scroll down. You will see some new options that allow you to force a build:</p> <img alt="force a build." src="../_images/force-build.png" /> <p>Type in your name and a reason, then click <em>Force Build</em>. After that, click on <a class="reference external" href="http://localhost:8010/waterfall?show=runtests">view in waterfall</a>.</p> <p>You will now see:</p> <img alt="an successful test run happened." src="../_images/runtests-success.png" /> </div> <div class="section" id="enabling-the-irc-bot"> <h2>Enabling the IRC Bot<a class="headerlink" href="#enabling-the-irc-bot" title="Permalink to this headline">¶</a></h2> <p>Buildbot includes an IRC bot that you can tell to join a channel and control to report on the status of buildbot.</p> <p>First, start an IRC client of your choice, connect to irc.freenode.org and join an empty channel. In this example we will use #buildbot-test, so go join that channel. (<em>Note: please do not join the main buildbot channel!</em>)</p> <p>Edit the config and look for the <em>STATUS TARGETS</em> section that you changed before to be able to force the build.</p> <p>Enter these lines below the WebStatus line in master.cfg:</p> <div class="highlight-python"><div class="highlight"><pre><span class="n">c</span><span class="p">[</span><span class="s">'status'</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">html</span><span class="o">.</span><span class="n">WebStatus</span><span class="p">(</span><span class="n">http_port</span><span class="o">=</span><span class="mi">8010</span><span class="p">,</span> <span class="n">authz</span><span class="o">=</span><span class="n">authz_cfg</span><span class="p">))</span> <span class="kn">from</span> <span class="nn">buildbot.status</span> <span class="kn">import</span> <span class="n">words</span> <span class="n">c</span><span class="p">[</span><span class="s">'status'</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">words</span><span class="o">.</span><span class="n">IRC</span><span class="p">(</span><span class="n">host</span><span class="o">=</span><span class="s">"irc.freenode.org"</span><span class="p">,</span> <span class="n">nick</span><span class="o">=</span><span class="s">"bbtest"</span><span class="p">,</span> <span class="n">channels</span><span class="o">=</span><span class="p">[</span><span class="s">"#buildbot-test"</span><span class="p">]))</span> </pre></div> </div> <p>Reconfigure the build master then do:</p> <div class="highlight-python"><pre>cat master/twistd.log | grep IRC</pre> </div> <p>The log output should contain a line like this:</p> <div class="highlight-python"><pre>2009-08-01 15:35:20+0200 [-] adding IStatusReceiver <buildbot.status.words.IRC instance at 0x300d290></pre> </div> <p>You should see the bot now joining in your IRC client. Type:</p> <div class="highlight-python"><pre>bbtest: commands</pre> </div> <p>to get a list of the commands the bot supports.</p> <p>Let's tell the bot to notify certain events, to learn which EVENTS we can notify on do:</p> <div class="highlight-python"><pre>bbtest: help notify</pre> </div> <p>Now let's set some event notifications:</p> <div class="highlight-python"><pre>bbtest: notify on started bbtest: notify on finished bbtest: notify on failure</pre> </div> <p>The bot should have responded to each of the commands:</p> <div class="highlight-python"><pre><@lsblakk> bbtest: notify on started <bbtest> The following events are being notified: ['started'] <@lsblakk> bbtest: notify on finished <bbtest> The following events are being notified: ['started', 'finished'] <@lsblakk> bbtest: notify on failure <bbtest> The following events are being notified: ['started', 'failure', 'finished']</pre> </div> <p>Now, go back to the web interface and force another build.</p> <p>Notice how the bot tells you about the start and finish of this build:</p> <div class="highlight-python"><pre>< bbtest> build #1 of runtests started, including [] < bbtest> build #1 of runtests is complete: Success [build successful] Build details are at http://localhost:8010/builders/runtests/builds/1</pre> </div> <p>You can also use the bot to force a build:</p> <div class="highlight-python"><pre>bbtest: force build runtests test build</pre> </div> <p>But to allow this, you'll need to have <tt class="docutils literal"><span class="pre">allowForce</span></tt> in the IRC configuration:</p> <div class="highlight-python"><div class="highlight"><pre><span class="n">c</span><span class="p">[</span><span class="s">'status'</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">words</span><span class="o">.</span><span class="n">IRC</span><span class="p">(</span><span class="n">host</span><span class="o">=</span><span class="s">"irc.freenode.org"</span><span class="p">,</span> <span class="n">nick</span><span class="o">=</span><span class="s">"bbtest"</span><span class="p">,</span> <span class="n">allowForce</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">channels</span><span class="o">=</span><span class="p">[</span><span class="s">"#buildbot-test"</span><span class="p">]))</span> </pre></div> </div> <p>This time, the bot is giving you more output, as it's specifically responding to your direct request to force a build, and explicitly tells you when the build finishes:</p> <div class="highlight-python"><pre><@lsblakk> bbtest: force build runtests test build < bbtest> build #2 of runtests started, including [] < bbtest> build forced [ETA 0 seconds] < bbtest> I'll give a shout when the build finishes < bbtest> build #2 of runtests is complete: Success [build successful] Build details are at http://localhost:8010/builders/runtests/builds/2</pre> </div> <p>You can also see the new builds in the web interface.</p> <img alt="a successful test run from IRC happened." src="../_images/irc-testrun.png" /> </div> <div class="section" id="debugging-with-manhole"> <h2>Debugging with Manhole<a class="headerlink" href="#debugging-with-manhole" title="Permalink to this headline">¶</a></h2> <p>You can do some debugging by using manhole, an interactive Python shell. It exposes full access to the buildmaster's account (including the ability to modify and delete files), so it should not be enabled with a weak or easily guessable password.</p> <p>To use this you will need to install an additional package or two to your virtualenv:</p> <div class="highlight-python"><pre># make sure your sandbox is activated so this is installed in your virtualenv pip install pycrypto pip install pyasn1</pre> </div> <p>In your master.cfg find:</p> <div class="highlight-python"><div class="highlight"><pre><span class="n">c</span> <span class="o">=</span> <span class="n">BuildmasterConfig</span> <span class="o">=</span> <span class="p">{}</span> </pre></div> </div> <p>Insert the following to enable debugging mode with manhole:</p> <div class="highlight-python"><div class="highlight"><pre><span class="c">####### DEBUGGING</span> <span class="kn">from</span> <span class="nn">buildbot</span> <span class="kn">import</span> <span class="n">manhole</span> <span class="n">c</span><span class="p">[</span><span class="s">'manhole'</span><span class="p">]</span> <span class="o">=</span> <span class="n">manhole</span><span class="o">.</span><span class="n">PasswordManhole</span><span class="p">(</span><span class="s">"tcp:1234:interface=127.0.0.1"</span><span class="p">,</span><span class="s">"admin"</span><span class="p">,</span><span class="s">"passwd"</span><span class="p">)</span> </pre></div> </div> <p>Now you can ssh into the master and get an interactive python shell:</p> <div class="highlight-python"><pre>ssh -p1234 admin@127.0.0.1 # enter passwd at prompt</pre> </div> <p>If you wanted to check which slaves are connected and what builders those slaves are assigned to you could do:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">master</span><span class="o">.</span><span class="n">botmaster</span><span class="o">.</span><span class="n">slaves</span> <span class="go">{'example-slave': <BuildSlave 'example-slave', current builders: runtests>}</span> </pre></div> </div> <p>Objects can be explored in more depth using <cite>dir(x)</cite> or the helper function <cite>show(x)</cite>.</p> </div> <div class="section" id="adding-a-try-scheduler"> <h2>Adding a 'try' scheduler<a class="headerlink" href="#adding-a-try-scheduler" title="Permalink to this headline">¶</a></h2> <p>Buildbot includes a way for developers to submit patches for testing without committing them to the source code control system. (This is really handy for projects that support several operating systems or architectures.)</p> <p>To set this up, add the following lines to master.cfg:</p> <div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">buildbot.scheduler</span> <span class="kn">import</span> <span class="n">Try_Userpass</span> <span class="n">c</span><span class="p">[</span><span class="s">'schedulers'</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Try_Userpass</span><span class="p">(</span> <span class="n">name</span><span class="o">=</span><span class="s">'try'</span><span class="p">,</span> <span class="n">builderNames</span><span class="o">=</span><span class="p">[</span><span class="s">'runtests'</span><span class="p">],</span> <span class="n">port</span><span class="o">=</span><span class="mi">5555</span><span class="p">,</span> <span class="n">userpass</span><span class="o">=</span><span class="p">[(</span><span class="s">'sampleuser'</span><span class="p">,</span><span class="s">'samplepass'</span><span class="p">)]))</span> </pre></div> </div> <p>Then you can submit changes using the <a class="reference internal" href="../manual/cmdline.html#cmdline-try" title="try"><tt class="xref bb bb-cmdline docutils literal"><span class="pre">try</span></tt></a> command.</p> <p>Let's try this out by making a one-line change to pyflakes, say, to make it trace the tree by default:</p> <div class="highlight-python"><pre>git clone git://github.com/buildbot/pyflakes.git pyflakes-git cd pyflakes-git/pyflakes $EDITOR checker.py # change "traceTree = False" on line 185 to "traceTree = True"</pre> </div> <p>Then run buildbot's try command as follows:</p> <div class="highlight-python"><pre>source ~/tmp/buildbot/sandbox/bin/activate buildbot try --connect=pb --master=127.0.0.1:5555 --username=sampleuser --passwd=samplepass --vc=git</pre> </div> <p>This will do "git diff" for you and send the resulting patch to the server for build and test against the latest sources from git.</p> <p>Now go back to the <a class="reference external" href="http://localhost:8010/waterfall">waterfall</a> page, click on the runtests link, and scroll down. You should see that another build has been started with your change (and stdout for the tests should be chock-full of parse trees as a result). The "Reason" for the job will be listed as "'try' job", and the blamelist will be empty.</p> <p>To make yourself show up as the author of the change, use the --who=emailaddr option on 'buildbot try' to pass your email address.</p> <p>To make a description of the change show up, use the --properties=comment="this is a comment" option on 'buildbot try'.</p> <p>To use ssh instead of a private username/password database, see <a class="reference internal" href="../manual/cfg-schedulers.html#sched-Try_Jobdir" title="Try_Jobdir"><tt class="xref bb bb-sched docutils literal"><span class="pre">Try_Jobdir</span></tt></a>.</p> </div> </div> </div> </div> </div> </div> <div class="sidebar"> <h3>Table Of Contents</h3> <ul class="current"> <li class="toctree-l1 current"><a class="reference internal" href="index.html">Buildbot Tutorial</a><ul class="current"> <li class="toctree-l2"><a class="reference internal" href="firstrun.html">First Run</a></li> <li class="toctree-l2 current"><a class="current reference internal" href="">A Quick Tour</a><ul class="simple"> </ul> </li> </ul> </li> <li class="toctree-l1"><a class="reference internal" href="../manual/index.html">Buildbot Manual</a></li> <li class="toctree-l1"><a class="reference internal" href="../developer/index.html">Buildbot Development</a></li> </ul> <h3 style="margin-top: 1.5em;">Search</h3> <form class="search" action="../search.html" method="get"> <input type="text" name="q" size="18" /> <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="firstrun.html" title="First Run" >previous</a> | <a href="../manual/index.html" title="Buildbot Manual" >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/tutorial/tour.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.0.7. </div> </div> <div class="clearer"></div> </div> </div> </body> </html>