Application versioning

Hello guys!

So we've been using TeamCity for quite some time at our company.
Recently, I've been challanged with a task to implement versioning system into our applications.

We've got the basic idea of how it should be incremented, but I'm not quite sure how, with TeamCity and ANT (we are using ant to build apps), to do that.
Now, the all idea behind the versioning is to have a:

major.minor.build_number

The tricky thing is, that major and minor are... somewhat determined manually, but build_number is determined by the number of builds done in specific minor.
Examples:

1.1.2
1.1.3
...
1.1.15
1.2.0
1.2.1
1.2.2
....

I don't want remote service to store the whole thing elsewhere. Ideally would be to use property file to store each part of the version and then combine them together.
The problem however is, that we have multiple branches from which we deploy the applications. Now, let's say master is at 1.1.15 and from that branch prod_build is created.

Now, when couple of features ahead, at master, we have 1.1.67. When starting build from prod_build version should be 1.1.16

Is there any way for storing some values in teamcity database? Maybe that would give me some hope I guess.
Thanks for your help!

1 comment
Comment actions Permalink

Hi Konrad,

Hre is an overview of related TeamCity features:
- build number field on the General Settings can have fixed text, reference to a parameter and a counter (which increments on each build of the build configuration)
parameters use is appropriate for rarely chnaging part. Can be changed manually by the project administrator or via a call to REST API, if necessary.
- build number can be set from within a build script to any value using a service mesasge
- there is also a plugin which allows to use the same counter in several build configurations
- arbitrary logic for a build number can be implemented using TeamCity Java plugin

If you want to use TeamCity feature branches support (so, use single build configuration for building all the branches), the most approapriate seems to be the approach to set the build number from within the build scirpt. If you need global counter for the builds of the build configuration, you can use one provided by TeamCity. If you want several incrementing sequences, then generating counter values should be a job of your build script.

> Now, when couple of features ahead, at master, we have 1.1.67. When starting build from prod_build version should be 1.1.16

This looks like the only difference between master and prod would be counter ranges. If this is exactly as you want it, then TeamCity counter will not be of much use here and you can go either "report form the script" or "write custom Java plugin" approach.

0

Please sign in to leave a comment.