In one of my Octopus Deploy steps, I have a Powershell script called PostDeploy.ps1 that runs correctly, except that if it encounters an exception, the deployment continues as though it succeeded.
I've seen a few posts about the problems of powershell exit codes, but I can't find a solution for the particular problems of PostDeploy scripts.
How can I force a step to be marked as failed if PostDeploy encounters an error?
| Out-Hoston the executable call, and then do an if-check on$LastExitCode -ne 0