Search code examples
octopus-deploy

On Octopus deploy, how do I run process step if any of previous steps has failed


I have a step that will send a message to Microsoft Teams when the deployment is successful, and I want to add another step that will send a message if there is an error in the deployment and one of the steps fails.

I've tried setting a condition on the step to Variable: only run when the variable expression is true with the expression being #{if Octopus.Deployment.Error != 0}#{/if}

I was under the impression that if a step fails the system variable Octopus.Deployment.Error will be different than 0

the version of Octopus Deploy that I am using is 3.11.11


Solution

  • Conditional logic isn't supported within the #{if} syntax. The variable will be evaluated and if it evaluates to a true value, then the value inside of #{if}#{/if} will be used for the condition.

    You can use this expression #{Octopus.Deployment.Error} for the run condition. If an error has been set, it will evaluate to true and the step will run. If there has not been an error, it will evaluate to false and the step will not run.

    I hope that helps!