Make a deployment wait until another deployment is ready


We have two projects that we don’t want to be able to deploy at the same time. Is there a way to make the following:

  • User deploys Project A on Environment A
  • User tries to deploy Project B to Environment A, but gets a message that another deployment is in process
  • When Project A has been successfully deployed to Environment A, Project B’s deployment begins

Hi Boyan,

Thanks for reaching out. The only way to do this at the moment would be adding an API script as the first step of each project that check’s if the other project is currently running a deployment or not.

You could build that script only by hitting the /api/dashboard endpoint. This would be a great starting point:

$OctopusAPIkey = $env:OctopusAPIKey
$OctopusURL = $env:OctopusURL
$header = @{ "X-Octopus-ApiKey" = $octopusAPIKey }

$dashboard = (Invoke-WebRequest $OctopusURL/api/dashboard -Method Get -Headers $header).content | ConvertFrom-Json

#Use this to get the name and ID of the Project you want to look for

#Use this to get the name and ID of the Project you want to look for

#This collection will hold all the deploments that are currently on the dashboard. Check for deployments that are running at the moment

Hope that helps,

Hi Dalmiro,

Thanks for the quick reply. This sounds like a way to do it. Do you know if it is possible to make this step “wait”, i.e. pause the deployment and repeat itself on regular intervals, say every 10 secs, and when possible to continue the deployment process?


Hi Boyan,

You would need to wrap it into a Do - While loop. Make sure to wait a couple of seconds after each loop to avoid calling the API to check the deployment status too often. Something like start-sleep -seconds 15 should do.