【问题标题】:Exclude directory in TeamCity when build has no changes构建没有更改时在 TeamCity 中排除目录
【发布时间】:2013-11-26 10:34:58
【问题描述】:

我想从工件中排除一个目录,但前提是构建没有更改。有可能吗?

我的工件有 1GB,但没有那个目录只有 25MB。我的一半以上的构建没有这样的变化: 这只是我的项目之一。我没有足够的空间来存储它们。

我尝试过这样的事情:

Binaries=>Binaries.zip
-:Binaries/DirToExclude/*/.*

但即使没有我现在要求的条件,它也无法工作:(

【问题讨论】:

  • 所以,问题是 A) 此构建配置正在执行并在实际上没有更改时存储新的工件,或者 B) 您有 1GB 不经常更改的工件,即使更改被隔离到“其他”25MB?我只会在有更改时才执行此构建,并且可能将该 1GB 目录放入另一个执行频率低得多的构建配置中。

标签: teamcity artifacts teamcity-7.1


【解决方案1】:

在末尾添加一个构建步骤,检查是否有任何更改。如果没有更改,则删除工件,否则不要理会它。您可以使用 TC8 将构建步骤的执行策略设置为 Always, even if build stop command was issued

您可以使用 TeamCity REST API 来确定是否还有任何更改。例如:

curl -u /httpAuth/app/rest/changes?build=id:%teamcity.build.id%

可以返回如下内容:

<changes count="3">
   <change href="/httpAuth/app/rest/changes/id:217404" id="217404" version="b6b97a0d7789d97df6df908ab582ebb723235f43" webLink="http://teamcity.my-domain.com/viewModification.html?modId=217404&personal=false"/>
   <change href="/httpAuth/app/rest/changes/id:217403" id="217403" version="064ecef5552ec2fb7875d7c26fe54cdf94b67bec" webLink="http://teamcity.my-domain.com/viewModification.html?modId=217403&personal=false"/>
   <change href="/httpAuth/app/rest/changes/id:217402" id="217402" version="9bc3a34c952059bbfc7bebeb79ba5a3c894ef555" webLink="http://teamcity.my-domain.com/viewModification.html?modId=217402&personal=false"/>
</changes>

但你可以将它与 curl、grep 和 awk 联系起来,以获取使用 like 的数字:

curl -u %teamcity.auth.userId%:%teamcity.auth.password% %teamcity.serverUrl%/httpAuth/app/rest/changes?build=%teamcity.build.id% | grep "changes" | awk -F"\"" '{print $8}'

在上述情况下会返回3,但如果没有更改,则会返回0

【讨论】:

  • 这不是我想要的,但它很有帮助:)
  • 我同意。它不太理想,但我不知道只有在构建发生更改时才能完成发布工件。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-05-30
  • 2020-02-20
  • 1970-01-01
相关资源
最近更新 更多