Paulius Liekis
Paulius Liekis

Reputation: 1730

How to make TeamCity build fail if artifacts are not found?

Is it posible to fail TeamCity builds if artifacts are not found? I mean without writing any special script, i.e. does TeamCity has such built-in functionality?

Upvotes: 4

Views: 2269

Answers (3)

arye
arye

Reputation: 490

Similar to other answer here. You can add regex expression that will discover this in the build log and will fail the test:

^Artifacts path '.*' not found$

enter image description here It is also recommended to add meaningful error message, such as:

Failed to find artifact to publish

Upvotes: 0

user2192567
user2192567

Reputation: 61

In TeamCity 7.x you can catch this using a build failure condition. You can add a condition in your build configuration to fail on specific text found in a build log.

For example fail on text:

    Artifacts path file.txt not found

This works, I use it in my builds to catch missing artifacts.

enter image description here

Upvotes: 6

vicsz
vicsz

Reputation: 9744

No, you're going to have to implement that functionality into your build script.

i.e. if you are using MSBUILD .. after everything is complete run the following command:

<Error Condition="!Exists('someArtifact.txt')" Text="Error!!! Artifact doesn't exist" />

Upvotes: 3

Related Questions