Hydra/28: Rename "scheduler" to "evaluator"
[?]
May 11, 2010, 11:09 AM
Q6SOGMDQJAUDMVINADMRAFUMN4TDTUAX3ZEIL3DBEXNRLDN5UNUQCDependencies
- [2]
Y3UAIWOKgeneral information - [3]
YOC4WW2Tripped intro from the SCP paper and manualized it - [4]
D5QIOJGP* Move everything up one directory. - [5]
EWQC6EZVgeneral information - [6]
JK2QWPH6 - [7]
N22GPKYT* Put info about logs / build products in the DB. - [8]
RXNVIXTLwhy nix is covered in intro - [9]
KBW3FDZ2Merge remote branch 'remotes/origin/master' - [10]
6MGFQDR2deleted some old scripts - [11]
ERNOO5ZZ* Reorganising. - [12]
QPXJVRYKboilerplate, platform stuff - [13]
5AKAE3R6start of hydra manual - [14]
T4LLYESZ* Nix expression for building Hydra. - [15]
6A6CZ7SCdraft manual
Change contents
- file deletion: manual.html
<html><head><link rel="stylesheet" href="style.css" type="text/css"></head><body><hr><h1>The Hydra Buildfarm User Manual</h1><h2>Draft (Version 0.1)</h2><p/><h3>Eelco Dolstra and Eelco Visser</h3><p/>Delft University of Technology<p/>Department of Software Technology<p/>Copyright 2008 Eelco Dolstra<hr><h2>Chapter 1. Introduction</h2><h3>1.1. About Hydra</h3><li> In large projects, developers often work on a particularcomponent of the project, and do not build and test the compositionof those components (again since this is likely to take too long).To prevent the phenomenon of ``big bang integration'', wherecomponents are only tested together near the end of the developmentprocess, it is important to test components together as soon aspossible (hence <em>continuous integration</em>).<p/><li> It allows software to be <em>released</em> by automaticallycreating packages that users can download and install. To do thismanually represents an often prohibitive amount of work, as one maywant to produce releases for many different platforms: e.g.,installers for Windows and Mac OS X, RPM or Debian packages forcertain Linux distributions, and so on.<p/></ol><p/></ol><p/>Examples of continuous integration tools include CruiseControlTinderbox, Sisyphus, Anthill and BuildBot. These tools have variouslimitations.<ol><li> They do not manage the <em>build environment</em>. The buildenvironment consists of the dependencies necessary to perform a buildaction, e.g., compilers, libraries, etc. Setting up the environmentis typically done manually, and without proper SCM control (so it maybe hard to reproduce a build at a later time). Manual management ofthe environment scales poorly in the number of configurations thatmust be supported. For instance, suppose that we want to build acomponent that requires a certain compiler X. We then have to go toeach machine and install X. If we later need a newer version of X,the process must be repeated all over again. An ever worse problemoccurs if there are conflicting, mutually exclusive versions of thedependencies. Thus, simply installing the latest version is not anoption. Of course, we can install these components in differentdirectories and manually pass the appropriate paths to the buildprocesses of the various components. But this is a rather tiresomeand error-prone process. <p/><li> They do not easily support <em>variability in softwaresystems</em>. A system may have a great deal of build-timevariability: optional functionality, whether to build a debug orproduction version, different versions of dependencies, and so on.(For instance, the Linux kernel now has over 2,600 build-timeconfiguration switches.) It is therefore important that a continuousintegration tool can easily select and test different instances fromthe configuration space of the system to reveal problems, such aserroneous interactions between features. In a continuous integrationsetting, it is also useful to test different combinations of versionsof subsystems, e.g., the head revision of a component against stablereleases of its dependencies, and vice versa, as this can revealvarious integration problems.</ol><p/><em>Hydra</em>, is a continuous integration tool that solves theseproblems. It is built on top of the <a href="http://nixos.org">Nixpackage manager</a>, which has a purely functional language fordescribing package build actions and their dependencies. This allowsthe build environment for projects to be produced automatically anddeterministically, and variability in components to be expressednaturally using functions; and as such is an ideal fit for acontinuous build system.<p/>The nixos.org installation of Hydra runs at<blockquote><a href="http://hydra.nixos.org/">http://hydra.nixos.org</a></blockquote>That installation is used to build software components from the<a href="http://nixos.org">Nix</a>,<a href="http://nixos.org/nixos">NixOS</a>,<a href="http://strategoxt.org">Stratego/XT</a>,and related projects.If you are one of the developers on those projects, it is likely thatyou will be using the NixOS Hydra server in some way. If you need toadminister automatic builds for your project, you should pull theright strings to get an account on the server. This manual will tellyou how to set up new projects and build jobs within those projectsand write a release.nix file to describe the build process of yourproject to Hydra. You can skip Chapter 2.<p/>If your project does not yet have automatic builds within the NixOSHydra server, it may actually be eligible. We are in the process ofsetting up a large buildfarm that should be able to support opensource and academic software projects. Get in touch.If you need to run your own Hydra installation, Chapter 2 explainshow to download and install the system on your own server.<h2>Chapter 2. Installation and Configuration</h2>This chapter explains how to install Hydra on your own buildfarm server.<h3>2.1. Platform Requirements</h3><p/>Of course we think it is a good idea to use the <ahref="http://nixos.org/nixos">NixOS</a> Linux distribution for yourbuildfarm server. But this is not a requirement. The Nix softwaredeployment system can be installed on any Linux distribution inparallel to the regular package management system. Thus, you can useHydra on a Suse, Fedora, or Ubuntu system.<h3>2.2. Getting Nix</h3>If your server runs NixOS you are all set to continue withinstallation of Hydra. Otherwise you first need to install Nix.The <a href="http://nixos.org/releases/nix/nix-0.12">latest stable release</a> is Nix 0.12.Installation instructions can be found in the<a href="http://nixos.org/releases/nix/nix-0.12/manual/">Nix User's Guide</a>.<h3>2.3. Installation</h2>To install Hydra, get the most recent 'closure' available from<blockquote><a href="http://hydra.nixos.org/releases/hydra/unstable">http://hydra.nixos.org/releases/hydra/unstable</a></blockquote>And follow the instructions that are revealed by clicking [help].<pre class="programlisting">$ gunzip < hydra-build.closure.gz | nix-store --import</pre>This unpacks the closure and imports its components into the Nix store.<pre class="programlisting">$ nix-env -i /nix/store/...-hydra-build</pre>This makes the tools in the Hydra package available in your Nix userenvironment.<p/>Command completion should then reveal a number of tools related tohydra installed:<pre class="programlisting">$ hydra_<tab>hydra_build.pl hydra_fastcgi.pl hydra_scheduler.plhydra_cgi.pl hydra_init.pl hydra_server.plhydra_create.pl hydra_queue_runner.pl hydra_test.pl</pre><h3>2.4. Configuration</h3>The Hydra software is installed in the Nix store, but to run it needsa directory for storing the database, logs, and session data. In your<code>.bashrc</code> or similar configuration file define:<pre class="programlisting">export HYDRA_DATA=/usr/local/hydra</pre>and make sure that you actually create that directory. (Of course, youcan use another directory, but then remember to also substitute thatname in the commands below.)<p/>Run <code>hydra_init.pl</code> to initialize the database<pre class="programlisting">$ hydra_init.pl</pre>Run <code>hydra_server.pl</code> to start the webserver at <a href="http://localhost:3000">http://localhost:3000</a><pre class="programlisting">$ hydra_server.pl</pre>Also start the scheduler, which monitors the source repositories andadds builds to the queue, and the runner, which executes jobs in thequeue.<pre class="programlisting">$ hydra_scheduler.pl$ hydra_queue_runner.pl</pre>Now your Hydra server should be up and running and the web interfaceoperational.<h3>2.5. User Administration</h3>To be able to add jobs and create projects you need to register usersin the Hydra database. In the current version, the web interface doesnot yet support user administration. Use the following command to adda new user to the database.<pre class="programlisting">$ sqlite3 /usr/local/hydra/hydra.sqlite "insert into Users(userName, emailAddress, password) values('eelco', 'blablah@example.org', '$(echo -n foobar | sha1sum | cut -c1-40)');"</pre>where <code>eelco</code> is the username, and <code>foobar</code> thepassword. (Make sure to use other values!)<p/>To give this user administrator privileges, follow this up by:<pre class="programlisting">$ sqlite3 /usr/local/hydra/hydra.sqlite "insert into UserRoles(userName, role) values('eelco', 'admin');"</pre>Now you should be able to create a project using the Hydra web interface.<h2>Chapter 3. Creating Projects</h2>The next step is to add projects to the buildfarm. We follow theexample of the patchelf project at hydra.nixos.org. Note that theerror messages provided as feedback by the webinterface can besomewhat unfriendly in the current version.<p/><a href="http://localhost:3000/login">Login</a>to the webinterface of your Hydra installation usingthe username and password you inserted in the database.Then follow the'<a href="http://localhost:3000/createproject">Create Project</a>'link to create a new project.<h3>3.1. General information</h3></pre><pre>I'm very sorry, but an error occurred:DBIx::Class::ResultSet::create(): DBI Exception: DBD::SQLite::st execute failed: column name is not unique(19) at dbdimp.c line 402</pre>So try to create the project after entering just the generalinformation to figure out if you have chosen a unique name.Jobsets can be added once the project has been created.<p/>A project can consist of multiple `jobsets', separate tasks that canbe built separately, but may depend on each other (without cyclicdependencies, of course). Go to the<a href="http://localhost:3000/project/patchelf/edit">Edit</a>page of the Patchelf project and 'Add a new jobset'by providing the following 'Information':Identifier: trunkDescription: TrunkNix expression: release.nix in input patchelfSrc</pre>This states that in order to build the 'Trunk' jobset, the Nixexpression in the file 'release.nix', which can be obtained from input'patchelfSrc', should be evaluated. (We'll have a look at release.nixlater.)<p/>To realize a job we probably need a number of inputs, which can bedeclared in the table below. As many inputs as required can be added.For patchelf we declare the following inputs.nixpkgs 'CVS checkout' https://svn.nixos.org/repos/nix/nixpkgs/trunk</pre>officialRelease Boolean false</pre>system String value "i686-linux"</pre>systemthere must be one primary jobcheck the radio button of exactly one jobhttps://svn.nixos.org/repos/nix/nixpkgs/trunk- Voorbeelden van Nix expressies voor Hydra:https://svn.nixos.org/repos/nix/patchelf/trunk/release.nixhttps://svn.nixos.org/repos/nix/nix/trunk/release.nixhttps://svn.nixos.org/repos/nix/hydra/trunk/release.nixOverigens zijn die helemaal niet Hydra-specifiek, je kunt ze gewoon vanaf decommand line bouwen, bijv. als je een patchelf checkout hebt (met een nixpkgscheckout in ../nixpkgs):$ nix-build release.nix -A rpm_fedora10i386</body></html><h3>3.5. Building on the command line</h3><h3>3.4. release.nix</h3><h3>3.3. Building Jobs</h3><h3>3.2. Release Set</h3><pre class="programlisting">officialReleasenixpkgs<pre class="programlisting"><pre class="programlisting">patchelfSrc'Subversion checkout' https://svn.nixos.org/repos/nix/patchelf/trunk</pre>patchelfSrc<pre class="programlisting"><pre class="programlisting"><h3>3.2. Jobsets</h3>Once created there should be an entry for the project in thesidebar. Go to the project page for the <ahref="http://localhost:3000/project/patchelf">Patchelf</a> project.Only if the project is <strong>enabled</strong> are builds performed.<pre class="programlisting">Display name: Patchelf</pre>The <strong>display name</strong> is used in menus.<pre class="programlisting">Description: A tool for modifying ELF binaries</pre>The <strong>description</strong> is used as short documentation of thenature of the project.<pre class="programlisting">Owner: eelco</pre>The <strong>owner</strong> of a project can create and edit jobsets.<pre class="programlisting">Enabled: Yes</pre>The <strong>identifier</strong> is the identity of the project. It isused in URLs and in the names of build results.<p/>The identifier should be a unique name (it is theprimary database key for the project table in the database). If youtry to create a project with an already existing identifier you'd getan error message such as:<pre class="programlisting">Identifier: patchelfHere's what we fill in for the patchelf project:A project definition consists of some general information and a set ofjobsets. The general information identifies a project, its owner, andcurrent state of activity.To run Hydra you need a Linux server. For small projects, Hydra canbe run on any reasonably modern machine. For individual projects youcan even run Hydra on a laptop. However, the charm of a buildfarmserver is usually that it operates without disturbing the developer'sworking environment and can serve releases over the internet. Inconjunction you should typically have your source code administered ina version management system, such as subversion. Therefore, you willprobably want to install a server that is connected to theinternet. To scale up to large and/or many projects, you will need atleast a considerable amount of diskspace to store builds. Since Hydracan schedule multiple simultaneous build jobs, it can be useful tohave a multi-core machine, and/or attach multiple build machines in anetwork to the central Hydra server.<h3>1.6. Hydra on your own buildfarm</h3><h3>1.4. License</h3>Hydra is free software; you can redistribute it and/or modify it underthe terms of the GNU Lesser General Public License as published by theFree Software Foundation; either version 2.1 of the License, or (atyour option) any later version. Hydra is distributed in the hope thatit will be useful, but WITHOUT ANY WARRANTY; without even the impliedwarranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Seethe GNU Lesser General Public License for more details.<h3>1.5. Hydra at nixos.org</h3><h3>1.2. About Us</h3>Hydra is the successor of the Nix Buildfarm, which was developed intandem with the Nix software deployment system. Nix was originallydeveloped at the Department of Information and Computing Sciences,Utrecht University by the TraCE project (2003-2008). The project wasfunded by the Software Engineering Research Program Jacquard toimprove the support for variability in software systems. Funding forthe development of Nix and Hydra is now provided by the NIRICT LaQuSoBuild Farm project.<h3>1.3. About this Manual</h3>This manual tells you how to install the Hydra buildfarm software onyour own server and how to operate that server using its webinterface.In its simplest form, a continuous integration tool sits in a loopbuilding and releasing software components from a version managementsystem. For each component, it performs the following tasks:<ol><li>It obtains the latest version of the component's source codefrom the version management system.<li> It runs the component's build process (which presumably includesthe execution of the component's test set).<li> It presents the results of the build (such as error logs andreleases) to the developers, e.g., by producing a web page.<li> Likewise, many projects have very large test sets (e.g.,regression tests in a compiler, or stress tests in a DBMS) that cantake hours or days to run to completion.<p/><li> Many kinds of static and dynamic analyses can be performed aspart of the tests, such as code coverage runs and static analyses.<p/><li> It may also be necessary to build many different <em>variants</em>of the software. For instance, it may be necessary to verify thatthe component builds with various versions of a compiler.<p/><li> Developers typically use incremental building to test theirchanges (since a full build may take too long), but this isunreliable with many build management tools (such as Make), i.e.,the result of the incremental build might differ from a full build.<p/><li> It ensures that the software can be built from the sources underrevision control. Users of version management systems such as CVSand Subversion often forget to place source files under revisioncontrol.<p/><li> The machines on which the continuous integration system runsideally provides a clean, well-defined build environment. If thisenvironment is administered through proper SCM techniques, thenbuilds produced by the system can be reproduced. In contrast,developer work environments are typically not under any kind of SCMcontrol.<p/>Hydra is a tool for continuous integration testing and softwarerelease that uses a purely functional language to describe build jobsand their dependencies. Continuous integration is a simple techniqueto improve the quality of the software development process. Anautomated system continuously or periodically checks out the sourcecode of a project, builds it, runs tests, and produces reports for thedevelopers. Thus, various errors that might accidentally be committedinto the code base are automatically caught. Such a system allowsmore in-depth testing than what developers could feasibly do manually:<p/><ol><li> <em>Portability testing</em>: The software may need to be builtand tested on many different platforms. It is infeasible for eachdeveloper to do this before every commit.<p/> - file move: hydra_scheduler.pl → hydra_evaluator.pl