Dashboard > CruiseControl.NET > ... > Source Control Blocks > External Source Control
External Source Control Log In View a printable version of the current page.  
CruiseControl.NET documentation for latest CI builds
Added by Ross Patterson , last edited by Ross Patterson on Apr 28, 2008  (view change) show comment

External Source Control Configuration

Note: The External source control block is available in CCNet build 1.3.0.3053 and later.

Typical / Minimal Configuration

For most uses the following is all you'll need in your ccnet.config:

<sourcecontrol type="external">
    <executable>path to command-line application</executable>
</sourcecontrol>

This will:

  • monitor for any changes in the workspace located at the project working directory, by passing GETMODS to the external executable
  • retrieve the lastest source when any changes are detected, by passing GETSOURCE to the external executable
  • apply a label to (i.e., make a snapshot of) the built files at the end of each successful build, by passing SETLABEL to the external executable

Full Configuration

<sourcecontrol type="external">
    <executable>path to command-line application</executable>
    <args>arguments for the command-line application</args>
    <autoGetSource>false</autoGetSource>
    <labelOnSuccess>false</labelOnSuccess>
    <environment>
        <var>name=value</var>
        <var>name=value</var>
        ...
    </environment>
    <timeout units="minutes">10</timeout>
</sourcecontrol>
Element Description Type Required Default
args Specifies the command line arguments to be passed to the source control command. string no ""
autoGetSource Specifies whether the current version of the source should be retrieved from the source control system. bool no false
environment Specifies any environment variables to set for the source control command complex no (none)
executable Specifies the path to the source control command. string yes  
labelOnSuccess Specifies whether or not CruiseControl.Net should ask the source control system to label the source when the build is successful. bool no false
timeout Sets the timeout period for the source control operation. See Timeout Configuration for details. Timeout no 10 minutes

Operation

Each of the three sourcecontrol operations (GetModifications(), GetSource(), and LabelSourceControl()) are passed to the source control command as a command line.

GetModifications

The GetModifications function is invoked as the GETMODS operation, and specifying a starting and ending timestamp:

  • executable GETMODS "fromtimestamp" "totimestamp" args

The source control command should search for modifications between these two times inclusively, write their details to the standard output stream in the XML format used by the Modification Writer Task, and exit with exit status 0 (any other status indicates an error and will fail the build). For example, the following represents two modifications, numbered 12244 and 12245.

<?xml version="1.0" encoding="utf-8"?>
<ArrayOfModification>
    <Modification>
        <ChangeNumber>12245</ChangeNumber>
        <Comment>New Project for testing stuff</Comment>
        <EmailAddress>JUser@Example.Com</EmailAddress>
        <FileName>AssemblyInfo.cs</FileName>
        <FolderName>Dev\Server\Interface\Properties\</FolderName>
        <ModifiedTime>2006-11-22T11:11:00-0500</ModifiedTime>
        <Type>add</Type>
        <UserName>joe_user</UserName>
        <Url>http://www.example.com/index.html</Url>
        <Version>5</Version>
    </Modification>
    <Modification>
        <ChangeNumber>12244</ChangeNumber>
        <Comment>New Project for accessing web services</Comment>
        <EmailAddress>SSpade@Example.Com</EmailAddress>
        <FileName>Interface</FileName>
        <FolderName>Dev\Server\</FolderName>
        <ModifiedTime>2006-11-22T11:10:44-0500</ModifiedTime>
        <Type>add</Type>
        <UserName>sam_spade</UserName>
        <Url>http://www.example.com/index.html</Url>
        <Version>4</Version>
    </Modification>
</ArrayOfModification>
GetSource

The GetSource function is invoked as the GETSOURCE operation, and specifying a working directory path and the target timestamp:

  • executable GETSOURCE "workingdirectory" "timestamp" args

The source control command should update the files in the specified working directory to the versions current as of the specified time stamp and exit with exit status 0 (any other status indicates an error and will fail the build).

LabelSourceControl

The LabelSourceControl function is invoked as the SETLABEL operation, and specifying a label to be applied and the target timestamp:

  • executable SETLABEL "label" "sourcetimestamp" args

The source control command should add the label to source repository and exit with exit status 0 (any other status indicates an error and will fail the build).

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