Channel priorities when release matches multiple version rules

Hello,

I’ve used channels before in Octopus to manage deployments, but not really done much work with creating and configuring them, so there might be a simple answer to this question.

As background I have two channels in my project, with the goal being that most releases should be created in the default channel, but “development-v2” releases should be created in a “development-v2” channel to allow for different variables and values to be scoped into the deployments.

I’ve currently got this:

+ Channel: Default
    + <no rules>
+ Channel: development-v2
    + Version Rule 1
        + feed type: Nuget Feed
        + version range: 0.0.0
        + pre-release tag: development-v2-

My “development v2” release names are in the format “x.y.z-development-v2-nnnn” - e.g. “0.1.0-development-v2-2259” and the Version Rule matches this fine, but when I create a release using the TeamCity “Octopus Deploy” plugin I see this in the logs:

[09:31:59][Octopus Deploy] Creating Octopus Deploy release
[09:32:00][Octopus Deploy] Octopus Deploy Command Line Tool, version 4.43.0
[09:32:00][Octopus Deploy] 
[09:32:00][Octopus Deploy] Detected automation environment: "TeamCity/2018.2.1"
[09:32:00][Octopus Deploy] Handshaking with Octopus Server: https://myoctopusserver
[09:32:00][Octopus Deploy] Handshake successful. Octopus version: 2018.10.0; API version: 3.0.0
[09:32:00][Octopus Deploy] Authenticated as: myserviceaccount <null> (a service account)
[09:32:00][Octopus Deploy] This Octopus Server supports channels
[09:32:00][Octopus Deploy] Finding project: My Project
[09:32:00][Octopus Deploy] Automatically selecting the best channel for this release...
[09:32:00][Octopus Deploy] Building a release plan for Channel 'Default'...
[09:32:00][Octopus Deploy] Finding deployment process...
[09:32:00][Octopus Deploy] Finding release template...
[09:32:00][Octopus Deploy] Building a release plan for Channel 'development-v2'...
[09:32:00][Octopus Deploy] Finding deployment process...
[09:32:00][Octopus Deploy] Finding release template...
[09:32:01][Octopus Deploy] Selected the release plan for Channel 'Default' - there were multiple matching Channels (Default, development-v2) so we selected the default channel.
[09:32:01][Octopus Deploy] Using version number provided on command-line: 0.1.0-development-v2-2259
[09:32:01][Octopus Deploy] Release plan for My Project0.1.0-development-v2-2259

The result is that the “Default” channel gets selected because both channels match the release name, but Octopus prefers the channel that has the “default” flag (see there were multiple matching Channels (Default, development-v2) so we selected the default channel. in the logs).

I’d prefer to keep the channel logic in Octopus rather than having to specify the channel name in the TeamCity build step, and It seems like what I’m trying to do isn’t that unusual, but I’m not sure how to set it up. Any help appreciated…

Thanks,

Mike

Hi Mike,

Thanks for getting in touch! You’re correct that if you have multiple channels that match, the default will get precedence over the other. This sparked a conversation with my team, and we’re currently thinking that perhaps a change should be made to allow a sort of “channel specificity”, where a non-default channel that has version rules defined should be selected over the default channel with no version rules when both match.

To address your scenario right now, you may want to add in a version rule on the default channel to exclude pre-release tags (or something similar) in order to force the non-default channel to be the only one matching. You can use the regex ^$ on the pre-release tag section of your default channel to prevent any pre-release versions from being created in it.

Does that help for the time being? Let me know what you think or if you have any further questions or concerns moving forward. :slight_smile:

Best regards,

Kenny

Hi Kenny,

Thanks for the response.

I’ll give your suggestion a try later today, but i think it might have a problem we we’re using GitVersion in TeamCity to generate build / release numbers and that generates pre-release versions for all our feature branches - e.g.

“0.1.0-feature-abc-50”
“0.1.0-feature-xyz-100”
“0.1.0-unstable-50” (default GitVersion pre-release tag for “develop” branch is “unstable”)
“0.1.0-development-v2-250” (default GitVersion pre-release tag for “develop” branch is “unstable”)

We only want the “development-v2” branch / pre-release tag to be filtered to the “development-v2” channel and everything else should go to the default channel. I’ll look into the exclude ("!") options and maybe just try to exclude “development-v2” from he default branch and see how far I get.

Cheers,

M

In terms of your specificity idea, maybe make the list of Version Rules sortable like process steps are, and just use the first matching rule in the list, and if no rules match then fall back to the default channel.

That’d probably be a breaking change for existing version rules though so you might also need an opt-in checkbox to “apply new version rule processing” or something…

Cheers,

M

To follow up, adding “^$” as the tag regex fixes the original problem but adds a different one.

New channel definitions:

+ Channel: Default
    + Version Rule 1
        + feed type: Nuget Feed
        + version range: 0.0.0
        + pre-release tag: ^$
+ Channel: development-v2
    + Version Rule 1
        + feed type: Nuget Feed
        + version range: 0.0.0
        + pre-release tag: development-v2-

Release “0.1.0-development-v2-2267” got correctly created in the “development-v2” channel, but other pre-release tags now give an error message because it’s not falling back onto the default channel.

[12:50:41] **[Octopus Deploy]* Creating Octopus Deploy release*
[12:50:41] **[Octopus Deploy]* Octopus Deploy Command Line Tool, version 4.43.0*
[12:50:41] **[Octopus Deploy]**
[12:50:41] **[Octopus Deploy]* Detected automation environment: "TeamCity/2019.1"*
[12:50:42] **[Octopus Deploy]* Handshaking with Octopus Server: [https://myoctopusserver](https://myoctopusserver/)*
[12:50:42] **[Octopus Deploy]* Handshake successful. Octopus version: 2018.10.0; API version: 3.0.0*
[12:50:42] **[Octopus Deploy]* Authenticated as: TeamCity <null> (a service account)*
[12:50:42] **[Octopus Deploy]* This Octopus Server supports channels*
[12:50:42] **[Octopus Deploy]* Finding project: My Project*
[12:50:42] **[Octopus Deploy]* Automatically selecting the best channel for this release...*
[12:50:42] **[Octopus Deploy]* Building a release plan for Channel 'Default'...*
[12:50:42] **[Octopus Deploy]* Finding deployment process...*
[12:50:42] **[Octopus Deploy]* Finding release template...*
[12:50:42] **[Octopus Deploy]* Building a release plan for Channel 'development-v2'...*
[12:50:42] **[Octopus Deploy]* Finding deployment process...*
[12:50:42] **[Octopus Deploy]* Finding release template...*
[12:50:43] **[Octopus Deploy]* There are no viable release plans in any channels using the provided arguments. The following release plans were considered:*
[12:50:43] **[Octopus Deploy]* Channel: 'Default' (this is the default channel)*
[12:50:43][Octopus Deploy]   #   Name     Package Name  Version               Source           Version rules          
[12:50:43][Octopus Deploy]   --- -------- ------------- --------------------- ---------------- ---------------------
[12:50:43][Octopus Deploy]   1   My Step                0.1.0-feature-abc-50  User specified   Range: PASS Tag: FAIL  
[12:50:43][Octopus Deploy] 
[12:50:43][Octopus Deploy] Channel: 'development-v2'
[12:50:43][Octopus Deploy]   #   Name     Package Name  Version               Source           Version rules          
[12:50:43][Octopus Deploy]   --- -------- ------------- --------------------- ---------------- ---------------------
[12:50:43][Octopus Deploy]   1   My Step                0.1.0-feature-abc-50  User specified   Range: PASS Tag: FAIL  

[12:50:43][Octopus Deploy] This error is most likely occurring while executing Octo.exe as part of an automated build process. The following doc is recommended to get some tips on how to troubleshoot this: https://g.octopushq.com/OctoexeTroubleshooting
[12:50:43][Octopus Deploy] Exit code: -1
[12:50:43][Octopus Deploy] Octo.exe exit code: -1

Cheers,

M

I’ve managed to fudge it as follows, but it’s basically limited to two channels:

+ Channel: Default
    + Version Rule 1
        + feed type: Nuget Feed
        + version range: 0.0.0
        + pre-release tag: ^(?!development-v2-)
+ Channel: development-v2
    + Version Rule 1
        + feed type: Nuget Feed
        + version range: 0.0.0
        + pre-release tag: development-v2-

Default now gets everything except the “development-v2-” pre-release tag (i.e. release versions and all other pre-release tags), and the “development-v2” channel gets only the “development-v2-” pre-release tag.

It’s be good to know if there’s a cleaner way of doing this.

Cheers,

M

Hi Mike,

Thanks for following up! Great to hear you’ve been able to get a working solution going. Ideally we’d aim to have no overlap between the channel version rules, so whenever a release is created only a single channel is applicable for it to be created in. This means that I think your current working solution is the best currently available one.

Let me know if there’s anything else we can assist with. :slight_smile:

Best regards,

Kenny

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