One project - two channels, two packages

Hello

I have a project inside a group

The project has two channels :

Channel A
Channel B

Both channels have different lifecycles to deploy to different targets, with different environments

Environments are:

Channel A - Dev - contains machine A
Channel B - Test - contains machine B

I need to deploy packages according to the channel being chosen.

Package A would go to machine A if choosing channel A
Package B would go to machine B if choosing channel B

Both my packages are inside the Octopus feed.

I have taken a look at the below page:

However I don’t feel this works in this scenario.

My issue has stemmed from the fact that I am dependent on the Octopus project name variable to create my websites and backups etc, and am unable to create two projects with the same name in different groups.

Any help would be much appreciated

Thank you

Hi @supafly270

Thanks for getting in touch with Octopus!

Based on your scenario, I think you can achieve deploying Package A to any machines in the environment applicable to Channel A and deploying Package B to any machines in the environment Channel B using a variable which is scoped to each Channel (https://octopus.com/docs/deployment-process/channels).

For this, you can continue to use your one project - I’ve created one called Channel-Based-Packages

Once you have set-up your Channels to include the relevant environments, I added a variable called WebsitePackageID

I have scoped PackageA to Channel A, and scoped PackageB to Channel B.

I then added a Package Step to the Deployment process and bound the variable WebsitePackageID to the PackageID property:

Next up, when creating the release for Channel A, Octopus already knows which package you need:

When creating the release for Channel B, Octopus selects PackageB correctly:

From the Project Overview screen, Octopus knows which Environments are associated with each Channel:

  • Channel A can only deploy to Development
  • Channel B can only deploy to Test

image

Deploying release 0.0.1 to Channel A shows PackageA being chosen:

Finally deploying release 0.0.2 to Channel B shows PackageB being chosen:

Just a couple of notes on your scenario in general:

  1. If the application packages you are deploying are genuinely different, e.g unrelated websites, you could have 2 projects with different names. If you rely on a common name for the website and backups etc, you can create a common Library Variable Set (https://octopus.com/docs/projects/variables/library-variable-sets) and add to each project and use that in your projects instead of using the built-in one for the project name.
  2. If you didn’t want to use variables at all, you could have each step in a single project and hard-code the package names in each step, and scope the deployment step to each channel (see screenshot below). This isn’t my preferred option, but letting you know about it for complete transparency on options available.

Choosing a Channel condition on a step

Hope that helps!

Hello

Thank you for the response.

However, I am still struggling to make this work.

I can define the scopes for the channels in the variables but how do I define the actual package in the variable?

I have set up the variable as below which must be incorrect as when I create a release all it has in the package is #{Packages}

Please let me know if the above image doesn’t load and how I need to set up the variable or quite possibly the channels again

Thank you

Hi @supafly270

Can you confirm which version of Octopus Server you are using?

You should be able to simply specify the name of the package in the variable.

So in your screenshot, in the Value box, enter the Package name.

Then define the Scope using the DEFINE SCOPE button and link it to the respective channel.

Then you can do the same again for the other channel.