Halt deployment where an internal SQL script throws an exception

Hi

I had the following scenario during a recent deployment

I have a step which uses the invoke-sqlcmd to run a .sql script, which failed and was logged in the task log but the step itself did not fail and the deployment continued

Is there are way to halt the process where there is an internal script error?

Thanks
Declan

Hi Declan,

Thanks for getting in touch. Octopus will only fail a PowerShell script step if the final exit code is not 0. In other words, if your PowerShell script is managing the exception but returning a 0 exit code, Octopus will consider this a success. This is the most likely cause.

If that doesn’t help you discover the issue, we would really need to see the script to determine how that error is being handled.

Hope this helps!

Rob