0

I want to exclude one catalog from artifacts but only when build has no changes. Is it possible?

My artifacts have 1GB but without that one directory only 25MB. Over half of my builds has no changes like this: teamcity screenshot And this is only one of my projects. I don't have enough space to store it all.

I tried something like this:

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

but it is not working even without the condition which I'm asking now :(

sebaszw
  • 1,404
  • 2
  • 14
  • 19
  • So, is the problem that A) this build configuration is executing and storing a new of artifacts when there are actually no changes or B) You have 1GB of infrequently changing artifacts that keep getting stored even though the changes are isolated to the "other" 25MB? I'd be getting this build to only execute when there are changes, and perhaps putting that 1GB directory into another build configuration which gets executed much less frequently. – Michael12345 Nov 26 '13 at 23:00

1 Answers1

1

Add a build step at the end that checks if there are any changes. If there are no changes, then delete the artifact otherwise leave it alone. You could with TC8 set the Execution Policy of the build step to Always, even if build stop command was issued.

You can use the TeamCity REST API to determine if there are any changes left. For example:

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

Could return something like this:

<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>

But you could tie it with curl, grep and awk to get if the number using 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}'

Which in the above case would return 3 but if there are no changes it would return 0.

Welsh
  • 5,138
  • 3
  • 29
  • 43