How to commit into TortoiseSVN using cruise control config file - tortoisesvn

hi all,
can any one tell how to commit into
tortoisesvn using cruise control
config file. I am getting an error
"C:*****\Documentation\trunk\dotnet\svn"
is not executable or it may not exist.
here's the config part...
<workingDirectory>C:\*****\Documentation\trunk\dotnet\</workingDirectory>
<category>Individual Solutions</category>
<modificationDelaySeconds>10</modificationDelaySeconds>
<sourcecontrol type="svn">
<trunkUrl>******* svn url *********</trunkUrl>
<username> unname </username>
<password> pwd </password>
<autoGetSource>true</autoGetSource>
</sourcecontrol>
<tasks>
<exec>
<executable>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe</executable>
<buildTimeoutSeconds>1200</buildTimeoutSeconds>
<successExitCodes>0</successExitCodes>
</exec>
<exec>
<executable>iisreset</executable>
<buildArgs>/stop</buildArgs>
</exec>
<exec>
<executable>c:\Program Files\TortoiseSVN\bin\TortoiseProc.exe /command:commit /path:"C:\*****\Documentation\trunk\dotnet\"</executable>
<buildTimeoutSeconds>1200</buildTimeoutSeconds>
<successExitCodes>0</successExitCodes>
<description>checkin shared content...</description>
</exec>
<exec>
<executable>iisreset</executable>
<buildArgs>/start</buildArgs>
</exec>
</tasks>
</project>
Thank you all,

There's a few things:
You want to pass the command-line arguments to in the <buildArgs> element, not as part of the <executable> element (like you've done for the "issreset" command, for example).
Why are you checking stuff in after every build? The way you seem to have things set up here, it's just going to go into an infinite loop, building then checking in and building again (because it detected a new check-in). Generally, you don't check build outputs into your repository.

Related

Multi Projects with CCNET

I have GIT repo as below,
\main
\Module A
\Module B
\Shared
When i make a change on Module B, CCNET will make a build from Module A and then Module B,
I dont want CCNET to do this way.It will take a lot of time.
I just want ccnet build only changes on Module B.
Somebody please help me :
My 1 project in CCNET Config:
enter code here
<project name="Dashboard 5.0" queue="Dashboard_01" queuePriority="01" category="01">
<artifactDirectory>&pathToArtifactsDirectory;Dashboard 5.0\</artifactDirectory>
&workingDirectory;
<webURL>http://&buildServerAddress;/ccnet/server/&buildServerName;/project/Dashboard 5.0/ViewLatestBuildReport.aspx</webURL>
&modificationDelaySeconds;
<triggers>
<intervalTrigger seconds='30' buildCondition='IfModificationExists'/>
<scheduleTrigger time='03:00' buildCondition='ForceBuild' name='Scheduled'/>
<scheduleTrigger time='11:00' buildCondition='ForceBuild' name='Scheduled'/>
</triggers>
<state type="state" directory="&pathToStatesDirectory;Dashboard 5.0\" />
<sourcecontrol type="git">
<repository>&gitAddress;</repository>
<branch>master</branch>
<autoGetSource>true</autoGetSource>
<fetchSubmodules>false</fetchSubmodules>
<executable>C:\Program Files (x86)\Git\cmd\git.exe</executable>
<commitBuildModifications>false</commitBuildModifications>
<commitUntrackedFiles>false</commitUntrackedFiles>
<timeout>3000000</timeout>
</sourcecontrol>
<tasks>
<nant>
<executable>&pathToNantFile;</executable>
<baseDirectory>&pathToBuildScriptsDirectory;Dashboard 5.0\</baseDirectory>
<buildArgs>-D:projects_to_build=dashboard_framework</buildArgs>
<buildFile>cruise.build</buildFile>
<targetList>
<target>automate</target>
</targetList>
<buildTimeoutSeconds>3000</buildTimeoutSeconds>
</nant>
</tasks>
<publishers>
<merge>
<files>
<file>&pathDB5MainCheckoutDirectory;framework\build\test-reports\*Test.dll-results.xml</file>
<file>&pathDB5MainCheckoutDirectory;framework\build\test-reports\Test*.dll-results.xml</file>
<file>&pathDB5MainCheckoutDirectory;framework\build\test-reports\simian.xml</file>
</files>
</merge>
<xmllogger />
</publishers>
Any check in for Module A or Module B will cause the project node to start either way. What you are looking for is similar to what subversion update command on a sub folder does and Git is not intended to be this way. An alternative you can create a separate repository for each module. The build script or Nant task would have to be separated as well.
In Git, if you have several directories that are always checked out independently, then these are really two different projects and should live in two different repositories. You can merge them back together at a later point using Git Submodules

Get the CCNetBuildDate in NAnt parallel tasks

In a cruise control configuration file, I use a set of parallel tasks to call some NAnt targets. I noticed that the CC system parameters (like CCNetBuildDate) are not pushed to the NAnt scripts, while they are pushed when I remove the parallel flag. How can I push the CCNetBuildDate information to my parallel tasks?
When I tested this (1.5) I got 0001-01-01 for CCNetBuildDate.
Until this bug is fixed you could save the correct settings before executing the parallel tasks. As you can not override properties passed on the command line you would have to change their names or use <exec> to call nant directly:
<nant>
<buildFile>SaveCCNetParameters.build</buildFile>
</nant>
<parallel>
<tasks>
<exec>
<executable>$(NAntExePath)</executable>
<buildArgs>-buildfile:Build1.build #CCNetBuildParameters</buildArgs>
</exec>
<exec>
<executable>$(NAntExePath)</executable>
<buildArgs>-buildfile:Build2.build #CCNetBuildParameters</buildArgs>
</exec>
</tasks>
</parallel>
where CCNetBuildParameters is a file looking similar to:
-DCCNetBuildDate=2012-11-10
-DCCNetBuildTime=12:12:12
-DCCNetLabel=123
[...]

Cruise Control parsing "!" character in NAnt file

I have Cruise Control configured with a task to run a NAnt script, which runs an MSTest suite. MSTest allows me to specify test categories so I want to specify "!Integration" (which means "don't run Integration tests"). My Nant script successfully runs when I run it from the command line, but when Cruise runs it, the "!Integration" directive is being garbled -- the Cruise output suggests its inserting a line break after the '!' character. The result is that all my tests run, including integration tests.
Extract from ccnet.config:
<tasks>
<nant>
<executable>C:\nant\bin\nant.exe</executable>
<baseDirectory>C:\MyProject\BuildDirectory</baseDirectory>
<buildFile>MyProject.build</buildFile>
<targetList>
<target>CIServerBuild</target>
</targetList>
</nant>
</tasks>
Extract from MyProject.build:
<target name="CIServerBuild">
:
<call target="RunUnitTests" />
</target>
<target name="RunUnitTests">
<property name="TestCategories" value="!Integration" />
<call target="RunMSTest" failonerror="true"/>
</target>
<target name="RunMSTest">
<call target="BuildListOfTestContainers" failonerror="true"/>
<exec program="${MSTest.exe}"
commandline=" /category:"${TestCategories}" ${TestContainers} /resultsfile:${MSTest.ResultsFile} /nologo "
/>
</target>
Extract from Cruise output:
[exec] Starting 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe ( /category:"!
Integration" /testcontainer:C:\TaxWise\BuildDirectory\TaxWise\TaxWise.Data.Tests\bin\Debug\TaxWise.Data.Tests.dll /testcontainer:C:\TaxWise\BuildDirectory\TaxWise\TaxWise.Domain.Tests\bin\Debug\TaxWise.Domain.Tests.dll /testcontainer:C:\TaxWise\BuildDirectory\TaxWise\TaxWise.Infrastructure.Tests\bin\Debug\TaxWise.Infrastructure.Tests.dll /resultsfile:.\TestResults\UnitTests.trx /nologo )'
in 'C:\TaxWise\BuildDirectory'
I have tried replacing the '!' character with
'!'
but that made no difference.
Any ideas, anyone?
I suggest splitting the commandline attribute in the exec task into Nant arg elements.
http://nant.sourceforge.net/release/0.85/help/tasks/exec.html
You'll have more flexibility and the readability will increase.
Yes, perhaps it is not caused by CC. Try setting verbose="True" on the <exec> task and check the raw build protocol. Remember what you see on the report page is not the exact output (typically subject to line-wrap and coalescing whitespaces).
Maybe it depends on from where you run the script, a hidden dependency on a build property or different environment variables. You can check the latter using <exec program="cmd.exe" commandline="/c set" />. For the properties you can use the following script:
<script language="C#" prefix="util" verbose="true">
<code>
<![CDATA[
public static void ScriptMain(Project project)
{
foreach (DictionaryEntry entry in new System.Collections.SortedList(project.Properties) )
Console.WriteLine("{0}={1}", entry.Key, entry.Value);
}
]]>
</code>
</script>

Cruisecontrol Publish command onfailure

I've got a problem publishing my current Project status.
Mapping:
<publishers>
<xmllogger /><!-- Log For WebDashboard ##Do not remove##-->
<email>
...
</email>
<onfailure>
<exec>
<executable>echo ERROR > logs/status.txt</executable>
</exec>
</onfailure>
</publishers>
When i want to start my Service i get the following message:
ThoughtWorks.CruiseControl.Core.Config.ConfigurationException:
Unable to instantiate CruiseControl projects from configuration document.
Configuration document is likely missing Xml nodes required for properly populating CruiseControl configuration.
Unable to load array item 'onfailure' - Cannot convert from type System.String to ThoughtWorks.CruiseControl.Core.ITask for object with value: "echo ERROR > logs/status.txt"
Does anyone know what that message means?
Thanks in anticipation
Alex
Are you using CruiseControl or CruiseControl.NET?
If CC.NET, then the "onfailure" node does not exist. Instead you should use the Conditionnal Publisher[1] like this :
<conditionalPublisher>
<conditions>
<condition>Failure</condition>
</conditions>
<publishers>
<exec>
<executable>echo ERROR > logs/status.txt</executable>
</exec>
</publishers>
</conditionalPublisher>
You may also need to encapsulate your echo task in a cmd invokation :
<exec>
<executable>cmd.exe</executable>
<buildArgs>/c "echo ERROR > logs\status.txt"</buildArgs>
</exec>
[1] http://ccnetlive.thoughtworks.com/ccnet/doc/CCNET/Conditional%20Publisher.html
From the documentation, it looks like <executable> has to be the name of the executable and the arguments must be passed in <buildArgs>. So something like this may do the trick.
<exec>
<executable>echo</executable>
<buildArgs>ERROR > logs/status.txt</buildArgs>
</exec>

How to run a task before updating source files?

I need to run a task in CruiseControl .NET before checking for modification in source control. I mean this task should be the very first thing that CruiseControl will always do. I see
<prebuild> section in cc.config, but it is for running tasks before building a solution, so it is not exactly what I need.
Prebuild DOES fire before the source control get. It comes after the source control block but still fires first. Here's an example I've been using:
<cb:define subversionpath="c:\Program Files\Subversion\bin\svn.exe"
/>
<cb:define name="svn50">
<executable>$(subversionpath)</executable>
<workingDirectory>D:\Projects\B50\Source</workingDirectory>
<trunkUrl>svn://machineName/branches/B_50/Source</trunkUrl>
<autoGetSource>true</autoGetSource>
</cb:define>
<project name="StreamlineCheckBuild" queue="B50">
<triggers>
<intervalTrigger seconds="180" />
</triggers>
<sourcecontrol type="svn">
<cb:svn50/>
<deleteObstructions>true</deleteObstructions>
<forceUpdate>true</forceUpdate>
</sourcecontrol>
<prebuild>
<exec>
<executable>$(subversionpath)</executable>
<buildArgs>cleanup</buildArgs>
<baseDirectory>D:\Projects\B50</baseDirectory>
</exec>
</prebuild>
<tasks>
...
</tasks>
</cruisecontrol>
Use batch file as proxy for the version control utility, eg. svn.bat:
echo do stuff
"c:\program files\Subversion\svn.exe" %*
Use executable atrribute to point to the bach file.

Resources