inquam
inquam

Reputation: 12942

Run succeeding steps when preceding step failed

I'm wondering if there is a way to force TeamCity to run a given build step even if preceding build steps fail. I want to do this to clean up after the build and terminate any started processes etc.

Upvotes: 1

Views: 242

Answers (4)

inquam
inquam

Reputation: 12942

Newer versions of TeamCity has this feature built in.

Upvotes: 0

Ross Patterson
Ross Patterson

Reputation: 9569

We do our builds by constructing NAnt scripts, and then using TeamCity's NAnt runner. NAnt (well, actually NAntContrib, but still ...) has a try ... catch ... finally mechanism that does what any programmer would expect - run the catch code if the try code fails, and run the finally code no matter what happens. We use it for the same purposes as you want, plus to collect artifacts that we want the build to publish even in case of failure (like test logs).

Upvotes: 0

James Woolfenden
James Woolfenden

Reputation: 6681

In Msbuild you can set the property ContinueOnError for many tasks. I usually add this using a property so it can be switched on and off:

<MSBuild Projects="my.csproj" ContinueOnError="$(ContinueOnError)"/>

Then you can set it on and off via teamcity. So if you do this for a build step it should continue thru to the others.

Upvotes: 1

Mike Two
Mike Two

Reputation: 46203

I don't know if you can do it with build steps, but I've done it with two builds. The second one uses a finished build trigger pointing at the first. Finished build triggers can be configured to fire even if the first build failed.

Upvotes: 0

Related Questions