Distinguish aborted manual intervention from deployment failure

Hello, we are using octopus cli/Jenkins plugin in our pipelines and one of our deployments requires a manual intervention to validate a terraform plan. We usually wrap octopus requests in a retry block in case of random failures/octopus server updates/redeployment.

Is there a way to distinguish an aborted manual step from any other reasons for a failed deployment? We would like to cancel the retry for an aborted manual intervention and from what I tested octopus cli returns code 255 in both this case and deployment failing due to a server error.

Hi @dagl,

Thanks for reaching out and welcome to the Octopus Forums!

I think the best path forward here to distinguish between a failure and an aborted deployment would be to use the API to look at the server task for the deployment and wait for it to finish. Once it is finished, if it failed, check the interruptions and see if it was aborted.

Here is an example:
ServerTask JSON ( /api/tasks/ServerTasks-#######)

Interruptions JSON (/api/Spaces-82/interruptions?regarding=ServerTasks-#######)

So your algorithm would be something like:


deploy the release
$tasksuccess = false
API call to get servertask
while ($completed -eq false){
wait x seconds
API call to servertask to see if it's completed (if it is, set $completed to true, set $tasksuccess to reflect what's in the JSON)
if $tasksuccess -eq true, do your actions you want if it's successful
else, go to the interruptions for that task and find out if it was an Abort or a general deployment failure. (You will want to iterate every Item in the interruptions JSON and get Form.Values.Result to see if any of them were Abort)
Then at this point you would have your differing logic based on if it was aborted or failed.

Please let me know if that helps or if you have any questions.



This seems to work, thanks. Too bad we have to do it in such a roundabout way, would be nice if octopus cli just returned a different code for manually aborted deployments.

Hey @dagl,

Thank you for letting me know that it worked for you!

I agree that would be a cool feature. I’ll pass along the feedback and maybe it will be something Octo vNext can have!

I hope you have a great rest of your week, and please let us know if you run into any other snags in the future.


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