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?