CruiseControl FAQ

From Foochal

Jump to: navigation, search


Contents

Installing cruisecontrol

  • Create a new linux user "cruisecontrol"
adduser cruisecontrol
  • Add it to the cvs group (if you need to checkout source code from cvs)
usermod -g cruisecontrol cvs
  • Login as the user cruisecontrol
su - cruisecontrol
  • Download cruise control binary and unzip in /home/cruisecontrol
  • Make a work directory
mkdir work
cd work
mkdir artifacts checkout logs
  • Create dashboard-config.xml in the work directory
vi dashboard-config.xml
<dashboard>
  <buildloop logsdir="/home/cruisecontrol/work/logs" artifactsdir="/home/cruisecontrol/work/artifacts" />
  <features allowforcebuild="true"/>
  <subtabs>
    <subtab class="net.sourceforge.cruisecontrol.dashboard.widgets.ErrorsAndWarningsMessagesWidget" />
  </subtabs>
</dashboard>
  • Create config.xml in the work directory
vi config.xml
<cruisecontrol>
<project name="foochal" buildafterfailed="true">
    <!-- Bootstrappers are run every time the build runs, *before* the modification checks -->
    <bootstrappers>
        <cvsbootstrapper localWorkingCopy="checkout/${project.name}" cvsroot=":ext:cruisecontrol@your.cvsserver.url:/path/to/cvs" />
    </bootstrappers>

    <!-- Defines where cruise looks for changes, to decide whether to run the build -->
    <modificationset quietperiod="10">
       <cvs cvsroot=":ext:cruisecontrol@your.cvsserver.url:/path/to/cvs" module="yourcvsmodulename"/>
    </modificationset>

    <!-- Configures the actual build loop, how often and which build file/target -->
    <schedule interval="600">
        <maven2 mvnhome="/usr/local/maven" goal="clean | compile | test | package | cargo:deployer-redeploy" pomfile="checkout/${project.name}/pom.xml" />
    </schedule>

    <!-- directory to write build logs to -->
    <log dir="logs/${project.name}">
        <merge
                   dir="checkout/${project.name}"
                   pattern="TEST-*.xml" />
    </log>

    <listeners>
        <currentbuildstatuslistener file="logs/${project.name}/buildstatus.txt"/>
    </listeners>

    <!-- Publishers are run *after* a build completes -->
    <publishers>
      <currentbuildstatuspublisher file="logs/${project.name}/buildstatus.txt"/>
        <email mailhost="localhost"
           returnaddress="cruisecontrol@foochal.org"
           buildresultsurl="http://someurl/cruisecontrol-dashboard/tab/build/detail/${project.name}"
           skipusers="true" spamwhilebroken="true">
        <always address="foochal@foochal.org"/>
        <failure address="foochal@foochal.org"/>
    </email>
    </publishers>
  </project>
</cruisecontrol>

Installing under tomcat

  • Copy the webapp directories to ~tomcat/webapps
cp -R ~cruisecontrol/cruisecontrol-bin-2.7.2/webapps/dashboard/ ~tomcat/webapps/cruisecontrol-dashboard
  • Change the jetty port to 9000/9080 in the following file:
~/cruisecontrol-bin-2.7.2/cruisecontrol.sh
  • You might want to disable jetty by removing the webport parameter and value from the arguments
-webport 9080
  • Pass startup parameter to tomcat.
-Ddashboard.config=/home/cruisecontrol/work/dashboard-config.xml

Assume that your final tomcat url is http://localhost:8080/cruisecontrol-dashboard.

  • Configure the build loop with your dashboard url by adding the dashboardurl parameter
... -rmiport 1099 -dashboardurl http://localhost:8080/cruisecontrol-dashboard

Permissions

  • make sure that dashboard-config.xml is readable by tomcat
chmod 755 ~cruisecontrol/
  • logs and artifacts are writable/readable by tomcat

Setting up environment

export PATH=$PATH:$HOME/bin:/usr/local/firefox
export JAVA_HOME=/usr/lib/jvm/java
export CVSROOT=:ext:cruisecontrol@your.cvs.server.url:/var/lib/cvs
export CVS_RSH=ssh

Checkout source code

cd checkout
cvs co foochal

Running CruiseControl under tomcat

Follow the instruction on CruiseControl website regarding how you should create logs, artifacts and other directories. The following is specific how to use tomcat instead of jetty.

Configure tomcat

  • Configure tomcat.conf to specify dashboard-config.xml
  • Copy the dashboard webapp under tomcat webapps
  • Restart tomcat

Configure CruiseControl

Assume that your final tomcat url is http://localhost:8888/dashboard.

  • Configure the build loop with your dashboard url by adding the dashboardurl parameter
... -rmiport 1099 -dashboardurl http://localhost:8888/dashboard
  • Disable jetty by removing the webport parameter and value from the arguments
-webport 9080

Personal tools