How to get child deployments based on release ID

Hi I thought I can get child deployments by

api/Spaces-1/releases/releaseID/deployments

however this gives me a deployment, for which when I access the interruptions for this deployment’s related taskID, the interruption text says

“child deployment of [release] (~app#/Spaces-1/deployments/deploymentId) requires manual intervention”

Which means this is the interruption for the parent deployment, when I in fact want the interruption for the child deployment.

How can I achieve this? thanks

Hi @alicia09,

If I have understood your question correctly, and you are looking for the interruptions on your child deployments, then you could look at the following endpoint:

/api/{spaceId}/interruptions?regarding={deploymentId}

(Where “deploymentId” is the ID of the deployment from you parent deployment project).

Here you can get the interruption ID(s) that relates to your child deployments and use with the following endpoint:

/api/{spaceId}/interruptions/{interruptionId}

Just for reference with the interruption endpoint:

  • GET {spaceId}/interruptions
  • PUT {spaceId}/interruptions/{interruptionId}/responsible (with an appropriately permissioned API Key)
  • POST {spaceId}/interruptions/{interruptionId}/submit (with a JSON body instruction for the action to take)

To note here, when you are orchestrating a deployment using the “Deploy a Release” step (if this is what you are doing), Octopus will create a new deployment for each child deployment, giving them a unique deployment id.

Currently from what I can see, you can’t get the deployment ID for each child deployment from the parent deployment using the REST API, except from the elements:text key (I may need to do a bit more digging).

If I have misunderstood your question, then please do let me know.

I hope this helps

Regards
Doug

Hi Doug!

So rather than complicate things by looking at each child deployment to retry guided failures, and then look at the parent deployment interruptions, do you reckon I should simply look at the interruptions for the parent deployment?

And then check each of these interruptions for whether they are a guided failure or manual intervention? (How would I do this?)

And then simply take responsibility for and submit the interruption, where the request body will differ depending on whether it’s a manual intervention or guided failure?

Hi @alicia09,

Just to be up front, I am not 100% on your end goal is here. But using the interruptions from the parent deployment may work for you.

This can give you the id for each interruption within your parent deployment for you to work with.

From what I can see, you can’t appear to get the interruption id for the guided failure from the parent deployment.

Can I ask what it is you are looking to achieve here with the interruptions? Are you looking to automate responses to Octopus with manual interventions and guided failures via the REST API.

Are you creating/using an external tool to integrate with Octopus to manage interruptions externally to Octopus?

I think if I can understand your use case in more detail it may help to see if there are alternatives for you.

While I can’t find have a specific example for your scenario, I just wanted to point you to some of our examples when it comes to the REST API if this helps you in anyway.

In case you are not aware, you could also explore Swagger which may help, if you add /swaggerui/index.html to your Octopus URL, you can find this.

For example:

https://{YourOctopusUrl}/swaggerui/index.html

If this helps, as Octopus is written using the API a top tip that I use to quickly explore the REST API is to use the developer tools within my browser when using Octopus to see the request Octopus makes:

If you use the Response tab, you can view the response Octopus returns:

image

Here I can see what information is being returned to Octopus via the API.

I look forward to hearing from you.

Many Thanks
Doug