Cruise Configuration Reference

<cruise>
<server>
<license/> <security> </security>
</server>
<pipelines>
<pipeline>
<dependencies> </dependencies>
<materials> </materials>
<stage>
<jobs> </jobs>
</stage>
</pipeline>
</pipelines>
<agents>
<agent>
<resources> </resources>
</agent>
</agents>
</cruise>
top

Configuration reference

<cruise>

The <cruise> element is the root element of the configuration.

top

<server>

The <server> element can be used to define information and attributes of the cruise server.

Attributes

Attribute Required Description
artifactsdir No The directory is where Cruise will store its information, including artifacts published by jobs. The default value is 'logs' in the folder in which the cruise server is installed. You can use an absolute path or a relative path. A relative path will take the server installed folder as the root. Notes: If you specify the attribute, please check that Cruise has permission to access that directory.
top

<license>

The <license> element contains your Cruise license. If you don't have one please visit the Cruise Website to obtain one.

Attributes

Attribute Required Description
user Yes the user name in your license

Examples

<license user="${the user name in your license}">
  ${license key}
</license>
          
top

<security>

The <security> element can be used to enable authentication. If the element is not there, authentication will be disabled. We currently support LDAP and a simple password file format. You can use both methods if you want. This can be useful if you want to allow access from scripts without having to add a lot of users to your corporate LDAP. In this case you could add a 'script' user to the password file.

top

<ldap>

The <ldap> element is used to specify the ldap server. Users can access Cruise with their username and password from this ldap server.

Attributes

Attribute Required Description
uri Yes uri for the ldap server. For example, uri="ldap://xxx.yourcompany.com"
managerDn Yes For example, managerDn="cn=Active Directory Ldap User,ou=InformationSystems,ou=SharedAccounts,ou=Principal,dc=xxxxx,dc=yyyy,dc=com"
managerPassword Yes Cruise will connect to the LDAP server with this password
searchBase Yes e.g. searchBase="ou=Employees,ou=Enterprise,ou=Principal,dc=xxxx,dc=yyyy,dc=com"
searchFilter No e.g. searchFilter="(sAMAccountName={0})"
top

<passwordFile>

The <passwordFile> element is used to specify a file which has a set of Username and password pairs. The format of username and password in this file is ${username}=${password which has been encrypted with SHA1}, with one line per user.

Attributes

Attribute Required Description
path Yes The absolute path of the password file.

Examples

Suppose the password file is admins.properties, which is located in /home/cruise. You want to create two users as Administrators:

  1. one username is Jez, the password encrypted with SHA1 is ThmbShxAtJepX80c2JY1FzOEmUk=
  2. the other one is lqiao, the password encrypted with SHA1 is TfkgShslgJepX80c2JY1trwEskT=

The configuration could look like:

<security>
  <passwordFile path="/home/cruise/admins.properties"/>
</security>
          

The username and password could be set in admins.properties as follows:

            Jez=ThmbShxAtJepX80c2JY1FzOEmUk
            lqiao=TfkgShslgJepX80c2JY1trwEskT
          
top

<admins>

The <admins> element specifies which users are administrators. Only administrators can open the Administration tab to maintain Cruise Configuration.

Notes:

If you want to specify administrators, you must define an authentication method, either <ldap> or <passwordFile>.

top

<user>

One <user> element is used to specify one administrator. You can add as many as you like.

Notes:
  1. The user must be in your LDAP or passwordFile.
  2. Cruise does not support groups yet.
  3. If the same user name exists in both the LDAP and password file, then both of them would be administrators.
    1. Examples

      Two users would be administrators, they are Jez and lqiao.

      <admins>
        <user>Jez</user>
        <user>lqiao</user>
      </admins>
                
top

<pipelines>

The <pipelines> element is a container of pipelines.

top

<pipeline>

The <pipeline> element specifies a single pipeline.

Notes:

There should be at least one stage in one pipeline. Cruise uses the pipeline name to identify the pipeline. If you change the pipeline name, you will lose the history of the pipeline.

Attributes

Attribute Required Description
name Yes The name is used to identify a pipeline, so each pipeline name must be unique. Pipeline names can contain the following characters: a-z, A-Z, 0-9, fullstop, underscore and hyphen. Spaces are not allowed. Names are case-insensitive in Cruise.
labeltemplate No You can customize a pipeline label with ${COUNT}. The default value is '${COUNT}'. For example, if you specify labeltemplate="foo-1.0-${COUNT}", your pipelines will show foo-1.0-1, foo-1.0-2, and so on. You can only have one ${COUNT} in the labeltemplate. Lower case ${count} is also invalid.
top

<dependencies>

The <dependencies> element specifies stages that can trigger this pipeline. If multiple dependencies are defined the pipeline will trigger on successful completion of any of them.

top

<depends>

The <depends> element specifies the stage of a pipeline which will trigger the current pipeline to start.

Attributes

Attribute Required Description
pipeline Yes The name of a pipeline that this pipeline depends on.
stage Yes The name of a stage which will trigger this pipeline once it is successful.

Examples

Suppose there are four pipelines, and they are commonLib1, commonLib2, Server and Client. For example, the stage 'distStage' in commonLib1 pipeline can trigger the other two pipelines, and the stage 'pkgstage' in commonLib2 pipeline can trigger Server pipeline. The configuration would be:

<pipeline name="commonLib1">
      ...
  <stage name="unittest">
       ...
  </stage>
  <stage name="distStage">
       ...
  </stage>
  <stage name="publishStage">
       ...
  </stage>
<pipeline name="commonLib1">
      ...
  <stage name="unittest">
       ...
  </stage>
  <stage name="functionaltest">
       ...
  </stage>
  <stage name="pkgStage">
       ...
  </stage>
</pipeline>
<pipeline name="Server">
  <dependencies>
    <depends pipeline="commonLib1" stage="distStage"/>
    <depends pipeline="commonLib2" stage="pkgStage"/>
  </dependencies>
       ...
</pipeline>
<pipeline name="Client">
  <dependencies>
    <depends pipeline="commonLib1" stage="distStage"/>
  </dependencies>
       ...
</pipeline>
      
top

<stage>

The <stage> element specifies a set of jobs. Any jobs in a given stage failed means the stage failed. If a stage without <approval> is followed passes any following stages will be triggered automatically.

Notes:

There must be at least one job in one stage.

Attributes

Attribute Required Description
name Yes The name is used to identify a stage in the pipeline, so it has to be unique for that <pipeline>. The available characters in stage name are following: a-z, A-Z, 0-9, fullstop, underscore and hyphen. Spaces are not allowed. The name is case-insensitive in Cruise.
top

<materials>

The <materials> element specifies the source of the pipelines changes. Generally this will be your codebase in your source control repository. Cruise will check modifications and check out your code by this material.

Notes:

Currently Cruise does not support multiple materials in one pipeline. so you can specify only one material, either subversion or mercurial. Cruise checks modifications every 1 minute. You can not currently specify the interval for checking modifications.

top

<svn>

The <svn> element specifies the location of your code base in Subversion repository. Cruise only supports remote repository. Note that you do not have to check out the code manually. Cruise supports the following protocols for subversion: http, https, svn and svn+ssh.

Notes:

You do not have to install Subversion in Cruise server and agent. But if you use https, you have to go to the server and each agent, and as the user 'cruise', do an svn up to store the certificates in the cache permanently.

Attributes

Attribute Required Description
url Yes URL for the remote repository.
username No The user account for the remote repository.
password No The password for the specified user
checkexternals No The values should be either one of [true, 1, false, 0]. Cruise will always check out the latest revision for svn externals no matter what value checkexternals has. However when checkexternals is true the pipeline can be triggered by the changes of svn externals. The default is false.
top

<hg>

The <hg> element specifies the location of your code base in a Mercural repository. Cruise supports remote repository. Cruise supports two protocols for mercural: http and ssh.

Notes:

You must install Mercurial 1.0 or above on the Cruise server and agents which will be assigned a job with Mercurial repository to run. Cruise does not Ship with Mercurial.

Attributes

Attribute Required Description
url Yes URL to fetch source code from the remote repository. If you specify the user name and password for the Mercural repository, you have to put them into the url.
top

<jobs>

The <jobs> element specified the set of jobs for a stage.

Note:

<jobs> can contain several <job> elements; these jobs can run in parallel on different agents individually (see the <agent> element).

top

<job>

A <job> is the basic unit of work — it will be sent to an agent to build. The agent will update the source code, fetch the artifacts which have been defined in <job>, build and publish the results of your job.

Notes:

If you want a particular job to be able to be executed on a particulare agent, you have to specify <resources>. If so, Cruise will assign it to the agent which have those resources to supply.

Attributes

Attribute Required Description
name Yes Unique identifier for this job in the same stage. The available characters in the job name are: a-z, A-Z, 0-9, fullstop, underscore and hyphen. Spaces are not allowed. The name is case-insensitive in Cruise.
top

<resources>

<resources> specifies the resources needed for a job.

Note:

If a job has no resources it can be built on any available agent.

top

<resource>

A <resource> is the declaration of a resource which the job require to build.

contents

The available characters for resources are following: a-z, A-Z, 0-9, fullstop, underscore and hyphen. The name is case-insensitive in Cruise. Spaces are not allowed.

Note:

You can add multiple resources for one job. An agent must have all of resources in a job for the agent to build that job.

Example:

<resources>
  <resource>jdk5</resource>
  <resoucre>tomcat5</resource>
  <resoucre>mercurial</resource>
</resources>
          
top

<tasks>

<tasks> specifies the tasks that will run as part of a job. The following environment variables are set for all tasks:

Variable Description
CRUISE_SERVER_URL the base URL for the server. This includes the /cruise - so it would look something like this: https://[Cruise Server host]:8154/cruise
CRUISE_PIPELINE_LABEL the label for the current pipeline for the server. By default this is set to the pipeline count. You can customise this in the pipeline configuration by setting a labeltemplate.
CRUISE_PIPELINE_NAME the name of the pipeline that is being run
CRUISE_STAGE_NAME the name of the stage that is being run
CRUISE_JOB_NAME the name of the job that is being run
Note:

You can add multiple tasks. All of tasks will execute in the order specified in the configuration file. If a task fails, the following tasks would never run. Note that while you can specify multiple tasks, it is usually better to only have a single task. Consider making each of those tasks a separate job, or creating a build target that specifies the multiple targets.

Note:

All paths specified below must be relative to the base directory of your materials.

top

<ant>

Specifies an Ant build to run. Cruise ships with apache-ant-1.7.0 and will use that version to run the build script. Cruise also depends on and uses JDK 1.6. If you require 1.4 or 1.5 binaries, please remember to specify this in your Ant javac task.

Attributes

Attribute Required Description
buildfile No (defaults to build.xml) Path to Ant build file.
target No Ant target(s) to run. Default is the default target for the build file.
WorkingDir No Will invoke ant in the specified directory. Only a path relative to the base directory of your materials is valid.

Examples

  1. Invoke ant, specifying a set of targets to run:

    <ant target="-Drun=all clean.ivy.localivy clean ft.long_running" />
              
  2. Invoke ant in a specific working directory with a specific set of targets:

    <ant workingdir="build" buildfile="mybuild.xml" target="-Drun=all clean.ivy.localivy clean ft.long_running" />
              
top

<exec>

Runs a specified command. The build will fail if the command cannot be run or it returns an error.

Attributes

Attribute Required Description
command Yes The command or script to be executed, relative to the working directory.
args No Set of arguments (as a single string) to be passed to the command or script.
workingdir No The directory in which the script or command is to be executed. Defaults to the directory on the agent where the materials are checked out.
timeout No The job will be halted if the script or command continues longer than the specified timeout. The Value is specified in seconds.

Examples

  1. Invoke ruby, specifying the working directory as /workspace/MyCodebase and executing the ruby script backup.rb.

    <tasks>
      <exec workingdir="/workspace/MyCodebase"  
                 command="/usr/local/bin/ruby"
                 args="backup.rb"/>
    </tasks>
              
top

<nant>

Specifies a NAnt build to be run. Cruise does not include a copy of Nant so you should install it on the agent yourself.

Attributes

Attribute Required Description
buildfile No (defaults to default.build) Path to NAnt build file relative to the job's working directory.
target No NAnt target(s) to run. Default is "", or the default target for the build file.
Workingdir No Will invoke NAnt in the specified directory. Only relative path is valid.
nantpath No Directory in which NAnt is installed. By default Cruise will assume that NAnt is on the current path. Note If you specify this then you should ensure that the paths are the same in all agents which will run the job.

Examples

  1. Invoke nant, specifying a set of targets to run:

    <nant buildfile="myproject.build" target="smoke-test" />          
    
top

<rake>

Specifies a Rake build to be run. Cruise does not include rake so you have to install it on those agents which will do the job.

Attributes

Attribute Required Description
buildfile No (defaults to default.build) Path to Rake build file. Note If you specify this then you should ensure that the paths are the same in all agents which will run the job.
target No Rake target(s) to run. Default is the default target for the build file.
workingdir No Will invoke Rake in the specified directory. The path is relative to the working directory of the job.
top

<artifacts>

<artifacts> specifies what files the agent will publish to the server.

top

<artifact>

Publish build artifacts to the artifact repository for the job.

Attributes

Attribute Required Description
src Yes The file or folder to publish to the server. Relative to the working directory of the job.
dest No The destination is relative to the artifacts folder of current instance on the server side. If it is not specified, the artifact will be stored in the root of the artifacts directory.
top

<test>

The src attribute should point towards a folder that contains the test output files. Cruise will use these to generate a test report. Test information is placed in the Failures and Test sub-tabs. Test results from multiple jobs are aggregated on the stage detail pages. This allows you to see the results of tests from both functional and unit tests even if they are run in different jobs.

Attributes

Attribute Required Description
src Yes Specify the directory into which the test output of the job will be put on agent side. This is relative to the job's working directory.
dest No The path in the artifacts repository where the reports will be placed.
top

<tabs>

The <tabs> element allows you to add tabs to the Job Details page. You can put any artifact into a tab. For example, if your coverage tool produces an html report, you can easily place that report into a tab.

top

<tab>

Define a tab specific name and and artifact to show.

Attributes

Attribute Required Description
name Yes The name of the sub-tab. If should be unique in that job.
path Yes The relative path of a file in the artifact repository of the job. Absolute paths are invalid.

Example:

Given some coverage infomation in 'target/Jcoverage' folder on the agent side, We configure a tab to show the coverage information by specifying a tab with the index.html file.

<artifacts>
    <artifact src="target/jcoverage" dest="Jcoverage">
</artifacts> 
<tabs>
    <tab src="coverage" path="Jcoverage/index.html">
</tabs> 
    
top

<approval>

You can use <approval> to specify that the pipeine should pause for manual approval when this stage completes. If there is no <approval>, the following stage will be run automatically once the stage is passed.

Notes:

<approval> must be the last subelement in <stage>

top

<agents>

The <agents> element specifies the set of agents known by the server.

Notes:

Do not change it manually. You can manage these through the Agents tab.

top

<agent>

An approved agent. Before it is approved, the agent is displayed on the top of the agent tab with a grey bar.

Attributes

Attribute Required Description
hostname Yes Hostname for the agent
ipaddress Yes IP for the agent.
uuid Yes Identifier for the agent. It is created by Cruise automatically.

Notes:

Cruise uses the agent's hostname as its identification.

A local agent will be approved automatically.

top

<resources>

<resources> descibes the resources available on a particular agent.

Note:

An agent without any resources will build any jobs that don't specify resources. Refer to the <resources> of <job>.

top

<resource>

resources names can contain the following characters: a-z, A-Z, 0-9, fullstop, underscore and hyphen. Spaces are not allowed.