Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TeamCity Artifacts; Exclude Individual Files

I have a TeamCity Build Configuration that includes the following to publish artifacts:

Source\Builder\bin\Release\*.dll=>release

This works fine, however I am wanting to exclude one dll (there are quite a few) and have read that you can use + & - operators to do this. Something along the lines of:

+: Source\Builder\bin\Release\*.dll=>release
-: Source\Builder\bin\Release\Builder.*

As soon as I add these in, no artifacts are published and I get the following error in the build log (looks like it is counting the + as part of the path):

[Publishing artifacts] Collecting files to publish [+:Source\Builder\bin\Release\*.dll=>release]
[Publishing artifacts] Artifacts path +:Source/Builder/bin/Release/*.dll not found

I am using version 7.1.1, anyone any ideas (I am not sure whether these operators are even valid). I have seen a solution with MSBuild but am surprised this functionality is not available.

Thanks in advance.

like image 864
Monkeeman69 Avatar asked Oct 08 '12 11:10

Monkeeman69


3 Answers

I don't believe you can.

However, if you are using the artifacts in another build configuration as an artifact dependency, you can exclude a particular file there.

When you set up the dependencies, you can specify a negative operator like this:

+:release/**=>Dependencies/SomeProject
-:release/SomeBinary.dll

It is a horrible hack, but one way you could get it to work would be to set up a new build configuration which gets the dependencies as an artifact dependency, excluding the one binary, and then publishes its own artifacts.

As in, create a new build configuration and publish:

Dependencies/SomeProject=>release

Then reference the artifacts from this build configuration instead of the other one.

like image 54
infojolt Avatar answered Nov 12 '22 14:11

infojolt


A little bit late for the party, but there is still no fix...

I ended up adding a last build step to the project. It is command line > custom script. Then I used this commands to remove the files that I didn't want in the artifacts. This runs just before artifacts collection.

del /S /Q "src\apps\*.xml" 
del /S /Q "src\apps\*.pdb"

Explanation for del command

/S  Delete from all Subfolders (DELTREE)
/Q  Quiet mode, do not give a Yes/No Prompt before deleting
 *  Match any characters
like image 35
oleksii Avatar answered Nov 12 '22 12:11

oleksii


Our current options are to vote for this feature request at http://youtrack.jetbrains.com/issue/TW-5244 and fail back to workarounds.

TeamCity artifact paths combine folders question hints that the same target folder can be reused for multiple path patterns.

TeamCity docs also state that

TeamCity will create directories starting from the first occurrence of the wildcard in the pattern.

So in many cases it's possible to inverse exclusion problem to multiple inclusions.

For example, instead of lurking how to exclude -:**/.svn from my templates I was able just to filter them by extension:

templates/**/*.vm => templates
templates/**/*.xsl => templates
like image 2
Vadzim Avatar answered Nov 12 '22 14:11

Vadzim