Run a step when the Manual step aborts, but not when any other error occurs

I have a fairly large Runbook that handles swapping Kubernetes clusters. On Step 6, I have a “Manual Intervention Required” step for sanity testing. The idea is that operator goes and checks that it all looks good. If it does not then they select “Abort”. At that point I need to do a few rollback steps.

I had put a “Rollback” step in as Step 7 (after the Sanity Check step). I set its “Run Condition” to “Failure: only run when previous steps fail”. That worked fine for a bit.

But then I had an error on my first step, and “Rollback” step fired. I realized that the Run Condition is not looking for just the previous step to fail, but for any step to fail.

I realize that I need a way to know if the “Sanity Check” manual intervention step had abort or proceed selected, so I can run my rollback step based on just that.

How can I know if a Manual Intervention step has had “Abort” selected?

Hi @OctopusSchaff,

Thanks for getting in touch, and great question! An abort on a manual intervention step marks the step in the deployment as Failed, so I believe you would want to tie the run condition of your Rollback step to this status code system variable.

E.g. in my test I set the Rollback step to have a variable run condition of #{if Octopus.Step[Manual Intervention Required].Status.Code == "Failed"}True#{else}False#{/if}. When the first step fails, causing the manual intervention step to be skipped, the Rollback step is not run. However when the first step succeeds and the manual intervention is run, and I select Abort, Rollback is run. On selection of Proceed, Rollback is not run.

If I understand your requirements correctly, I believe this is the outcome you’re after? Let me know how you go, or if you have any further questions!

Best regards,

Kenny

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.