Teamcity wrong vcs.build.number

Answered

I have an issue, i dont get the right changeset number (from tfs) in my revision build, i am using %build.vcs.number% to get changeset. In some build i got the right changeset and other build sometimes i got it wrong (a changeset corresponding to another vcs root path)


I think i have this error on builds which uses parameterized vcs root : my vcs root is $/%geosys.TFSRootPath%/Releases/%geosys.TFSBranchPath% where
Geosys.TFSRootPath is a parameter of my build
geosys.TFSBranchPath is also a parameter of my build but it is asked to the user.

Could you elaborate at what stage the build.vcs.number is set ? Is it set when i trigger the build, when the build is executed. Does this on-diplay prompt variable can mix things up ?

 

i can share my project settings if required. 

 

thanks 

sebastien 

5 comments

Hello Sebastien,

When the build starts TeamCity tries to set revision of the build (and build.vcs.number parameter) to revision of the latest change included into the build. So if there were changes in build, then build.vcs.number should point to the revision of the last change. If there were no changes in the build, then build.vcs.number should point to the revision of the latest change detected in this build configuration. 

There aer also some border case when build configuration does not have changes at all or VCS repository/checkout rule were changed. In this case the first build in history can receive revision of the whole repository. And all subsequent builds should have the same revision if no changes were detected in this configuration. See the related request in bug tracker: https://youtrack.jetbrains.com/issue/TW-10084. Is it your case?

0

in my case vcs root change once the teamcity build starts. i dont know if it is after or before you set build.vcs.number parameter ? if you set it after variable prompt, that may lead to my problem, is it ?

When i meet the issue i get a wrong changeset value which corresponds to the last one of the entire repository (tfs). I set the same Geosys.TFSBranchPath between two build execution. so instead of having the last changeset of $/%geosys.TFSRootPath%/Releases/%geosys.TFSBranchPath%, i get the last change set of $/.

 

is it something you advice to have prompted variable in the vcs path ? I followed one of the solution explained here :

sebastien 

0

TeamCity resolves parameters when the build started. After that the VCS roots with different paths are considered as different VCS roots. If the resolved VCS root setting change then the revision of the whole repository will be used. For more details see the section: https://confluence.jetbrains.com/display/TCD9/Revision.

The recommended approach is to have a small number of VCS roots (pointing to the root of the repository) and define what is checked out by a specific build configuration via checkout rules.

 

0

hello 

thanks for your reply, just to be sure, has the build already started when teamcity ask me to set the parameter ? (in case of prompt parameter)

sebastien

0

Hi Sebastien,

No, build added to the queue after entering the parameter and clicking on "Run build" button.

0

Please sign in to leave a comment.