I have a step in TeamCity where it tests a deploy first before executing the next step(which has a "Execute:if all previous steps finished successfully" option selected). I used .deploy.cmd script and passed /T switch to execute in test mode. The process returns with code 0 but the test deploy returns and error code.
How do I get it to fail and not go to next step? (below is the snapshot of the error)
Thanks,
You can use
Runner typePowerShellfor call your cmd script. When you use PowerShell you can use try-catch structure and return error code > 0 when your code get error.E.g.:
Where,
%TestArg%is yourConfiguration Parameter, and equals/Tor nothing. If your script returns some result, you can parse it and return error code manuallyNote: As it seemed to me the parameter
Format stderr output asis responsible only for the color of the display errors in build log. I use this solution for deploy database via SSDT (SqlPackage.exe), because it not abort building and next steps even in the case of an error