Dashboard > CruiseControl.NET > ... > Task Blocks > Executable Task
Executable Task Log In | Sign Up   View a printable version of the current page.  
CruiseControl.NET documentation for latest CI builds
Added by Mike Roberts , last edited by Ross Patterson on Feb 22, 2008  (view change) show comment

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>
</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

Integration Properties

The following parameters are passed to the external program using environment variables:

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
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.

Powered by a free Atlassian Confluence Open Source Project / Non-profit License granted to ThoughtWorks, Inc.. Evaluate Confluence today.
Powered by Atlassian Confluence 2.7.1, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators