1

I have a build project that I run from TeamCity, now it takes the build.number from TeamCity. I want to be able to use the buildnumber task (Ant) which in my understanding when used, is supposed to change the value of build number property and increment it for next time. But it seems that I still get the build number from TeamCity.

How can I use the build number from <buildnumber file="mybuild.number"/>?

martin clayton
  • 76,436
  • 32
  • 213
  • 198
jonny
  • 53
  • 1
  • 4

3 Answers3

2

Use the TeamCity Autoincrementer plugin to share an incrementing build number between configurations.

Anthony Pegram
  • 123,721
  • 27
  • 225
  • 246
Rich Tebb
  • 6,806
  • 2
  • 23
  • 25
0

The ANT buildnumber task sets the ANT property build.number.

I don't use team city, but the documentation states that it is also setting the same property.... Might explain your problem :-(

Perhaps someone knows how to switch this team city feature off.

Is there a good reason to switch? The only alternative I can offer ivy buildnumber task. It calculates the next build/release number based on what was previously published to the repository. This may not be suitable in your case. I prefer it because I don't depend on build server settings or need to keep a property file under revision control.

Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185
  • the thing is that i have the same project which i can run from 2 teamcity project (1 that runs all of my projects , and 1 that runs only this project.) so i need a way to ensure that version numbers will be accurate , i thought changing them from ant script and commit it. maybe someone knows a way from team city that i can attach 2 configuration with the same build number? – jonny Feb 28 '11 at 08:54
0

I'm afraid so far there is no way to disable build.number property from TeamCity. The only possibility I can imagine is not to use TeamCity Ant runner and use Command-line runner instead. But in this case you'll miss many nicities of the bundled Ant runner (like immediate test reporting).

Why would you want to use buildnumber task of the Ant? To keep build number across the builds, you'd have either to commit mybuild.number to version control or to run the build always on the same agent in the same place.

KIR
  • 5,614
  • 1
  • 31
  • 23
  • the thing is that i have the same project which i can run from 2 teamcity project (1 that runs all of my projects , and 1 that runs only this project.) so i need a way to ensure that version numbers will be accurate , i thought changing them from ant script and commit it. maybe someone knows a way from team city that i can attach 2 configuration with the same build number? – jonny Feb 28 '11 at 09:45
  • Actually TeamCity provides pretty flexible way to set build number. What you can do is to generate build number yourself and [pass it|http://confluence.jetbrains.net/display/TCD6/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-ReportingBuildNumber] to TeamCity. Another question - why do you use 2 TeamCity projects for your build? You can use single build configuration + build dependencies. – KIR Mar 01 '11 at 07:37