How can I set the displayed Version Number?

I would like a build number in the form "MAJOR.MINOR_alpha_build_BUILDNUMBER"

so I use:

%system.project.major%.%system.project.minor%_%build_type%_build_%build.counter%

As the Build number format.

I like to read the major and minor number from teamcity.default.properties. I expectet, that the variables in the Build number format are replaced by the values from the teamcity.default.properties.

 

Do I have to use something like

##teamcity[buildNumber '<new build number>']
in my build script or is it possible with an additional system.* parameter?

The expected value in my example is 1.02_alpha_build_265



Attachment(s):
demo-CI_3.png
demo-CI_2.png
demo-CI_1.png
4 comments

Hi,

To set build number from build script you need to send service message to server using

##teamcity[buildNumber '<new build number>'].

Also you can define build number by triggering build with parameters. It can by triggered from UI using "Run custom build" or from by triggering build from script, see http://confluence.jetbrains.com/display/TCD8/Accessing+Server+by+HTTP and http://confluence.jetbrains.com/display/TCD8/REST+API#RESTAPI-TriggeringaBuild
0

Hi!

I want to read the build number only from the teamcity.default.properties file. If it does not have to be I want the build number does not need to put on a build scrip.

I still do not quite understand why the values ​​from the file teamcity.default.properties not read at the beginning and then the actual build process begins.

0

teamcity.default.properties file is read when build have already started. So the values from this file cannot be used to configure build number (without service message).

0

Hi!

Thanks for the information. I was a bit confused because I have not read accurately due to the following documentation:

http://confluence.jetbrains.com/display/TCD8/Defining+and+Using+Build+Parameters+in+Build+Configuration

When TeamCity starts a build process, the following precedence of the build parameters is used (those on top have higher priority):

* parameters from the teamcity.default.properties file.
* pre-defined parameters.
* parameters defined in the Run Custom Build dialog.
* ...



I thought a "build process" is the actual build, not the start the "build scripts".

0

Please sign in to leave a comment.