Setting Teamcity version number with counter from file

做~自己de王妃 提交于 2019-12-13 12:12:14

问题


I'm currently trying to update the version no. in TeamCity using a Nant build file, containing the version number. If I just use

<property name="versionNo" value="2.16.3."/>
.
.
<echo message="##teamcity[buildNumber '${versionNo}']"></echo> 

In the script the buildNumber is update to 2.16.3 but I would also like to have the counter on this version number. Meaning I would like to have

<echo message="##teamcity[buildNumber '${versionNo}.{0}']"></echo> 

But this doesn't work. Does anybody know how to do this, tried many things among this solution http://binary-notes.blogspot.com/2011/05/controlling-application-version-number.html however, the ${Version} parameter is a clue for me ?

Update

Made the implementation by using {0} as buildnumber in Teamcity and appending that build number to my own build number in the file

<property name="versionNo" value="2.16.3."/>
.
.
<echo message="##teamcity[buildNumber '${versionNo}.${environment::get-variable('BUILD_NUMBER')}']"></echo> 

回答1:


TeamCity has a build number which it places into the environment while running your build script.

You can access the environment variable BUILD_NUMBER and append it to your actual version number. Then echo it back to TeamCity. I assume this would be available via ${sys.env.BUILD_NUMBER}.

So perhaps:

<echo message="##teamcity[buildNumber '${versionNo}.${sys.env.BUILD_NUMBER}']"></echo> 

PS. There really is no reason to change the build number in teamcity like they do in that article. You can leave it {0}



来源:https://stackoverflow.com/questions/8895118/setting-teamcity-version-number-with-counter-from-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!