TeamCity - CI and Overnight Build Numbers

Hello,

This has been discussed before but some years ago now.  With the latest 8.1 build, is there a way for my CI build to use the Overnight build number as a part of it's own version number?  For example, our Overnight build produces a version number of 1.0.%build.number%.  What I would like is for our CI build to use %overnight.build.number%.%build.number%, so that it essentially reads 1.0.1.1 or something, i.e. the first three digits of the CI build match that from the last successful overnight build.

Tomorrow for example the CI would be v1.0.2.1, counting up to (for example) v1.0.2.10 that day, swapping to v1.0.3.1 the next day.


Any ideas?  Could this be achieved through artifacts perhaps?

2 comments
Comment actions Permalink

Any suggestions?

0
Comment actions Permalink

Hello, you can only use parameters from builds this one has snapshot dependency to (both direct and indirect). In this case you can use parameter %dep.<conf_name>.build.number%.

If there's no snapshot dependency, you can retrieve the build.number of the latest build via REST
http://teamcity/httpAuth/app/rest/builds/buildType:<myBuildType>/number
see http://confluence.jetbrains.com/display/TCD8/REST+API#RESTAPI-BuildRequests for details
and then set this number in build using service message:
API: http://confluence.jetbrains.com/display/TCD8/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-ReportingBuildNumber

So, you need to find the way to retrieve the build number inside your script.

Alternatively, in your nightly build, as a last build step, you can setup a build number parameter to daily configuration via REST API (http://confluence.jetbrains.com/display/TCD8/REST+API#RESTAPI-ProjectSettings and http://confluence.jetbrains.com/display/TCD8/REST+API#RESTAPI-BuildConfigurationAndTemplateSettings)

0

Please sign in to leave a comment.