Labeling and detecting Modifications

Topics: Developer Forum, User Forum
Oct 30, 2007 at 7:59 PM
I am setting up CruiseControl.NET to work with TFS.
I have done this many times before with other source control systems (Subversion, Vault, VSS) and its always been fairly easy.

However, I am having a problem now. Perhaps it is something with my setup.
I have a simple project configured in TFS and CCNet. CCNet connects to TFS, gets new code changes and builds without issue. CCNet is connecting using my account, which is an admin.

The problem is, each time CCNet checks for modifications, it always finds the last modification, e.g. I modify one file (add a comment), CCNet sees the change and builds. Then 60 seconds later, CCNet says "Oh look, a comment changed" and kicks off another build, which increments the build number on the CCNet, creates a log file, etc. every time CCNet checks for changes, even though nothing has changed.

I also don't see a label getting applied within TFS.

Any ideas as to why this is happening?

Here's my project block:

<project name="CSS.Framework-Current">
<workingDirectory>C:\Data\Source\CI_Example\Common\Framework</workingDirectory>
<artifactDirectory>C:\Data\Source\CIExample\Artifacts\CSS.Framework-Current</artifactDirectory>
<webURL>http://damiandw-v/CCNetDashboard/default.aspx?actionViewProjectReport=true&server=damiand_tfs-vm&project=CSS.Framework-Current</webURL>
<sourcecontrol type="vsts" autoGetSource="true" applyLabel="true">
<server>http://damiand_tfs-vm:8080/</server>
<username>damiand</username>
<password>myPa$$w0rd</password>
<domain>csssoftware</domain>
<project>$/CI_Example</project>
<workingDirectory>C:\Data\Source\CI_Example</workingDirectory>
<cleanCopy>false</cleanCopy>
<workspace>damiand_tfs-vm</workspace>
<deleteWorkspace>false</deleteWorkspace>
</sourcecontrol>
<triggers>
<intervalTrigger seconds="30" buildCondition="IfModificationExists" />
</triggers>
<state type="state" directory="C:\Data\Source\CIExample\State" />
<labeller type="defaultlabeller">
<prefix>1.0.0.</prefix>
</labeller>

<tasks>
<msbuild>
<executable>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe</executable>
<workingDirectory>C:\Data\Source\CI_Example\Common\Framework</workingDirectory>
<projectFile>CSS.Framework.sln</projectFile>
<buildArgs>/noconsolelogger /v:diag
</buildArgs>
<targets></targets>
<timeout>600</timeout>
<logger>c:\Program Files\CruiseControl.NET\server\Rodemeyer.MsBuildToCCNet.dll</logger>
</msbuild>
</tasks>
</project>
Oct 31, 2007 at 10:36 AM
Hi,

For the ApplyLabel stuff to work, you need to set the ApplyLabel property, i.e.

<sourcecontrol type="vsts" autoGetSource="true" applyLabel="true">
<server>http://damiand_tfs-vm:8080/</server>
<username>damiand</username>
<password>myPa$$w0rd</password>
<domain>csssoftware</domain>
<project>$/CI_Example</project>
<workingDirectory>C:\Data\Source\CI_Example</workingDirectory>
<applylabel>true</applyLabel>
<cleanCopy>false</cleanCopy>
<workspace>damiand_tfs-vm</workspace>
<deleteWorkspace>false</deleteWorkspace>
</sourcecontrol>

Regarding the modifications thing, the plug-in will check for modifications during the time period that CruiseControl.NET requests. Usually, CC.NET reports the time from the last successful build until "now". I wonder if the "IfModifcationExists" condition is getting things mixed up a little. Try setting your trigger to be just

<triggers>
<intervalTrigger seconds="30" />
</triggers>

Let us know how you get on.

Martin
Oct 31, 2007 at 5:00 PM
Martin,

I did already have the applyLabel set: as an attribute on the sourcecontrol element.
I tried having it as it's own element as well, but got an error message that the element already existed, so I left "applyLabel" as an attribute and not an element. After reading your email, I tried removing it as an attribute and adding it as an element of <sourcecontrol>
I can also see that labels have been applied to TFS by CruiseControl, I believe both ways (I may have just missed that yesterday).

After looking more closely at my config file, I did find another issue in my setup, I didn't have the project and workingDirectory of <sourcecontrol> set as specifically as they should. I changed that and the checking for modifications got better, but is still not quite right.

What I mean is that, I can check out code, modify and check in. CCNet will find a change and then build.
Great.
However, it keeps finding the last modification afterward until another change comes along.

For example, I have three simple test projects, I (seperately) mades single line changes to all three.
Project A found the same change 7 times over 3 minutes.
Project B found the same change 9 times over 5 minutes.
Project C found the same change 28 times over 15 minutes.

Project A didn't stop finding changes until the Project B change was checked in.
Project B didn't stop finding changes until the Project C change was checked in.
Project C didn't stop finding the same change until I checked in a change to Project A.
Then Project C stopped finding changes and Project A went into what appears to be an endless loop of building.
(cycle repeats).

I stopped CCNET, changed the configs to only check every minute, instead of every 30 seconds and CCNET picked up right where it left off on Project A, constantly finding the same change and rebuilding.

I stopped CCNET again and removed all of the buildCondition="IfModificationExists",
same result.

I have verbose logging on and nothing seems amiss. CCNet asks TFS if there are changes and keeps finding them until a different project has changes. I've never seen this with any other source control providers I've setup with CruiseControl and, frankly, am at a loss as to why it keeps finding the same changes over and over again.

Any ideas? Any more information I can provide?

thanks,

Damian


Mar 20, 2008 at 10:55 AM
The trigger setting is definitely not working for me either. My trigger is:

<triggers>
<intervalTrigger name="continuous" seconds="1800" buildCondition="ForceBuild" initialIntervalSeconds="30" />
</triggers>

It's still checking every 3 minutes and picking up the same single modification every time.

The CCNet server log says:

2008-03-20 09:52:12,420 project:DEBUG Checking Team Foundation Server for Modifications
2008-03-20 09:52:12,420 project:DEBUG From: 20/03/2008 09:49:21 - To: 20/03/2008 09:52:12
2008-03-20 09:52:13,170 project:DEBUG Found 1 modifications
2008-03-20 09:52:13,170 project:INFO 1 modification detected.
2008-03-20 09:52:13,170 project:INFO Building: IntervalTrigger triggered a build (IfModificationExists)

This only started happening after we upgraded from TFS 2005 to TFS 2008 a few weeks ago.
Mar 20, 2008 at 11:14 AM
In the meantime I've solved the issue but changing the triggers tag to:

<triggers />

Also I moved it in the project config to ABOVE the source control tag. I don't really know yet whether it's made a difference but will add another reply to this thread if it does.
Mar 20, 2008 at 12:35 PM
Sorry guys - this thread had somehow escaped my attention.

What version of the plug-in are you using? I posted the following release back in November to work around a bug in the RTM release of TFS2008. http://www.codeplex.com/TFSCCNetPlugin/Release/ProjectReleases.aspx?ReleaseId=1816. Your issues sounds very similar to the bug I thought I had fixed then.
Feb 27, 2009 at 2:10 PM
I experience the same behavior. It seems like the plug in takes the time span from the start of the previous build to now when checking for modifications:

public Modification[] GetModifications(IIntegrationResult from, IIntegrationResult to)
{
            Log.Debug("Checking Team Foundation Server for Modifications");
            Log.Debug("From: " + from.StartTime + " - To: " + to.StartTime);

            VersionSpec fromVersion = new DateVersionSpec(from.StartTime);
            VersionSpec toVersion = new DateVersionSpec(to.StartTime);