Merge Publisher - what does <file action="Copy"> actually do in CruiseControl.Net? - cruisecontrol.net

I inherited a project that runs TestComplete scripts from CruiseControl.
For each Script there is an entry in CCnet.Config and each entry ends with the following:
<publishers>
<merge>
<files>
<file action="Copy">
C:\Test\Log\TestCompleteResult\TestWebLog.mht
</file>
</files>
</merge>
<xmllogger />
<statistics />
Which I assumed copies the TestComplete log to that location. However, if I change the location (i.e. to C:\test\log2\TestWebLog.mht), the file still ends up in C:\Test\Log\TestCompleteResult. I have tried shutting down CruiseControl, rebooting the system etc. and the file still ends up in the same location.
I have deleted the directory and file, checked the time stamp and looked at the log file. All indicate that it is a new file created by the most recent run of the TestComplete script, but it always gets put in the same location: C:\Test\Log\TestCompleteResult\TestWebLog.mht.
Is there some place else this path could be defined?

From the CruiseControl.NET Wiki :
Copy: instead of merging the data into the build log, it will copy the specified files into a "build" folder under the artefacts folder for the project
In ccnet.config you can specify an artifact directory for each project into which the build results will be placed.
<project name="Project">
<artifactDirectory>C:\ProjectDir\artifacts</artifactDirectory>
...
</project>
The default merge action is to combine the specified file with the result.xml found in the artifact directory.
The "Copy" merge action copies the specified file into the artifactdirectory\Build folder.
The file you specify in the <file>...</file> tags is the source file that will be copied to the artifact folder.

The <merge> publisher includes an existing file in the build report. If you want to change the location in which the file is generated, you need to change the task configuration (i.e. in the place where TestComplete gets actually invoked).

Related

Include static files in Azure WebJob's publish-settings.json

Is it possible to specify in a WebJob's webjob-publish-settings.json file that a folder of static/flat files should be included?
Update:
As per #davidebbo's suggestion, I've tried modifying the .csproj file, but without success.
<Target Name="BeforeBuild">
<ItemGroup>
<Content Include="$(ProjectDir)\Templates\*.xslt" />
</ItemGroup>
</Target>
I've tried both BeforeBuild and AfterBuild, and with/without the $(ProjectDir) variable, but the folder never appears in the bin directory.
It is not something you can do using webjob-publish-settings.json. Instead, you can do this by setting the 'Copy to Output Directory' property of the relevant files to Copy always or Copy if newer.

Transform external config in a web role

Can slowcheetah transform an external config file in an azure web role? e.g. I have logging info in log4net.config. But the transformed version does not get created when packaged.
I did not manage to get slowCheetah working in my Azure solution.
One alternative you can use is to create complete config files for each environment - e.g. :
log4net.debug.config
log4net.release.config
and copy the contents of these into the log4net.config at buildtime depending on the build configuration chosen.
This is done by adding a build target to your csproj file like so:
<Target Name="BeforeBuild">
<Delete Files="$(ProjectDir)log4net.config" />
<Copy SourceFiles="$(ProjectDir)log4net.$(Configuration).config"
DestinationFiles="$(ProjectDir)log4net.config" />
</Target>
(you may have to modify the paths in the script depending on where in the solution your config files are)
You can find more information on MSBuild and manipulating your .csproj file here and here

Cruise Control Net Task Fail IF File Exist

We are using cruise control net for automating our build. We are keeping the installation created with automated build in a shared folder.
We want to stop the build with an error message in the build fail mail, if an installation is available in the shared folder. This is to prevent deleting installation files created in a previous build accidentally
Is that possible?
it is possible you can first test one file of your installation that must exist if installation is available (like a config file or executable file)
<conditional>
<conditions>
<fileExistsCondition>
<file>installationFile.nottodelete.config</file>
</fileExistsCondition>
</conditions>
<tasks>
<!-- Tasks to perform if condition passed -->
<!-- send mail here -->
</tasks>
<elseTasks>
<!-- Tasks to perform if condition failed -->
<!-- continue so nothing to do -->
</elseTasks>
</conditional>

cruisecontrol <buildargs> nant parameter not being passed

I've been trying to use the param in my cruisecontrol build config file to no avail. When checking the cruisecontrol log file, whatever buildargs I try to pass are NOT passed to the call to nAnt.
Here's the nant task:
<nant>
<buildArgs>-D:CCFoo="Unknown" -D:foo="$(foo)"</buildArgs>
<executable>C:\MCR\Trunk\BuildLibrary\NAnt.exe</executable>
<baseDirectory>C:\MCR\Trunk\tek.Build</baseDirectory>
<buildFile>tek.build</buildFile>
<targetList>
<target>cc</target>
</targetList>
<buildTimeoutSeconds>1800</buildTimeoutSeconds>
</nant>
Here's what appears in the logfile for that call to nant:
2010-01-28 08:45:12,815 [TekWebsite:DEBUG] Starting process [C:\MCR\Trunk\BuildLibrary\NAnt.exe] in working directory [C:\MCR\Trunk\tek.Build] with arguments [-nologo -buildfile:tek.build -logger:NAnt.Core.XmlLogger -D:CCNetArtifactDirectory="C:\Program Files (x86)\CruiseControl.NET\server\builds" -D:CCNetBuildCondition=ForceBuild -D:CCNetBuildDate=2010-01-28 -D:CCNetBuildTime=08:45:12 -D:CCNetFailureUsers= -D:CCNetIntegrationStatus=Unknown -D:CCNetLabel=50 -D:CCNetLastIntegrationStatus=Failure -D:CCNetListenerFile="C:\Program Files (x86)\CruiseControl.NET\server\builds\ClarksWebsite_ListenFile.xml" -D:CCNetModifyingUsers= -D:CCNetNumericLabel=50 -D:CCNetProject=TekWebsite -D:CCNetProjectUrl=http://cor-str-mcr08/ccnet/server/local/project/TekWebsite/ViewProjectReport.aspx -D:CCNetRequestSource=Dashboard -D:CCNetWorkingDirectory="C:\Program Files (x86)\CruiseControl.NET\server" cc]
I'm thinking that maybe there's a config setting for cruisecontrol that tells it to ignore buildargs?
I've tried reordering the lines in the nant task, putting buildargs at the top as you see, and a few places in the middle and the bottom. I've tried the different syntaxes that are available for buildargs such as:
-D:CCFoo="Unknown"
-D:CCFoo=Unknown
-DCCFoo=Unknown
I figured this out - the ccnet.config file that's used by the ccnet daemon process won't reload the build config file until either:
a) the process is restarted OR
b) the ccnet.config file is altered or touched in some way.
So I just went into C:\Program Files (x86)\CruiseControl.NET\server.ccnet.config and added a space, saved and now the buildargs are being passed to nant. woohoo!
I had the exact same problem running some bat file but my reason was I has used:
<msbuild>
...
instead of
<exec>
...

CruiseControl.NET post-build actions

We have CC.NET setup on our ASP.NET app. When we build the project, the ASP.NET app is pre-compiled and copied to a network share, from which a server runs the application.
The server is a bit different from development box'es, and the next server in our staging environment differs even more. The difference is specific config files and so on - so I want to exclude some files - or delete them before the pre-compiled app is copied to a network share.
My config file looks like this:
<project name="Assembly.Web.project">
<triggers>
<intervalTrigger seconds="3600" />
</triggers>
<sourcecontrol type="svn">
<trunkUrl>svn://svn-server/MyApp/Web/Trunk</trunkUrl>
<workingDirectory>C:\build-server\Assembly\Web\TEST-HL</workingDirectory>
<executable>C:\Program Files (x86)\SVN 1.5 bin\svn.exe</executable>
<username>uid</username>
<password>pwd</password>
</sourcecontrol>
<tasks>
<msbuild>
<executable>C:\Windows\Microsoft.NET\Framework64\v3.5\MSBuild.exe</executable>
<workingDirectory>C:\build-server\Assembly\Web\TEST-HL</workingDirectory>
<projectFile>C:\build-server\Assembly\Web\TEST-HL\Web\Web.sln</projectFile>
<buildArgs>/noconsolelogger /p:Configuration=Debug /v:diag</buildArgs>
<targets>Build</targets>
<timeout>900</timeout>
<logger>C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
</msbuild>
</tasks>
<publishers>
<buildpublisher>
<sourceDir>C:\build-server\Assembly\Web\PrecompiledWeb</sourceDir>
<publishDir>\\test-web01\Web</publishDir>
<useLabelSubDirectory>false</useLabelSubDirectory>
<alwaysPublish>false</alwaysPublish>
</buildpublisher>
</publishers>
</project>
As you can see, I use a buildPublisher to copy the pre-compiled files to the network share. What I want to do here, is either 1) delete certain files before they are copied or 2) replace those files after they have been copied.
I DO NOT want to have some app running watching specific files for change, and then after that replace the files with other ones. I want something to be either done by CC.NET, or triggered by CC.NET.
Can you launch a .bat file with CC.NET?
I use a NAnt task for all publishing, deploying, cleaning and so on.
Take a look at MSDEPLOY or Web Deployment Projects. There is a question that will provide more detail here
You have to use NAnt for those kind of stuff.
Here is the Task Reference of Nant..
Of course CruiseControl.NET can run a batch file, simply use the exec task. However, an easier answer might just be to have MSBuild do the task for you. It should be simple to add a few steps in the postcompile target.

Resources