内部编号中的分支名称 [英] Branch name in build number

查看:93
本文介绍了内部编号中的分支名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将分支名称放入内部版本号,但找不到正确的参数。
我正在使用内部版本号格式:%teamcity.build.branch%。{0}



它可以工作,但是在尝试构建默认分支'dev'时,teamcity将其命名为< default>





如何修理它 ?

解决方案

我能够通过以下方式解决此问题:




  • 在我的VCS根目录中-使用git-将我的默认分支设置为:master

  • 在我的VCS根中-使用git-将我的分支规范设置为: / p>

    +:refs / heads /(master)



    +:refs / heads /(release-*)



    +:refs / heads /(hotfix-*)


  • 创建配置参数:BuildNumberPrefix = SomeService。%teamcity.build.branch%.release _


  • 将我的内部版本号格式设置为:%BuildNumberPrefix %% build.counter%


  • 然后在我的构建步骤中,使用以下脚本将命令行步骤添加为第一步:



    set t =% BuildNumberPrefix %% build.counter%



    echo ## teamcity [buildNumber'%% t %%']




在构建项目时在Team City项目列表中,您应该看到在执行命令行步骤后删除了部分内部版本号d。出于某种原因,重新评估使用teamcity.build.branch变量的BuildNumberPrefix会导致默认值消失并由分支名称代替。



希望这对某人有帮助


I'm trying to put branch name into build number, but I can't find the right parameter. I'm using build number format : %teamcity.build.branch%.{0}

It works, but when it trying to build default branch 'dev', teamcity names it as <default>.

How to fix it ?

解决方案

I was able to solve this problem by:

  • In my VCS Root - using git - set my Default Branch to: master
  • In my VCS Root - using git - set my Branch Specification to:

    +:refs/heads/(master)

    +:refs/heads/(release-*)

    +:refs/heads/(hotfix-*)

  • Create a Configuration Paramater: BuildNumberPrefix = SomeService.%teamcity.build.branch%.release_

  • Set my Build number format to: %BuildNumberPrefix%%build.counter%

  • Then in my build steps add a command line step as the first step with the following script:

    set t=%BuildNumberPrefix%%build.counter%

    echo ##teamcity[buildNumber '%%t%%']

In the Team City projects listing when building the project you should see the part of the build number get removed after the command line step is executed. For some reason re-evaluating the BuildNumberPrefix that uses the teamcity.build.branch variable causes the default to go away and be replaced by the branch name.

Hope this helps someone.

这篇关于内部编号中的分支名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆