NewThis is a live doc! Anyone with edit access can make updates in real time without having to publish.
让 Teamcity 支持 run on Tag

进入 Project 的 VCS Root 的配置页面

  • Branch specification 增加一行 refs/tags/*

  • 并勾选「Enable to use tags in the branch specification」

image-20241121-082839.png

在配置好以后,所有 Build 默认都会 run on tag,如果希望让某个 Build 不在 tag 时,运行,在 Build 配置页面的 Triggers → VCS Trigger → Branch filter 配置 -:refs/tags/*

在某个 Build 是因 tag 而运行时

  • teamcity.build.branch 为 tag value

  • teamcity.build.vcs.branch.VCSROOTID 为 tag ref(refs/tags/tag

  • vcsroot.branch 为这一 tag 对应的 commit 所处的 branch(refs/heads/branch

  • vcsroot.VCSROOTID.branch 为这一 tag 对应的 commit 所处的 branch(refs/heads/branch

因此,似乎唯一的方式去判断某一 build 是否为 run on tag 是比较 teamcity.build.vcs.branch.XXXvcsroot.branch 是否相同