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">
<sourcecontrol type="vsts" autoGetSource="true" applyLabel="true">
<intervalTrigger seconds="30" buildCondition="IfModificationExists" />
<state type="state" directory="C:\Data\Source\CIExample\State" />
<labeller type="defaultlabeller">

<buildArgs>/noconsolelogger /v:diag
<logger>c:\Program Files\CruiseControl.NET\server\Rodemeyer.MsBuildToCCNet.dll</logger>
Oct 31, 2007 at 10:36 AM

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

<sourcecontrol type="vsts" autoGetSource="true" applyLabel="true">

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

<intervalTrigger seconds="30" />

Let us know how you get on.

Oct 31, 2007 at 5:00 PM

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.
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?



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

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

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. 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);