I'm using a customcommand (batch file) in GoCD to build my solution with MSBuild. Now I wan't to be able to set an error in the batch file so the GoCD agent knows it can stop because something failed. Now when the build fails the job is still successful.
How can I thow an error that is catched by GoCD?
You have to exit the batch script with an exit code != 0, for example with EXIT /B 1
.
The go agent interprets any exit code other than zero as an error, and in the default configuration, an error prevents subsequent tasks and stages from running.