Unable to find current version for the branch: %cnbranch%

I'm using a build property to specify the branch name. Whilst this works well for the actual build, teamcity is now unable to display pending commits, receiving the following error:

Unable to find current version for the branch: %cnbranch%

jetbrains.buildServer.vcs.VcsException: Unable to find current version for the branch: %cnbranch%
at jetbrains.buildServer.buildTriggers.vcs.mercurial.MercurialVcsSupport.getCurrentVersion(MercurialVcsSupport.java:221)
at jetbrains.buildServer.vcs.impl.VcsRootInstancesManagerImpl$SVcsRootInstance.getCurrentRevision(VcsRootInstancesManagerImpl.java:25)
at jetbrains.buildServer.vcs.impl.VcsManagerImpl.getRevisionsForAllRoots(VcsManagerImpl.java:181)
at jetbrains.buildServer.vcs.impl.VcsManagerImpl.loadChanges(VcsManagerImpl.java:709)
at jetbrains.buildServer.serverSide.impl.auth.SecuredVcsManager.loadChanges(SecuredVcsManager.java:64)
at jetbrains.buildServer.serverSide.impl.VcsModificationChecker$1.run(VcsModificationChecker.java:20)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


Is this a known issue?

Thanks

12 comments
Comment actions Permalink

Hi Peter,

it seems like TeamCity didn't resolve configuration parameter %cnbranch%. Could you please explain what do you mean by "works well for the actual build"? Did you manage to run the build with such VCS root?

0
Comment actions Permalink

We have 22 builds using this VCS root, each one has %cnbranch% defined differently, but each one does have it defined. Each build works as expected, building the latest revision in the branch defined in its configuration prarameter, %cnbranch%, eg: 'default' or 'my-branch-name'

The problem is, every minute or so, the main Project view (and the view at /admin/vcsRootsGlobal.html) displays the following error next to each build name which uses this VCS root:

Unable to find current version for the branch: %cnbranch% 
« Hide stacktrace
jetbrains.buildServer.vcs.VcsException: Unable to find current version for the branch: %cnbranch% 
at jetbrains.buildServer.buildTriggers.vcs.mercurial.MercurialVcsSupport.getCurrentVersion(MercurialVcsSupport.java:221) 
at jetbrains.buildServer.vcs.impl.VcsRootInstancesManagerImpl$SVcsRootInstance.getCurrentRevision(VcsRootInstancesManagerImpl.java:25)
at jetbrains.buildServer.vcs.impl.VcsManagerImpl.getRevisionsForAllRoots(VcsManagerImpl.java:181) 
at jetbrains.buildServer.vcs.impl.VcsManagerImpl.loadChanges(VcsManagerImpl.java:709) 
at jetbrains.buildServer.serverSide.impl.auth.SecuredVcsManager.loadChanges(SecuredVcsManager.java:64) 
at jetbrains.buildServer.serverSide.impl.VcsModificationChecker$1.run(VcsModificationChecker.java:20) 
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) 



However, the builds can find the current version for each branch - the pending changes do work half the time, by displaying pending changes only for the build's specific branch, defined in the configuration parameter, %cnbranch%, within the specific build configuration. Every minute or so, ajax style, the red boxes with the above message flash next to each project name.

The builds are working fine too, finding the latest revision for the branch defined in %cnbranch% and building from there.

Obviously, the VCS root has the value %cnbranch% as the branch name. Note that this is a Mercurial repository.

Thanks



Attachment(s):
build-noerror.PNG
build-error.PNG
0
Comment actions Permalink

Peter,

do you use branch remote-run trigger in these build configurations?

0
Comment actions Permalink

Hi Dmitry,

No, I do not use this feature. 2 of the builds have VCS triggers, which 'Triggers build after a VCS change is detected'. The rest do not have any triggers.

Thanks

0
Comment actions Permalink

What version of TeamCity do you use?

0
Comment actions Permalink

Peter, I don't understand why does that happen. Could you please enable a 'debug-vcs' logging preset at 'Administration > Server Configuration > Diagnostics' and provide a teamcity-vcs.log for the moment when error occurs?

0
Comment actions Permalink

We are using the latest public TeamCity version - 6.5.3 (build 17985)

Log attached. As you can see, there are numerous times where checking for changes succeeds, and a couple where it does not.

Thanks



Attachment(s):
teamcity-vcs-log-forjetbrains-2011-08-30.txt.zip
0
Comment actions Permalink

Peter,

log shows that all failed operations were for the 'root instance' 191. Most likely one of build configurations doesn't have defined parameter, or has an environment variable/system property with the same name instead of config parameter.
You said you checked that, but could please check once again? Because this is the only explanation I have.

0
Comment actions Permalink

To detect which build configuration doesn't have a parameter you can run 'Test Connection' in the problematic VCS root. Error message should include a name of configuration.

0
Comment actions Permalink

Thanks Dmitry.

Unfortunately Test Connection seems to time-out (perhaps because there are so many build configurations using this VCS?). Is there another way to see which build the ID refers to?

Thanks,

Pete

0
Comment actions Permalink

Test connection checks connection in all configurations which use that VCS root. You said you have 22 of them, this is not a huge, so test connection shouldn't fail because of that.
> Is there another way to see which build the ID refers to?
Unfortunatelly, at the moment there is no UI for doing that. The only way you can do it in UI is to check each configuration manually.
If all configurations which use this root belong to a single project, you can grep the file ~/.BuildServer/config/<Project Name>/project-config.xml. It contains element <build-type> for each build configuration and each <build-type> has <settings>/<parameters> child which contains parameters.

0
Comment actions Permalink

It seems you've faced this bug: http://youtrack.jetbrains.net/issue/TW-18026
Because of it if a parameter is defined incorrectly in at least one of build configurations TeamCity will show errors for all build configurations using this parametrized VCS root. The fix will be available soon, please watch YouTrack issue.

0

Please sign in to leave a comment.