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.
Available from version 1.0
1<exec executable="c:\projects\myproject\build.bat" />
1<exec> 2 <executable>make</executable> 3 <baseDirectory>D:\dev\MyProject</baseDirectory> 4 <buildArgs>all</buildArgs> 5 <buildTimeoutSeconds>10</buildTimeoutSeconds> 6 <successExitCodes>0,1,3,5</successExitCodes> 7 <environment> 8 <variable> 9 <name>MyVar1</name> 10 <value>Var1Value</value> 11 </variable> 12 <variable name="MyVar2" value="Var2Value" /> 13 </environment> 14</exec>
|buildArgs||Any command line arguments to pass in.||String||No||None||1.0|
|buildTimeoutSeconds||Number of seconds to wait before assuming that the process has hung and should be killed. If the build process takes longer than this period, it will be killed. Specify this value as zero to disable process timeouts.||Int32||No||600||1.0|
|baseDirectory||The directory to run the process in. If relative, is a subdirectory of the Project Working Directory.||String||No||Project working directory||1.0|
|description||Description used for the visualisation of the buildstage, if left empty the process name will be shown.||String||No||The task/publisher name.||1.5|
|dynamicValues||The dynamic values to use for the task.||Dynamic Values array||No||None||1.5|
|environment|| A set of environment variables set for commands that are executed.
Each variable should be specified as
|Environment Variable array||No|
|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||Yes||n/a||1.0|
|priority||The priority class of the spawned process.|| String - one of:
* Normal * Idle * High * RealTime * BelowNormal * AboveNormal
|successExitCodes||The list of exit codes that indicate success, separated by commas.||String||No||None||1.0|
An exit code of -1 is always treated as the operation has timed out. This will fail the build.
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.
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.
Using built in shell commands
In Windows use cmd.exe as the executable, and pass the wanted command as an argument, preceded with /c. This allows to execute del \*.\* and the like. For example :
1<exec> 2 <executable>c:\Windows\System32\cmd.exe</executable> 3 <buildArgs>/C NET STOP "Service name"</buildArgs> 4</exec>
The following parameters are passed to the external program using environment variables, in addition to those you specify in the <environment> element.:
|CCNetArtifactDirectory||The project artifact directory (as an absolute path)||C:\Program Files\CruiseControl.NET\Server\MyProject\Artifacts||1.0|
|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||1.0|
|CCNetBuildDate||The date of the build (in yyyy-MM-dd format)||2005-08-10||1.0|
|CCNetBuildTime||The time of the start of the build (in HH:mm:ss format)||08:45:12||1.0|
|CCNetFailureTasks||The list of name of tasks which have contributed to the current build failure. When the description of the task is filled in, this will be shown.||Exec Task||1.7|
|CCNetFailureUsers||The list of users who have contributed modifications to a sequence of builds that has failed.||John, Smith||1.0|
|CCNetIntegrationStatus||The status of the current integration. Could be Success, Failure, Exception or Unknown||Success||1.0|
|CCNetLabel||The label used to identify the CCNet build. This label is generated by the CCNet labeller.||126.96.36.199||1.0|
|CCNetLastIntegrationStatus||The status of the previous integration. Could be Success, Failure, Exception or Unknown||Success||1.0|
|CCNetListenerFile||View build progress : task output that shows how far the build is||c:\Project\Artifact\listener.xml||1.4.0|
|CCNetModifyingUsers||The list of users who have contributed to the current build only||Smith||1.0|
|CCNetNumericLabel||Contains the label as an integer if conversion is possible, otherwise zero.||1||1.0|
|CCNetProject||The name of the CCNet project that is being integrated.||MyProject||1.0|
|CCNetProjectUrl||The URL where the project is located||http://myhost/ccnet/server/||1.0|
|CCNetRequestSource||The source of the integration request; this will generally be the name of the trigger that raised the request.||IntervalTrigger||1.1.0|
|CCNetUser||The user who forced the build. If security is off, or the build is not forced, then this will not be set.||John Doe||1.5.0|
|CCNetWorkingDirectory||The project working directory (as an absolute path)||C:\Program Files\CruiseControl.NET\Server\MyProject\WorkingDirectory||1.0|
Documentation generated on Monday, 26 May 2014 at 7:18:04 AM