Run Condition based on a variable value and previous step success

I have a step with a Run Condition that looks like this:

#{if IsTestRun == "False"}True#{else}False#{/if}

That condition works fine. But also need it to only run when the previous steps succeed.

I looked for a system variable that I could check to know if all the previous steps had succeeded, but I could not find one.

The only thing I could see was the Octopus.Step[StepNameHere].Status.Code == "Failed" variable.

But I can’t see any way to check two things in an #{if} statement. (There don’t seem to be any and / or operators that I can see in the documentation.

Is there some other way to merge the Success: only run when previous steps succeed option and the variable option for a Run Condition?

I should have thought about this a bit more before posting.

I can just nest the if statements together:

#{if IsTestRun == "False"}
	#{if Octopus.Step[Sanity Check].Status.Code == "Succeeded"}

Of course when I put it into octopus I have smash it down:

#{if IsTestRun == "False"}#{if Octopus.Step[Sanity Check].Status.Code == "Succeeded"}True#{else}False#{/if}#{else}False#{/if}

Hi @OctopusSchaff,

Glad to see that you found a way to get this working.

Another option would be to use the Octopus.Deployment.Error variable as shown here.


1 Like