【问题标题】:How to append git short hash into Octopus release from TeamCity如何将 git 短哈希附加到 TeamCity 的 Octopus 版本中
【发布时间】:2017-11-06 02:36:32
【问题描述】:

在 TeamCity 中使用 OctopusDeploy: Create Release 运行器,我可以相当轻松地创建带有 build.number 的版本。

我想添加一个 git commit 短哈希的后缀。

【问题讨论】:

    标签: teamcity octopus-deploy


    【解决方案1】:

    这是我解决它的方法 - 从各种互联网资源中抓取

    在我的 CI Build 中,我添加了

    1. 一个名为system.GitHashShort的参数
    2. 创建了一个执行此操作的 Powershell 运行器

      $hash = "%build.vcs.number%" $shortHash = $hash.substring(0,7) Write-Host "##teamcity[setParameter name='system.GitHashShort' value='$shortHash']"

    在我的 Deploy 构建配置中,它是对 CI Build

    的快照依赖
    1. 对于OctopusDeploy: Create Release 运行器,将版本号设置为

      %build.number%-%dep.MyAwesomeApp.system.GitHashShort%

    这会生成类似 8.3.422.34-deadbee 的格式

    【讨论】:

      猜你喜欢
      • 2011-08-07
      • 1970-01-01
      • 2018-01-28
      • 2014-01-23
      • 2013-05-01
      • 1970-01-01
      • 2013-06-13
      • 1970-01-01
      • 2014-01-10
      相关资源
      最近更新 更多