Why isn't my CruiseControl.net project trigger working? - cruisecontrol.net

I have a project in CruiseControl.net that I am trying to create a schedule for it to run at a certain time most days.
The problem is that it doesn't work. The scheduled time does not update in the CCnet dashboard it seems until i remove the project trigger. Then it works..but it's not building a project so therefore useless.
In my CCnet.config:
<project>
<name>MyProject-nightly</name>
<triggers>
<multiTrigger operator="And">
<triggers>
<projectTrigger project="MyProject" />
<scheduleTrigger time="11:23" buildCondition="ForceBuild">
<weekDays>
<weekDay>Monday</weekDay>
<weekDay>Tuesday</weekDay>
<weekDay>Wednesday</weekDay>
<weekDay>Thursday</weekDay>
<weekDay>Friday</weekDay>
<weekDay>Saturday</weekDay>
</weekDays>
</scheduleTrigger>
</triggers>
</multiTrigger>
</triggers>
</project>
When I remove this line:
<projectTrigger project="MyProject" />
the next build time in the Dashboard updates correctly, and it does execute at that time that is specified but nothing happens obviously.
What is wrong with this? I am using CruiseControl.net version: 1.5.7256.1

You don't have to create a different project.I think you misunderstand the ProjectTrigger too, ProjectTrigger is to start the build if another project has finished building (in your case it would start building MyProject-nightly when MyProject finished building, which I don't think is what you want).
What exactly is the behaviour you want?
If you want your project to build from source control modification and nighly you have to configure like this :
<triggers>
<intervalTrigger name="Polling From source control" seconds="60" BuildCondition="IfModificationExists"/>
<scheduleTrigger time="23:30" buildCondition="ForceBuild" name="Nighly Build">
<weekDay>Monday</weekDay>
<weekDay>Tuesday</weekDay>
<weekDay>Wednesday</weekDay>
<weekDay>Thursday</weekDay>
<weekDay>Friday</weekDay>
<weekDay>Saturday</weekDay>
</scheduleTrigger>
</triggers>
which is strictly equivalent to a multitrigger with a OR operator.

I did find a different way to achieve this by simply not making a separate project and putting this in the one project:
<triggers>
<multiTrigger operator="And">
<triggers>
<intervalTrigger name="Continuous Integration" seconds="5" buildCondition="IfModificationExists" initialSeconds="30" />
<scheduleTrigger time="20:00" buildCondition="ForceBuild">
<weekDays>
<weekDay>Saturday</weekDay>
</weekDays>
</scheduleTrigger>
</triggers>
</multiTrigger>
</triggers>
This gives both a scheduled build of the code on Saturday night at 8:00PM and will build if the source code changes.
Hopefully this can help someone else trying to achieve the same thing.

Related

cruise control.NET perforce all commits ever are modifications

I've got a cruise control server running and successfully building my project. However, my interval trigger (set to IfModificationExists) is registering the entire changelist in the history of the database as modifications every time it tries to build, and therefore builds on every interval regardless of whether there's a new commit. Any suggestions? Here are the relevant bits of my config file:
<cruisecontrol>
<project name="MyProj">
<artifactDirectory>C:\CCNet\Artifacts\</artifactDirectory>
<!-- TRIGGER THE CHECK TO BUILD EVERY HOUR -->
<triggers>
<!-- check the source control every X time for changes,
and run the tasks if changes are found -->
<intervalTrigger
name="continuous"
seconds="3600"
buildCondition="IfModificationExists"
initialSeconds="5"/>
</triggers>
<workingDirectory>C:\PerforceFiles\</workingDirectory>
<!-- CHECK FOR CHANGES IN PERFORCE, EXCLUDE .CHM FILES SINCE THEY ARE CHECKED IN AS PART OF THIS BUILD -->
<sourcecontrol type="filtered">
<sourceControlProvider type="p4">
<view>//depot/Folder1/... //cruisecontrol_server/Folder1/..., //depot/Folder2/... //cruisecontrol_server/Folder2/..., //depot/Folder3/... //cruisecontrol_server/Folder3/..., //depot/Folder4/... //cruisecontrol_server/Folder4/...</view>
<executable>C:\Program Files\Perforce\p4.exe</executable>
<workingDirectory>C:\PerforceFiles</workingDirectory>
<client>cruisecontrol_server</client> <!-- this workspace's tree is equivalent to the view listed above -->
<user>cruisecontrol</user>
<port>myPort</port>
<applyLabel>false</applyLabel>
<autoGetSource>true</autoGetSource>
<forceSync>false</forceSync>
</sourceControlProvider>
<exclusionFilters>
<pathFilter>
<pattern>/**/*.chm</pattern>
</pathFilter>
</exclusionFilters>
</sourcecontrol>
The remainder of the file is just my tasks and publishers, which I don't think would be relevant. If there is more information you need, let me know and I'll respond as quickly as I can.
It looks right to me, this is the filtered block I'm using with SVN and is working properly:
<sourcecontrol type="filtered">
<sourceControlProvider type="svn">
<executable>$(svnConsole)</executable>
<username>username</username>
<password>password</password>
<autoGetSource>true</autoGetSource>
<trunkUrl>https://trunkurl</trunkUrl>
<workingDirectory>$(DevelopmentDir)\</workingDirectory>
</sourceControlProvider>
<exclusionFilters>
<pathFilter>
<pattern>**/AssemblyInfo.cs</pattern>
</pathFilter>
</exclusionFilters>
</sourcecontrol>
This excludes every AssemblyInfo.cs file on the trunk.
Hope this helps!

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

How do I configure two different triggers for a project in CruiseControl.Net?

I would like to know if its possible to create two triggers, one on a filesystem and another for an svn checkout in the same config file.
I have tried out the following:
a) have put both the triggers and their respective filesystem, svn definitions along with tasks in the same file,
Results in error: It says unused node deteted
eg:
<trigggers>
<intervalTrigger seconds="100" buildCondition="ForceBuild"/>
<intervalTrigger seconds="300" buildCondition="IfModificationExists"/>
</triggers>
<sourcecontrol type="filesystem">
<repositoryRoot>...</repositoryRoot>
</sourcecontrol>
<sourcecontrol type="svn">
<trunkUrl>....</trunkUrl>
<workingDirectory>...</workingDirectory>
<executable>...\SVN.exe</executable>
<username/>..<password/>
</sourcecontrol>
<tasks>
<!-- To be carried out if either of the two triggers happen -->
</tasks>
b) have created different scopes for each of the trigger bound with respective filesystem/svn and tasks, also ends up with unused node detected error.
<cb:define first_trigger_and source _and_tasks>
<triggers>
<intervalTrigger seconds="300" buildCondition="ForceBuild"/>
</triggers>
<sourcecontrol type="filesystem">
<repositoryRoot>...</repositoryRoot>
</sourcecontrol>
<tasks>
<!--To be carried out when first trigger happens -->
</tasks>
</cb:define>
<!-- And then I call the trigger this way -->
<cb:first_trigger_and source _and_tasks>
Neither of those solution works.
Multiple triggers can be specified inside the <triggers> block, but that is not why CruiseControl.Net is complaining when it's processing your configuration.
It seems to me that you want a single trigger, but two separate source control entries. The <triggers> entries specify when CruiseControl.Net should wake up and check the project state. You can't specify multiple <sourcecontrol> elements in a <project> block. To actually rebuild project on both (remote) svn changes and local filesystem changes, you should use <sourcecontrol type="multi"> with a standard trigger:
<triggers>
<intervalTrigger seconds="30" />
</triggers>
<sourcecontrol type="multi">
<sourceControls>
<filesystem>
<repositoryRoot>...</repositoryRoot>
</filesystem>
<svn>
<trunkUrl>....</trunkUrl>
<workingDirectory>...</workingDirectory>
<executable>...\SVN.exe</executable>
<username/>..<password/>
</svn>
</sourceControls>
</sourcecontrol>
<tasks>
<!-- To be executed if either of the two source control providers report changes -->
</tasks>

CruiseControl.Net build logs not showing on CCNet website after upgrade

We've been using CruiseControl.Net for a couple of years now and it has been working fine. However, since our last upgrade a few weeks ago to the latest version (1.5.0.6237) our build reports are failing to display on the ccnet website. Instead we get the following message:
"BUILD FAILED
Project: TX
Date of build: 2010-06-22 23:41:54
Running time: 00:05:06
Integration Request: Build (ForceBuild) triggered from ScheduleTrigger
Last changed: 2010-06-22 15:14:14
Last log entry: Merge Branches:
Origin=$/Source/RE/Branches/3.1
Version: 2629 [DT- 3652]: Reporting:
Capture tradable duration seperately
Modifications since last build (10)
Checked in Donald.sutherland Trunk/SLP/SLPDatabase/CreateScripts/CreateReportDataStoreTables.sql
Merge Branches: Origin=$/Source/RE/Branches/3.1
Version: 2629 [DT-3652]: Reporting:
Capture tradable duration seperately
2010-06-22 15:14:14
Checked in Donald.sutherland Trunk/SLP/SLPDatabase/Change Scripts/ReportDataStore/RpDataStoreDatabaseChangeScript.sql
Merge Branches: Origin=$/Source/RE/Branches/3.1
Version: 2629 [DT-3652]: Reporting:
Capture tradable duration seperate
What should follow is a number of error messsages indicating why the build has failed. The webpage that is failing to parse the log file is "ViewBuildReport.aspx". In order to get an explanation, our development team has to go through the full Build Log xml and search for failures.
The build.config file is attached below:
<project name="TX" queue="Build" queuePriority="1400">
<triggers>
<scheduleTrigger time="21:00" buildCondition="ForceBuild">
<weekDays>
<weekDay>Monday</weekDay>
<weekDay>Tuesday</weekDay>
<weekDay>Wednesday</weekDay>
<weekDay>Thursday</weekDay>
<weekDay>Friday</weekDay>
<weekDay>Saturday</weekDay>
<weekDay>Sunday</weekDay>
</weekDays>
</scheduleTrigger>
</triggers>
<sourcecontrol type="vault" autoGetSource="true" applyLabel="false">
<executable>c:\program files\sourcegear\vault client\vault.exe</executable>
<username>build</username>
<password>*********</password>
<host>niddrie.dataexplorers.net:8080</host>
<repository>DXL Source</repository>
<folder>$/Source/TX/Trunk</folder>
<ssl>false</ssl>
<useWorkingDirectory>true</useWorkingDirectory>
<workingDirectory>D:\Projects\Source\TX\Trunk</workingDirectory>
<cleanCopy>true</cleanCopy>
<timeout units="minutes">30</timeout>
</sourcecontrol>
<tasks>
<msbuild>
<executable>C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable>
<workingDirectory>D:\Projects\Source\TX\Trunk</workingDirectory>
<projectFile>TransactionExplorer.sln</projectFile>
<buildArgs>/noconsolelogger /p:Configuration=Release /v:diag</buildArgs>
<targets>Build</targets>
<timeout>600</timeout>
<logger>C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MSBuild.dll</logger>
</msbuild>
<exec>
<executable>deploy.bat</executable>
<baseDirectory>D:\Projects\Source\TX\Trunk</baseDirectory>
<buildArgs>D:\Projects\Source\TX\Trunk D:\MasterWebsite\SfsWebroot\Autobuild\TX</buildArgs>
<buildTimeoutSeconds>500</buildTimeoutSeconds>
</exec>
</tasks>
<publishers>
<!-- Mandatory, config file does not work without -->
<xmllogger logDir="C:\Program Files\CruiseControl.NET\server\TX\Artifacts\buildlogs" />
&email;
</publishers>
</project>
As you can see, there is a publisher and the config file hasn't changed since we upgraded to the latest CruiseControl Version. Finally, the necessary log files get generated during the build so it seems to be an issue with the xsd parse or the website itself? The build result files generated are listed below:
C:\Program Files\CruiseControl.NET\server\TX\Artifacts\msbuild-results.xml
C:\Program Files\CruiseControl.NET\server\TX\Artifacts\buildlogs\log20100622234154.xml
Any help to get this working will be greatly appreciated.
Did you check your email publisher? There have been a breaking change with CCNET 1.5. You can read more here :
http://ccnetlive.thoughtworks.com/ccnet/doc/CCNET/CCNet%201.5%20CTP%20Release%20Notes.html
http://ccnetlive.thoughtworks.com/ccnet/doc/CCNET/Email%20Publisher.html
If I understood you well, you said that your build worked fine but since you upgraded it fails, isn't it? How did you do the upgrade? Did you change directory/rights?

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