TeamCity Artifacts; Exclude Individual Files

早过忘川 提交于 2019-11-30 22:34:48

问题


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.


回答1:


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.




回答2:


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



回答3:


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


来源:https://stackoverflow.com/questions/12780516/teamcity-artifacts-exclude-individual-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!