Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TeamCity step needs to be skipped on build failure condition

From my observations around how TeamCity works, I noticed that build failure conditions are evaluated after all the steps are done executing. This is quite annoying because I can't have a step which would not execute if any of the build failure conditions have met.

I'm not referring to the common build failure conditions, such as "at least one test failed". I'm referring to the manually added failure conditions such as on metric change.

When I check the build log, I clearly see that all the steps are executed, and only in the end it evaluates the build failure conditions, and logs the respective errors if any. But that's too late in the process as the conditional step (which had to fail based on "Execute Only if build status is successful") has already executed.

Question: how can I achieve this?

As you can see from the above, I already tried to have a conditional step and added the build failure condition, but cannot achieve the desired result.

Addition for clarity:

Basically, I have a step which deploys the application. However, my expectation is that I should not deploy if the build failure conditions are met. Example of build failure conditions that I have is on metric change. Obviously, this I can express as build failure condition, and I can have the build step that fails in case build status is not successful. However, it seems that's not how the build step is going to behave, so I'm puzzled (I thought that's the purpose of the condition on the build step). What am I missing?

like image 643
Tengiz Avatar asked Feb 16 '16 18:02

Tengiz


Video Answer


2 Answers

The build and deployment 'build configurations' should be separated.

If the build 'build configuration' completes successfully (without activating the failure conditions) then this would trigger the deployment 'build configuration' to run.

like image 124
LittleDebugger Avatar answered Oct 11 '22 06:10

LittleDebugger


The recent versions of TeamCity have an option "Execute step" with "Only if build status is successful" - and this option should consider build failure conditions on the server as well.

like image 27
KIR Avatar answered Oct 11 '22 06:10

KIR