How can I label my build with revision number and not the GUID (in TeamCity)?

后端 未结 6 587
忘了有多久
忘了有多久 2021-01-30 11:15

I am trying to do \"continuous integration\" with TeamCity. I would like to label my builds in a incremental way and the GUID provided by the VCS is not as usefull as a simple i

6条回答
  •  情歌与酒
    2021-01-30 11:31

    The best and easiest way to see rev. number in TeamCity build number is to use Build Script Interaction with TeamCity. Namely, it has a possibility to set Build Number.

    So, add to your project a new very first build step Command Line with following Command Executable

    for /f %%i in ('c:\tortoisehg\hg id -n') do echo ##teamcity[buildNumber '%%i']
    

    And you will get the Mercurial revision number as a label for your every build.

    Of course you can change the command in quotes to anything you wish.

    I believe my answer is way more correct than the accepted one.

    EDIT:

    Also you can do the same via MSBuild task rather than Command Executable. Have a MSBuild project file with following code, setup TeamCity to run it as first step, and it will alter its global variable buildNumber:

    
    

    Where CurrentVersion is a string containing full version (for example "1.0.56.20931").

提交回复
热议问题