This page last changed on Mar 14, 2009 by dcameron.

The Executable Task lets you invoke any command line executable. It doesn't offer as much specific integration as (for example) the NAnt Task, but does allow you to hook almost anything up as a build process to CCNet. CCNet will examine the exit code when the executable ends and act accordingly.

Examples

Minimalist example:

<exec executable="c:\projects\myproject\build.bat"/>

Full example:

<exec>
    <executable>make</executable>
    <baseDirectory>D:\dev\MyProject</baseDirectory>
    <buildArgs>all</buildArgs>
    <buildTimeoutSeconds>10</buildTimeoutSeconds>
    <successExitCodes>0,1,3,5</successExitCodes>
    <environment>
        <variable>
            <name>MyVar1</name>
            <value>Var1Value</value>
        </variable>
        <variable name="MyVar2" value="Var2Value"/>
        ...
    </environment>
</exec>

Configuration Elements:

Node Description Type Required Default
executable The path of the program to run. If this is relative, then must be relative to either (a) the base directory, (b) the CCNet Server application, or (c) if the path doesn't contain any directory details then can be available in the system or application's 'path' environment variable string true n/a
baseDirectory The directory to run the process in. If relative, is a subdirectory of the Project Working Directory string false Project Working Directory
buildArgs Any command line arguments to pass in string false no arguments
buildTimeoutSeconds Number of seconds to wait before assuming that the process has hung and should be killed. int false 600 (10 minutes)
successExitCodes A comma-separated list of exit codes that indicate success. list of ints false 0
environment Specifies any environment variables to set for the executable. complex false
(none)
description If filled in, this will be shown in the buildstage as the process name
string
false
n/a

Integration Properties

The following parameters are passed to the external program using environment variables, in addition to those you specify in the <environment> element.:

Label Description Example
CCNetBuildCondition The condition used to trigger the build, indicating if the build was triggered by new modifications or if it was forced. Legal values are: "IfModificationExists" or "ForceBuild" ForceBuild
CCNetIntegrationStatus The status of the current integration. Could be Success, Failure, Exception or Unknown Success
CCNetLabel The label used to identify the CCNet build. This label is generated by the CCNet labeller. 1.0.2.120
CCNetLastIntegrationStatus The status of the previous integration. Could be Success, Failure, Exception or Unknown Success
CCNetProject The name of the CCNet project that is being integrated. MyProject
CCNetBuildDate The date of the build (in yyyy-MM-dd format) 2005-08-10
CCNetBuildTime The time of the start of the build (in HH:mm:ss format) 08:45:12
CCNetArtifactDirectory The project artifact directory (as an absolute path) c:\program files\CruiseControl.NET\Server\MyProject\Artifacts
CCNetWorkingDirectory The project working directory (as an absolute path) c:\program files\CruiseControl.NET\Server\MyProject\WorkingDirectory
CCNetRequestSource The source of the integration request; this will generally be the name of the trigger that raised the request. (Added in CCNet 1.1) IntervalTrigger
CCNetFailureUsers The list of users who have contributed modifications to a sequence of builds that has failed. John, Smith
CCNetListenerFile Viewing build progress with Nant and MSBuild (Added in CCNet 1.4) c:\Project\Artifact\listener.xml
CCNetProjectUrl The URL where the project is located http://myhost/ccnet/server/
CCNetNumericLabel Contains the label as an integer if conversion is possible, otherwise zero. 1
CCNetModifyingUsers
The list of users who have contributed to the current build only
Smith
Windows seems to change the case of environment variables occasionally. If your task target doesn't find one of these properties, try using all upper case or all lower case versions of these properties.

Exit codes

Code Description CCNet Behavior
a code in <successExitCodes> Success The build continues
-1 Timed out The operation timed out and the build fails
other Failure The build fails

Frequently Asked Questions

Does the exec task pass the integration properties via the command line?

No. The integration properties are only available as environment variables. As there is no way of knowing the way in which the external program expects these properties to be formatted as command line arguments, environment variables are a simple, common medium for making these values accessible. To pass these environment variables into an external program, have the exec task call a batch file instead that will pick up the environment variables, format them and pass them as command line arguments to the external program.

Document generated by Confluence on Mar 14, 2009 02:55