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

后端 未结 6 586
忘了有多久
忘了有多久 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:40

    As Lasse V. Karlsen mentioned those numerical revision numbers are local-clone specific and can be different for each clone. They're really not suitable for versioning -- you could reclone the same repo and get different revision numbers.

    At the very least include the node id also creating something like 0.0.12-6ec760554f2b then you still get sortable release artifacts but are still firmly identifying your release.

    If you're using numeric tags to tag releases there's a particularly nice option:

    % hg log -r tip --template '{latesttag}.{latesttagdistance}'
    

    which, if the most recent tag on that clone was called 1.0.1 and was 84 commits ago gives a value like:

    1.0.1.84
    

    Since you can have different heads that are 84 commits away from a tag in different repos you should still probably include the node id like:

    % hg log -r tip --template '{latesttag}.{latesttagdistance}-{node|short}'
    

    giving:

    1.0.1.84-ec760554f2b
    

    which makes a great version string.

提交回复
热议问题