Deployment steps via API

Aloha bros!

My question regards ability to select steps to be executed while creating/running a deployment via API. I absolutely can not find any documentation regarding “-Body” switch for “/api/deployments -Method Post”. This is a big gap in the docs (which i noticed lack details like this making my job …complicated) !

Since Octopus has no ability to deploy arbitrary selected projects sequentially (without scheduling) i need to write a custom powershell script to do the same. I would have thought daisy-chaining project deployments would have been one of the must have features. We have 140 active projects in Octo but due to their nature no guarantee how long each deployment will take.

Any suggestions will be greatly appreciated!
A solution will be reciprocated with a cake!

Suggestions?

Hi There,

Thanks for reaching out!

Octo.exe has a --skip parameter to do exacly that. Way better than writing your own script.

Let me know if that helps so I can give you the addresse(s) for the cake(s)

Cheers,
Dalmiro

Great! I’d prefer using the API and not call octo.exe directly but i can switch.
Now where is the documentation for that parameter? The only thing i saw on it was:
–skip=VALUE [Optional] Skip a step by name

What format VALUE should be in if i want to skip 4 ouf ot 6 steps?

And just in case i have to ask if the API has an equivalent of --skip?

oh and i do have to use a script, octo.exe will not provide me with a in-progress status of the deployment which i need to know in order to queue the next one sequentially. Our projects can not go in parallel and we cant’ combine them.

Octo.exe calls the API just like the web portal does. There’s really no benefit in using a custom script which is more prone to have errors than a command line tool that we developed.

  • To skip a step named “Step 1” --Skip="Step 1"
  • To skip 2 steps named “Step 1” and “Step 3” --Skip="Step 1" --skip="Step 3" (one --skip per step)

If you wanna see the progress of the deployment you can pass --progress which will also be useful at It will return a non-0 exit code if the deployment fails.

Now, if you are an API junkie like me and you desperately want to do this via API. Here’s a script for you: https://github.com/OctopusDeploy/OctopusDeploy-Api/blob/master/REST/PowerShell/Deployments/CreateReleaseAndDeploymentSkippingSteps.ps1#L33

Pro tip: If you don’t know how to do something with the API, do it from the Web portal (or using Octo.exe like I did in my example) and check the API calls that were made. On the attached image I’m showing how I figured out (because I totally don’t remember this stuff) how to add the right property to the request body only by running Octo.exe and checking the API calls with Fiddler.

We are totally aware that we are lacking some good documentation for the API, and its something we plan on doing in future releases. The main blocker is that API docs cannot be written manually as they will get old the week after. So they need to be programatically generated using somthing like Swagger, and to use those tools we need to step away from NancyFX and move into something like WebAPI, which will take some serious engineering effort. Still, we will do it.

Perfect, this will work for me. I do prefer the API so i will look into it but the command line will do for ta short term solution. I have used the script you referenced as my starting point, glad to see the update!

Where should i send the cake?

Glad to hear that works!

Let’s do this: Instead of sending the cake, share your Octopus love to your fellow .NET devs. We would really appreciate that :slight_smile:

Cheers