Auto-deploy newly created deployment target using always the same channel

Hi everyone,

We have the following setup:

  • Configured AWS Auto Scalling groups and a newly created instances register in the Octopus automatically
  • Automatic deployment for newly created instances with Deployments->Triggers
  • 2 Channels in our project. Let’s call it “simple”, and “extended” which has some additional steps

Developers usually deploy with “simple” channel, but let’s assume:
A developer deploys a package with “extended” channel selected. Then we terminate an instance or extend our Auto Scalling group, so that a new instance is created, registered in the Octopus and a package is auto-deployed. But, the package is deployed with “extended” channel (because it was last used) and additional steps are executed. We would like to auto-deploy newly created instances always using “simple” channel to avoid running additional steps from “extended” channel. How can we obtain that? Any help will be appreciated.

Potential solutions I was thinking about:

  • Add a step that fails at the end of “extended” channel process, so that the “simple” channel will be triggered to auto-deploy, but that way the latest version from “simple” channel is deployed, not the latest from both channels.
  • Create a new project for auto-deployment which will have the steps from “simple” channel only. But not sure how to point the auto-deployment project which version to use - in other words - which version is the latest from the main project. Also which step template to use here (“Deploy Child Octopus Deploy Project” / “Chain Deployment” / “Deploy a Release”)
  • Trigger deploy with “simple” channel always when the “extended” channel finishes.

Additionally, we have several environments and several target roles are used during the deployment.

Thank you for any replies.

Hey Jord,

I have a few ideas I want flesh out and build a sample for. I’ll carve out some time tomorrow and put together a sample or two. It might take me some time to get it all together. I wanted to let you know so you didn’t think this fell into a black hole. :slight_smile:

Best regards,

Thank you Bob, really appreciate!

Hi Jord,

Bad news first, you cannot change a channel once a release has been created. In this scenario:

A developer deploys a package with “extended” channel selected. Then we terminate an instance or extend our Auto Scalling group, so that a new instance is created, registered in the Octopus and a package is auto-deployed. But, the package is deployed with “extended” channel (because it was last used) and additional steps are executed.

Because the latest release used the extended channel, any deployment target trigger will use the extended channel.

The good news is this shouldn’t require you to create new projects or have failures in your process. I think we can accomplish your requirements using a variable run condition.

I’ve put together a sample for you to look at here: Octopus Deploy

I have two channels: Default and Extended

My deployment process:

Make note that step 2 only runs on the extended channel.

When I deploy a release manually to the extended channel both steps run as expected.

However, I have step 2 configured to only run on the extended channel AND it has a variable run condition:

That project variable is set to:

Or #{unless Octopus.Deployment.Error}#{unless Octopus.Deployment.Trigger.Name}True#{/unless}#{/unless}.

What that says is only run this step when there is no error AND the deployment was triggered manually.

When a machine is added by a trigger I see that step is skipped:

Hope that helps!

1 Like

Wow! Thank you Bob! I’ll give it a try and get back, but it looks very promising

Happy to help!

That worked for me as well! Thanks again Bob!

One question - the variable “Octopus.Deployment.Trigger.Name” has a value “True” if and only if the job was triggered manually, is that right?

This value #{unless Octopus.Deployment.Trigger.Name}True#{/unless} is a double negative, which is always fun.

What that is saying that when Octopus.Deployment.Trigger.Name has a value then return False. When it doesn’t have a value return true.

The only way for Octopus.Deployment.Trigger.Name to have a value is for it a scheduled trigger or deployment target trigger to fire.

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