Is it possible to reset the build counter via ##teamcity message?
Hi, I want the build counter being reset if the version of the software changes.
I could e. g. detemine during the beginning of the build if the version changed and echo out some ##teamcity messages.
Is it possible to reset the build counter and then cancel and reschedule the build?
Currently I reset the build counter manually on all affected build configurations if I check in a version change, but this is errorprone and can easily be forgotten, so I'd like to automat this, optimally via ##teamcity message.
If this is not currently possible, can this maybe easily be done with a TC plugin?
Please sign in to leave a comment.
Hi Björn,
No, there is no ability to affect build configration changes with service messages.
It is possible to change the counter via REST API by PUTting the value to http://teamcity:8111/app/rest/buildTypes/id:btXXX/settings/buildNumberCounter
TeamCity Java plugin can change that too or you can edit the number directly under .BuildServer/config/<project>/btXXX.buildNumbers.properties
> It is possible to change the counter via REST API by PUTting the value to http://teamcity:8111/app/rest/buildTypes/id:btXXX/settings/buildNumberCounter
But that would require to have a username / password (that has admin rights) in the build script or via build property and I don't really want to create a domain user just for being able to reset the build number counter. :-(
> TeamCity Java plugin can change that too
Where do I get it?
How can I do it?
> you can edit the number directly under .BuildServer/config/<project>/btXXX.buildNumbers.properties
From the build that is running on a build agent, possibly not running on the TC machine? o_O
Björn,
> But that would require to have a username / password (that has admin rights) in the build script or via build property and I don't really want to create a domain user just for being able to reset the build number counter. :-(
Basically yes. Rights to edit the build configuration will be required. But requesting due authorization seems a valid approach here.
I understand the issue with the domain user, but so far cannot suggest a workaround. At some point either http://youtrack.jetbrains.com/issue/TW-4524 or http://youtrack.jetbrains.com/issue/TW-3161 can help with the issue.
>> TeamCity Java plugin can change that too
> Where do I get it?
I am not aware of such public plugins. I just noted that this can be done via a plugin, so one can write it.
> How can I do it?
Writing a plugin is not the simpliest task, introduction materials are available at http://confluence.jetbrains.net/display/TCD7/Developing+TeamCity+Plugins
Ah I see, I misunderstood you.
For now I changed strategy and let the build generate a build number that I then set via ##teamcity message.