Manually Failing a Deployment


#1

I’m building a docker image, pushing to GCR then upgrading our pods in kubernetes.

It’s all working well although I need to somehow exit and fail the build if something goes wrong.

For example, occasionally a push to GCR goes wrong or perhaps the image doesn’t build properly.

Am using some basic if / else to do this but I can’t see how I can fail the test if something goes wrong.

For example, if a container fails to build, I need to exit and mark the deployment section failed so I get a message.

Is this possible?


#2

Running a command that returns anything different than 0 to the shell will mark the build as failed. For example, you could use exit 1.


NPM exit code 1
#3

Worked a treat, cheers.


#4