How can I get CruiseControl.NET to attach error log in email? - cruisecontrol.net

This is a sample of my publisher setting:
<publishers>
<statistics />
<xmllogger logDir="F:\ccnet\Project\xxxxxx\Artifacts\buildlogs" />
<buildpublisher>
<sourceDir>$(buildDir)\_PublishedWebsites\$(projectName)</sourceDir>
<publishDir>$(webDir)</publishDir>
<useLabelSubDirectory>false</useLabelSubDirectory>
<alwaysPublish>false</alwaysPublish>
</buildpublisher>
<email mailport="25"
mailhostUsername="xxx#xx.xx"
mailhostPassword="xxxxxxxxx"
includeDetails="TRUE"
useSSL="FALSE">
<includeDetails>TRUE</includeDetails>
<from>xxxx#xx.xx</from>
<mailhost>xxxx.xxxx.xxx</mailhost>
<users>
<user name="Flemming" group="buildmaster" address="xx#xx.xxu" />
</users>
<groups>
<group name="buildmaster">
<notifications>
<notificationType>Always</notificationType>
</notifications>
</group>
</groups>
</email>
</publishers>
In webdashboard everything is fine. it shows all information from the standard xslt list.
After each build I get an email, but it only shows me information from header.xsl, unittest.xsl (shows no unit tests) and modification.xsl. But it doesn't show anything from compile.xsl.
xslfiles from ccnet.exe.config:
<xslFiles>
<file name="xsl\header.xsl"/>
<file name="xsl\compile.xsl"/>
<file name="xsl\msbuild.xsl"/>
<file name="xsl\modifications.xsl"/>
<!-- <file name="xsl\unittests.xsl"/>
<file name="xsl\fit.xsl"/>
<file name="xsl\fxcop-summary_1_36.xsl"/> -->
</xslFiles>
What am I missing here?
I tried to insert TRUE as well as having it as an attribute, but no difference.

I found the solution.
Instead of using compile.xsl in the xsllists I now use compile_msbuild.xsl
Now I get all errors and warnings in the mails !!!

From CCNET's EmailPublisher documentation:
Make sure that all of the Merge Publishers, along with the Xml Log Publisher task are done before the publisher, or else you won't be able to include output from the build in the email.

Related

Not able to see the FxCop Report embeded in the Email using CruiseControl.Net

I have installed Cruise Control 1.5 on my machine and trying to configure the automated build. Everything is working fine. Application is building, i receive an email but I don't see the FXCop result embedded in the Build Email. What am i missing?
ccnet.config file
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<project name="SampleProject">
<webURL>http://localhost/ccnet</webURL>
<workingDirectory>E:\\NewProject\\DevBuilds</workingDirectory>
<artifactDirectory>E:\\NewProject\\DevBuilds\Artifacts</artifactDirectory>
<modificationDelaySeconds>600</modificationDelaySeconds>
<category>Dev Build</category>
<sourcecontrol type="svn">
<trunkUrl>https://mycompany.com/svn/trunk/MyApplication</trunkUrl>
<workingDirectory>E:\\NewProject\\DevBuilds\SourceCode</workingDirectory>
<autoGetSource>false</autoGetSource>
<executable>C:\Program Files\Subversion\bin\svn.exe</executable>
<username>username</username>
<password>password</password>
</sourcecontrol>
<initialState>Started</initialState>
<startupMode>UseInitialState</startupMode>
<triggers>
<intervalTrigger seconds="3600" buildCondition="IfModificationExists" />
</triggers>
<state type="state" directory="E:\\NewProject\\DevBuilds" />
<labeller type="iterationlabeller">
<prefix>1.0</prefix>
<duration>1</duration>
<releaseStartDate>2012/04/11</releaseStartDate>
<separator>.</separator>
</labeller>
<tasks>
<nant>
<executable>E:\NewProject\Installables\nant\bin\nant.exe</executable>
<baseDirectory>E:\\NewProject\\Build Files</baseDirectory>
<buildFile>Build.xml</buildFile>
<targetList>
<target>Run</target>
</targetList>
<buildTimeoutSeconds>5000</buildTimeoutSeconds>
</nant>
</tasks>
<publishers>
<merge>
<files>
<file>E:\NewProject\DevBuilds\FxCopOutput\FxCop-results.xml</file>
</files>
</merge>
<xmllogger logDir="E:\\NewProject\\DevBuilds\Artifacts\\buildlogs" />
<email from="Checkins#symphonysv.com" mailhost="smtp.gmail.com" includeDetails="true" useSSL="false">
<users>
<user name="dev1" group="buildmaster" address="myname#gmail.com"/>
</users>
<groups>
<group name="buildmaster">
<notifications>
<notificationType>Always</notificationType>
</notifications>
</group>
</groups>
</email>
</publishers>
</project>
</cruisecontrol>
Build.xml
<?xml version="1.0"?>
<project name="Test" default="Run" basedir=".">
<property name="BuildNumber" value="1.0.0.0"/>
<property name="SourceControlURL" value="https://mycompany.com/svn/trunk/MyApplication/"/>
<property name="BuildFile" value=".\Build.xml"/>
<property name="TagBuild" value="false"/>
<property name="BuildType" value="Release"/>
<property name="BuildTargetDir" value="E:\NewProject\DevBuilds\Executables"/>
<property name="BuildWorkDir" value="E:\NewProject\DevBuilds\SourceCode"/>
<property name="MSBUILD" value="C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319"/>
<property name="FxCopOutPutDirectory" value="E:\NewProject\DevBuilds\FxCopOutput" />
<property name="FxCopInputDirectory" value="E:\NewProject\DevBuilds" />
<target name="Run" description="Starting ThinkPets Build">
<call target="GetLatestCode"/>
<call target="BuildCode"/>
<call target="BuildASPWebSite"/>
<call target="runFxCop"/>
</target>
<target name="GetLatestCode">
<echo message="Updating Code From SVN to ${BuildWorkDir}"/>
<exec program="svn.exe">
<arg line="checkout ${SourceControlURL} ${BuildWorkDir} -q"/>
</exec>
</target>
<target name="BuildCode">
<echo message="Building VS10 Projects Web" />
<exec program="${MSBUILD}\msbuild.exe" failonerror="true">
<arg line=" "${BuildWorkDir}\Application.sln" /t:Rebuild /p:Configuration=Release /V:q"/>
</exec>
</target>
<target name="BuildASPWebSite">
<echo message="Building ASP Web Site" />
<exec program="${MSBUILD}\aspnet_compiler.exe" failonerror="true">
<arg line=" -v / -p "${BuildWorkDir}\MyDir" -f -c "${BuildTargetDir}" "/>
</exec>
</target>
<target name="runFxCop" depends="BuildCode">
<exec program="C:\Program Files\Microsoft FxCop 1.36\FxCopCmd.exe" failonerror="false">
<arg line="/p:${FxCopInputDirectory}\SampleProject.FxCop /o:${FxCopOutPutDirectory}\FxCop-results.xml"/>
</exec>
</target>
</project>
There are a few points you missed:
You need to add <includeDetails>true</includeDetails> to your e-mail publisher block. This will give you HTML e-mails.
In order to transform your XML build results into HTML you need to add an <xslFiles> section to your e-mail publisher block. The elements of this block point to XSL transformation files in [CCNET_INSTALL_DIR]\server\xsl.
So for including the FxCop summary just as appears in CCNET webdasboard this is your e-mail publisher block:
<email from="Checkins#symphonysv.com" mailhost="smtp.gmail.com" includeDetails="true" useSSL="false">
<users>
<user name="dev1" group="buildmaster" address="myname#gmail.com"/>
</users>
<groups>
<group name="buildmaster">
<notifications>
<notificationType>Always</notificationType>
</notifications>
</group>
</groups>
<includeDetails>true</includeDetails>
<xslFiles>
<file>xsl\fxcop-summary_1_36.xsl</file>
</xslFiles>
</email>
Thanks Chairman for your valuable time. I think my mistake was that I did not host the "ccnet" application on my machine which resulted in not able to find the xsls for the publishers. When I used the same settings and config file on the Server machine with "ccnet" application hosted, I was able to see the FxCop summary in the email. Please correct my understanding if wrong.

Unused node detected when configuring schedule block with ant for CruiseControl.NET

I'm developing a ccnet.config script for CruiseControl.net that invokes an Ant script, and I'm getting the following error while executing the CruiseControl.NET service:
Error: "Unused node detected:schedule block"
This is my ccnet.config:
<cruisecontrol xmlns:cb="urn:ccnet.config.builder" xmlns="http://thoughtworks.org/ccnet/1/5">
<project name="testprj">
<webURL>http://localhost/ccnet</webURL>
<modificationDelaySeconds>10</modificationDelaySeconds>
<sourcecontrol type="cvs" autoGetSource="true">
<executable>C:\dev\ccnet\ccnet\tools\cvs.exe</executable>
<cvsroot>:ext:exortech#ccnet:/cvsroot/ccnetcontrib</cvsroot>
<module>ccnet</module>
<workingDirectory>C:\dev\Copy of FAT\</workingDirectory>
<webUrlBuilder type="viewcvs">
<url>http://localhost:7899/viewcvs/ccnet/NUnitDemo/</url>
</webUrlBuilder>
</sourcecontrol>
<schedule>
<ant>
<antscript>C:\Apache\apache-ant-1.8.1\bin\ant.bat</antscript>
<antworkingdir>C:\Apache</antworkingdir>
<buildfile>internalpush.xml</buildfile>
<uselogger>true</uselogger>
<usedebug>false</usedebug>
</ant>
</schedule>
<publishers>
<merge>
<files>
<file>C:\dev\ccnet\ccnet\build\ccnet.exe-results.xml</file>
</files>
</merge>
<xmllogger>
<logDir>log</logDir>
</xmllogger>
<email mailhost="foo" from="sreekanth#foo.com" includeDetails="true">
<users>
<user name="BuildGuru" group="buildmaster" address="buildguru#mycompany.com"/>
<user name="JoeDeveloper" group="developers" address="joedeveloper#thoughtworks.com"/>
</users>
<groups>
<group name="developers">
<notifications>
<NotificationType>Change</NotificationType>
</notifications>
</group>
<group name="buildmaster">
<notifications>
<NotificationType>Change</NotificationType>
</notifications>
</group>
</groups>
</email>
</publishers>
</project>
</cruisecontrol>
There is no "schedule" element available under the "project" element: http://confluence.public.thoughtworks.org/display/CCNET/Project+Configuration+Block

CruiseControl secure a build project node

Is there a way to secure a build project node in cruisecontrol? I would like to restrict the use of force build to specific users.
This can be done by adding a <security> tag in the project config.
<project name="TestProject">
<security type="defaultProjectSecurity" defaultRight="Deny">
<permissions>
<rolePermission name="TestProjectAdmin" ref="FractionFactionAdmin" />
</permissions>
</security>
</project>
<internalSecurity>
<cache type="inMemoryCache" duration="30" mode="sliding"/>
<users>
<passwordUser name="user1" password="change"/>
<passwordUser name="user2" password="change"/>
</users>
<permissions>
<rolePermission name="TestProjectAdmin" defaultRight="Allow" forceBuild="Allow" viewProject="Allow" startProject="Allow">
<users>
<userName name="user1"/>
<userName name="user2"/>
</users>
</rolePermission>
</permissions>
</internalSecurity>
try like this

issues in cc.net (cruisecontrol.net) with uppercut

I have installed uppercut integrated cc.net such a way that i didnt make any change in webdashboard,
This is my cc.net config code,
-->
-->
<!-- PROJECT STRUCTURE -->
<cb:define name="WindowsFormsApplication1">
<project name="$(projectName)">
<workingDirectory>$(working_directory)\$(projectName)</workingDirectory>
<artifactDirectory>$(drop_directory)\$(projectName)</artifactDirectory>
<category>$(projectName)</category>
<queuePriority>$(queuePriority)</queuePriority>
<triggers>
<intervalTrigger name="continuous" seconds="60" buildCondition="IfModificationExists" />
</triggers>
<sourcecontrol type="svn">
<executable>c:\program files\subversion\bin\svn.exe</executable>
<!--<trunkUrl>http://192.168.1.8/trainingrepos/deepasundari/WindowsFormsApplication1</trunkUrl>-->
<trunkUrl>$(svnPath)</trunkUrl>
<workingDirectory>$(working_directory)\$(projectName)</workingDirectory>
</sourcecontrol>
<tasks>
<msbuild>
<executable>C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable>
<workingDirectory>$(working_directory)\$(projectName)</workingDirectory>
<projectFile>WindowsFormsApplication1.sln</projectFile>
<timeout>600</timeout>
<buildArgs> /noconsolelogger /p:configuration=Debug </buildArgs>
<!--<buildArgs>/noconsolelogger /p:OutputPath=$(drop_directory)\$(projectName)\sample </buildArgs>-->
<logger>ThoughtWorks.CruiseControl.MsBuild.XmlLogger,C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
</msbuild>
<!--<labeller type="svnRevisionLabeller">
<prefix>Test-</prefix>
<major>7</major>
<minor>11</minor>
<url>$svnpath</url>
<username>deepasundari</username>
<password>deepasundari</password>
</labeller>-->
<exec>
<executable>$(working_directory)\$(projectName)\build.bat</executable>
</exec>
</tasks>
<publishers>
<!--<buildpublisher>
--><!--<sourceDir>C:\myprojects\project1</sourceDir>--><!--
<publishDir>$(working_directory)\$(projectName)</publishDir>
</buildpublisher>-->
<merge>
<files>
<file>$(working_directory)\$(projectName)\build_output\build_artifacts\*.xml</file>
<file>$(working_directory)\$(projectName)\build_output\build_artifacts\mbunit\*-results.xml</file>
<file>$(working_directory)\$(projectName)\build_output\build_artifacts\nunit\*-results.xml</file>
<file>$(working_directory)\$(projectName)\build_output\build_artifacts\ncover\*-results.xml</file>
<file>$(working_directory)\$(projectName)\build_output\build_artifacts\ndepend\*.xml</file>
</files>
</merge>
<!--<email from="buildserver#somewhere.com" mailhost="smtp.somewhere.com" includeDetails="TRUE">
<users>
<user name="YOUR NAME" group="BuildNotice" address="yourEmail#somewhere.com" />
</users>
<groups>
<group name="BuildNotice" notification="change" />
</groups>
</email>-->
<xmllogger/>
<statistics>
<statisticList>
<firstMatch name="Svn Revision" xpath="//modifications/modification/changeNumber" />
<firstMatch name="ILInstructions" xpath="//ApplicationMetrics/#NILInstruction" />
<firstMatch name="LinesOfCode" xpath="//ApplicationMetrics/#NbLinesOfCode" />
<firstMatch name="LinesOfComment" xpath="//ApplicationMetrics/#NbLinesOfComment" />
</statisticList>
</statistics>
<modificationHistory onlyLogWhenChangesFound="true" />
<rss/>
</publishers>
</project>
</cb:define>
<cb:WindowsFormsApplication1 projectname="WindowsFormsApplication1" queuepriority="1" svnpath="http://192.168.1.8/trainingrepos/deepasundari/WindowsFormsApplication1" />
this code is updating rss and report xml files, but i could not get the build folder in the code_drop..
could anyone help me with this problem??
It looks like you have followed the sample almost perfectly. http://uppercut.googlecode.com/svn/trunk/docs/Samples/CC.NET/server/ccnet.config
What you should see in the code_drop folder on the build server is a folder b##-r## for build and revision per each build.
Most of this is talked about in here: http://uppercut.googlecode.com/svn/trunk/docs/IntegrateUppercuTWithCruiseControl.NET.doc

Configuring security settings in CC.NET 1.5

Below is the ccnet.config file I am having, where I am using the new security features of CC.NET 1.5. Can anybody let me know what I am doing wrong.
I have two groups in a DOMAIN and I want to let one group to only view and the other group Full Access.
<cruisecontrol>
<project>
<name>Introvert</name>
<!-- Security Settings -->
<security type="defaultProjectSecurity" defaultRight="Deny">
<permissions>
<!-- Grant permissions to this project -->
<rolePermission name="ViewOnly" ref="ViewOnly"/>
<rolePermission name="FullAccess" ref="FullAccess"/>
</permissions>
</security>
</project>
<!-- Security Settings -->
<internalSecurity>
<users>
<simpleUser name="DOMAIN\GROUP1\*" />
<simpleUser name="DOMAIN\GROUP2\*" />
</users>
<permissions>
!-- Roles -->
<rolePermission name="FullAccess" forceBuild="Allow" startProject="Allow" >
<users>
<userName name="DOMAIN\GROUP1\"/>
</users>
</rolePermission>
<rolePermission name="ViewOnly" forceBuild="Deny" startProject="Deny">
<users>
<userName name="DOMAIN\GROUP2\"/>
</users>
</rolePermission>
</permissions>
</internalSecurity>
</cruisecontrol>
<!-- Security Settings -->
<internalSecurity>
<users>
<simpleUser name="DOMAIN\GROUP1\*" />
<simpleUser name="DOMAIN\GROUP2\*" />
</users>
<permissions>
**!-- Roles -->** <-- mising a "<", bad formatted XML
<rolePermission name="FullAccess" forceBuild="Allow" startProject="Allow" >
<users>
<userName name="DOMAIN\GROUP1\"/> <-- shouldn't it be DOMAIN\GROUP1\*?
</users>
</rolePermission>
<rolePermission name="ViewOnly" forceBuild="Deny" startProject="Deny">
<users>
<userName name="DOMAIN\GROUP2\"/>
</users>
</rolePermission>
</permissions>
</internalSecurity>

Resources