0

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

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

我试过这样的事情:

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

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

4

1 回答 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 联系起来,以获取数字是否使用如下:

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

于 2013-11-26T23:13:24.527 回答