I have some builds that use NCover for test coverage analysis, and some that use DotCover. I merge the NCover/DotCover summary report into the ccnet log, but the item that I need to pull out into the ccnet "Coverage" statistic is different depending on the tool (because the format of the reports are different).
For NCover, I use the following:
<statistics>
<statisticList>
<firstMatch name="Coverage"
xpath="//coverageReport/project/#coverage"
generateGraph="true" />
</statisticList>
</statistics>
For DotCover, I need this:
<statistics>
<statisticList>
<firstMatch name="Coverage"
xpath="//Root/#CoveragePercent"
generateGraph="true" />
</statisticList>
</statistics>
Is there any way to specify both? If I just list both sections inside the statisticList, the second one always wins (so if I list DotCover second, builds that use NCover have their coverage stat set to zero, because the DotCover stat can't be found). What I want is for the stat to get set to the NCover stat if it exists, or to the DotCover stat if it exists.
Thanks for the help!
You might be able to do an OR in the xpath expression, for example:
<statistics>
<statisticList>
<firstMatch name="Coverage"
xpath="//Root/#CoveragePercent | //coverageReport/project/#coverage"
generateGraph="true" />
</statisticList>
</statistics>
Related
I have two build projects. lets call them project A and project A.pack. When I force build project A it asks me for Boolean parameter if I want to build project A.pack.
But I can't make in publishers block of project A a correct way to force build the project A.pack. I use conditional task but it doesn't work. In log file ccnet writes only that it fails on conditional task. What a usual way to do this in ccnet?
Update:
Sorry for my English. It's not my first language.
What I wanted to do is this:
In project A I added Boolean parameter:
<booleanParameter>
<name>ExampleParam</name>
<true name="Yes">1</true>
<false name="No">0</false>
<display>Example Param</display>
<default>No</default>
<required>false</required>
</booleanParameter>
And added conditional forcebuild in publishers like this:
<publishers>
<!-- some other tasks .. -->
<conditional>
<conditions>
<compareCondition>
<value1>${ExampleParam}</value1>
<value2>1</value2>
<evaluation>equal</evaluation>
</compareCondition>
</conditions>
<tasks>
<forcebuild>
<project>A.pack</project>
<serverUri>tcp://localhost:21235/CruiseManager.rem</serverUri>
</forcebuild>
</tasks>
</conditional>
</publishers>
When I press "force" it asks me for "Example Param", I check "Yes" and when it finishes building dashboard says that build was succesful but ForceBuildPublisher task failed.
There is no information in server log about why force build task failed.
It's CruiseControl.NET-1.6.7
Update 20150808:
I convinced my colleagues to update CCnet. In version 1.8.5 it's possible to do a conditional build like I wrote.
If the boolean parameter is true then write to a file that A.pack watches. A.pack builds if the file gets dirty. See Filesystem Source Control Block for use by A.pack in listening to the file made dirty by A.
Okay.. I've been searching this specific question, and did find some examples, but not exactly the answer I wanted. Any thoughts, inputs would be greatly appreciated!
Situation I have is..
I have a daily build process via CCNet. They all have a buildCondition="ifModificationExists" parameter when building. This allows the CCNet to build if and only if there are modifications (checking the source "Update").
Problem is, I added a version Commit process at the very last part of each builds. Meaning, if I were to build 1.0.0.3, I'd Commit the changed AssemblyInfo.cs files (that contains the updated version number), and allows me to check the logs when each of the versions were built.
This completely screwed up the entire automated daily build process.. You see, because it commits the version every build whether or not it has any other Updates, the CCNet considers there's ALWAYS a modification before building each morning. Fact is, the only modification there has been was the version update from last build.
I cant think of a way to get around this, by keeping the version update + daily automate build when modifications exists.
Any help? :)
edit 1. here's the Triggers part for each of my build:
<!--TRIGGERS -->
<triggers>
<scheduleTrigger time="04:00" buildCondition="IfModificationExists" name="Scheduled">
</scheduleTrigger>
</triggers>
edit 2. and here's the part where I commit the files (AssemblyInfo.cs) using powershell
<powershell>
<script>commit.ps1</script>
<executable>C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe</executable>
<scriptsDirectory>D:\SRC\BuildTools</scriptsDirectory>
<buildArgs>D:\SRC\ProjectName\branches\3.0.3\</buildArgs>
<description>BuildCommit Dir D:\SRC\ProjectName\branches\3.0.3\src</description>
</powershell>
Thank you in advance,
I think you should be able to use filtered source control to do what you need:
http://cruisecontrolnet.org/projects/ccnet/wiki/Filtered
Does anyone have any example of how to use modification reader task?
Ok, I use this over XML:
<modificationReader>
<filename>mods.xml</filename>
<path>path/to/my/file/</path>
</modificationReader>
then, what? How do I get the information in "mods.xml" and use it?
Thanks
This appears to be used with the modificationWriter task which writes the modifications to a file (in the artifact directory by default).
http://build.sharpdevelop.net/ccnet/doc/CCNET/Modification%20Writer%20Task.html
If you're just trying to read in the modifications in to a different projects' buildLog, the above - with a path to the first project - should be sufficient.
Are you trying to do something different?
CruiseControl.NET: Build subproject obtained by SVN
Can I use tstamp property BuildDate in a nant task to an xecutable task in cruise control net as given below? if that is possible, Is my usage correct?
<tstamp property="BuildDate" pattern="dd-mmm-yy" verbose="true" />
<exec executable="C:\WINDOWS\system32\cmd.exe">
<buildArgs>/C rename "D:\Disk Images\Disk1" ICE_$(BuildDate)"</buildArgs>
<buildTimeoutSeconds>10</buildTimeoutSeconds>
</exec>
Taking a first look everything looks fine so far... except for this: Use curly braces when accessing the property. So it's Disk1" ICE_${BuildDate}" instead of Disk1" ICE_$(BuildDate)".
UPDATE: Wait a minute... You're trying to pass the property back from NAnt to CCNET? No, that won't work. You may use the BuildDate property inside NAnt only.
A cumbersome way to achieve this would be to write your values into a xml file using nant, and then use the modificationReader task.
I searched a lot but i didn't find a solution for my problem.
I use CruiseControl.NET (1.4.4). My project (in ccnet.config) load a repository from a cvs server to a local repository, and launch some executables (msbuild, NUnit...).
I use a trigger (Interval or Schedule Trigger), that launch regularly my project. But if my project has not been modified, it always launch all next tasks. And I would like to avoid it. So i want to launch my project only if a commit has been detected.
Is there any solution for it please?
Thanks
Olivier
Your trigger needs to specify IfModificationExists:
<intervalTrigger
name = "dave"
seconds = "30"
buildCondition = "IfModificationExists" />
Although buildCondition="IfModificationExists" is the default anyway, so as long as its not set to ForceBuild you should be fine.
EDIT:
The URL Trigger might be of some use to you. You can set your svn server to modify a page on commmit and the CC.Net checks the page to see if it has changed, thus not getting all the files.
I start my project as below, which ensures that the tasks get executed only if there are modifications.
Hope this helps,
Anders, Denmark
Edited: My code excerpt didn't make it to the page - I've tried to replace less-than, bigger-than with brackets.
[project name="SpilMerePool" queue="Q2" queuePriority="1"]
[sourcecontrol type="svn"]
[trunkUrl]https://ajf-ser1.ajf.local:8443/svn/SpilMerePool/trunk[/trunkUrl]
[workingDirectory]c:\from_vc\SpilMerePool[/workingDirectory]
[executable]C:\Program Files\VisualSVN Server\bin\svn.exe[/executable]
[username]username[/username]
[password]password[/password]
[/sourcecontrol]
Just use IntervalTrigger, like this:
<triggers>
<intervalTrigger />
</triggers>
You can also add an modificationDelaySeconds, to wait for a number of seconds before starting the build after the last commit.
<modificationDelaySeconds>30</modificationDelaySeconds>
Thank you Anders Juul abd Andy for your quick answers.
By using the intervalTrigger with "IfModificationExists" build condition, the project must be loaded each time (it's logical ^^). But my project size is about 450Mo. So it's a little long.
So my last question is : can we execute all builds and next tasks when a commit command has been detected? (without loading all files, in CruiseControl).
I use TortoiseCVS (version 1.10.10). Maybe we can force CruiseControl project to be lauched after a commit?