I’m looking to create a run condition on a Runbook step that will only run if the variable expression evaluates to true AND the previous step succeeds.
I’ve seen other posts about this but they don’t seem to work in for me.
I might have a syntax error so I’ve pasted my exact syntax below.
Thanks for getting in touch! Great question, and I did some testing to confirm, and Octopus.Deployment.Error variable does indeed work with runbooks. As far as the syntax goes for multiple conditions like this, I was able to get it working with the following nested if/unless statement, where the condition only evaluates to True when both the prompted variable IsExistingInstance evaluates to True, and previous steps succeed. Either one of those failing causes the condition to evaluate to False.
Thanks for following up so quickly! I’ve given this another test run and it works as expected with a checkbox prompted variable as well in my local instance (running 2020.2.13). Which version of Octopus are you currently running? If it’s older than 2020.2.3 and the prompted variable is scoped to a process (i.e. the runbook), then I would guess you’re hitting this known bug (fixed in 2020.2.3).
If that matches, you’d need to remove the process scoping on the prompted variable, or an upgrade will get it working as is.
If that doesn’t match your scenario, could you send through a verbose task log from a run exhibiting this issue? That should help point us in the right direction.
Thank you for following up and confirming that! That’s great to hear it’s working as needed now. If you have any questions or concerns going forward, please don’t hesitate to reach out.