May 7, 2007

CruiseControl.NET Example

Surround SCM
Here is an example configuration file for CruiseControl.Net

Example ccnet.config

<cruisecontrol>
  <project name="SurroundSCM_WithNUnit" webURL="http://localhost/ccnet">
    <sourcecontrol type="surround">
   <executable>E:Program FilesSeapineSurround SCMsscm.exe</executable>
   <serverconnect>198.187.16.177:4900</serverconnect>
   <serverlogin>buildbot:builder</serverlogin>
   <branch>Programs</branch>
   <repository>Programs/SSCM/SSCMClone</repository>
   <workingDirectory>E:TempCCBuildDirSSCMClone</workingDirectory>
   <recursive>1</recursive>
   <file>*</file>
   <searchregexp>0</searchregexp>
</sourcecontrol>
    <tasks>
    	<msbuild>
  		<executable>C:WINDOWSMicrosoft.NETFrameworkv2.0.50727MSBuild.exe</executable>
  		<workingDirectory>E:TempCCBuildDirSSCMClone</workingDirectory>
  		<projectFile>SSCMClone.sln</projectFile>
  		<buildArgs>/p:Configuration=Debug</buildArgs>
  		<targets>Rebuild</targets>
  		<timeout>15</timeout>
  		<logger>E:JDevCruiseControl.NETserverRodemeyer.MsBuildToCCNet.dll</logger>
	</msbuild>
    	<nunit path="C:Program FilesNUnit 2.4binnunit-console.exe">
    		<assemblies>
    			<assembly>C:Program FilesNUnit 2.4binmock-assembly.dll</assembly>
    		</assemblies>
    	</nunit>
	<exec>
	    <executable>C:snap.bat</executable>
	    <buildTimeoutSeconds>10</buildTimeoutSeconds>
	</exec>
    </tasks>
    <publishers>
      <xmllogger logDir="log" />
    </publishers>
  </project>

</cruisecontrol>

Branching and Labeling

Because of the way that Integration Properties work, it is best to use a batch file to create a branch or label after build and unit tests have been completed. This is because those variables cannot be used in the config file directly but will be expanded when you execute from batch. A batch file might look like this: sscm mb "SSCMClone - %CCNetBuildDate%" "Programs/SSCM/SSCMClone" -bPrograms -cc"CC.NET Build" -ssnapshot -ybuildbot:builder -z198.187.16.177:4900 Creating a label would be done in similar fashion only using the label command instead of the make branch command.

User Security

The buildbot user in this example has read-only access at the file level. The user has create branch rights but can only login from the CLI. This is necessary because the username and password will be displayed in plain text in the build reports and any batch files used to create snapshots or labels. This allows the user to get the latest source code and create the snapshot branch, while preventing users who know the login credentials from performing other activities like a check in, rename, or remove. The Surround SCM security group set up can be configured to meet any need, so the user can perform additional operations if the group settings allow it. Note: Seapine does not provide support for sample triggers and scripts.