Create and deploy a release trigger failing if release already exists

We require the following behaviour for a trigger:

Create a release using the specified channel, if the release doesn’t exist.
Deploy the latest release for the specified channel.

We would like to use a single trigger for this but the issues we have are:

  1. The “Create and Deploy a release” type of trigger will raise an error and fail if the release already exists, therefore not proceeding to deploy the existing release anyway.
  2. The “Deploy latest release” trigger will not create new releases (as expected)

At the moment the only way we have been able to do this is by creating both types of trigger, one after the other (a few minutes later) to ensure the different scenarios are covered. This is not ideal as in some scenarios we have duplicate deployments and in others, one of the triggers will raise an error.

Is there any way to achieve this with a single trigger or without the errors and duplication of deployment.

NOTE: We are not using the built in package repository so can not use the automatic release creation feature.

Good afternoon @khalilfinlay,

Thank you for contacting Octopus Support and welcome to the forums!

From what you described I do not think there is a way to do this in one trigger. I will re-assign this ticket to our Advice team though as they may know of an easier way to do this for you.

Kind Regards,


Hi @khalilfinlay

As my colleague Claire already mentioned, the existing triggers work individually the way they are designed; they can’t be combined using a built-in trigger mechanism.

One thing I wasn’t sure about from your description of the desired behavior was:

creating a release using the specified channel, if the release doesn’t exist

This implies that you would specify the release version you want to be created. That’s not possible using either of the scheduled trigger options, so I wasn’t sure how that might work for your setup, but it’s possible I’ve misunderstood your exact scenario :slight_smile: .

The only solution I can think of that can be done within Octopus is to script your desired behavior e.g. look for a release in a specific channel, if it doesn’t exist create it etc using an Octopus runbook.

The runbook would call into the Octopus REST API and then make the necessary calls that you require.The runbook snapshot could be published, and then a scheduled trigger could be executed at the frequency of your choosing. One downside to this approach is the need to specify a trigger per channel you want a release created for.

Another spin on this is doing this outside of octopus with a scheduler of your choosing.

Hope that helps!