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?
You should be able to fail with a combination of $LastExitCode
is non-zero and Exit 1
.
Couple googled up links:
P.S. I'm sure you aware, but just a reminder that a release in Octopus is snapshotting the version of variables, scripts, packages, etc. So would need to create a new release and/or packages.