3

I'd like to halt remaining build steps at a step.

Both official document and so answer guide to do as below;

echo "##teamcity[buildStatus status='SUCCESS' text='Automation disabled']"

But to make halt builds at the step, I think I should put exit 1 at the end. But this exit code gives red Failed result due to the Failure Condition; 'one of build steps exited with an error (e.g non-zero exit code)'

My trial is as below;

echo "##teamcity[buildStatus status='SUCCESS' text='Automation disabled']"
exit 1

how to make it show the green success result?

The document says 'You can also change the build status of a failing build to success' but not working as expected.

Both version 2017.2.3 and 2018.1.4 tested.

Youngjae
  • 24,352
  • 18
  • 113
  • 198

1 Answers1

1

On Microsoft ecosystem, Exit Code 1has a meaning of: error and not true.

you are simply setting up the status from FAILURE (possibly) to SUCCESS using the message queue, then setting it back to FAILURE by doing an exit 1. If you switch your exit 1 to exit 0, it should turn green.

EDIT:

Let's say you have x (A, B (...), F) build steps inside your build configuration.

You can define the exit code 1 at the end of the build step A.

You can define the build step B only if A, the previous build step, is successful. (Only if build status is successful) - then, it will not run if the exit code is one.

You can define the build step F to run Even if some of previous steps failed. And this build step will send to the message queue echo "##teamcity[buildStatus status='SUCCESS' text='Automation disabled']"

So, your build will be marked as a success, but your build step B will not be executed.

Didier Aupest
  • 3,227
  • 2
  • 23
  • 35