Octo.exe or API: can I deploy the latest release from a specified channel?

we plan to start using lifecycles and channels similar to the way is demonstrated on the channels video, i.e. one channel for QA only, one channel for Release Candidates, which will get promoted from Staging to Production (and beyond.) each environment really has 10 environments for our multiple tenants.

each night, we run a build for QA and for Staging and will create releases in each of the QA and Release Candidate channels. later (in the early morning hours), we use calls to octo.exe to deploy to the 10 QA sites and the 10 Staging sites.

with octo.exe, we can deploy a release and specify the latest release, but since we will have just created 2 releases, how can we specify to deploy the latest release from a particular channel (i.e. so we can deploy the latest QA channel release 10 times, and deploy the latest Release Candidate release 10 times)

thanks.

Hi Mike,

Thanks for getting in touch!

Octopus will choose the “latest” release for a project based on the version number of the release. Unfortunately this means just asking for the “latest” version will choose whichever version has a higher number from your channels.

If you have multiple channels and you want to target them specifically, you’ll need to keep track of the version number that was created for that channel and specify it explicitly.

Hopefully that helps!
Damo

I’m surprised that this isn’t something more people would want. In our case, the QA build will be building at least one minor version ahead of the Staging/Release Candidate build, so the QA release version will always be higher than the Staging release version.

does the list-releases api call specify the channel that each release belongs to in the results?

Hi Mike,

Thanks for that feedback. I’m inclined to agree that there’s something missing here.

If there was an additional --channel= parameter you could pass to the ‘deploy-release’ command would that solve your issue?

The /api/releases and /api/projects/{projectId}/releases API calls will return a channel Id along with the list of releases, so you should be able to use that in the meantime.

Thanks,
Damo

yes, adding --channel would do the job. thank you for considering the change.

Hi Mike,

I’ve created an issue in our GitHub for this addition so you can follow along.

Thanks,
Damo

I see octopus and octo.exe have been updated with this addition. thank you very much!

Hi Mike,

No problem! We move fast with some things :wink:

Damo

Hi,

Are you able to give an idea of when the TeamCity plugin will be updated to include/support this newer version of Octo.exe?

Many Thanks,
James.

Hi James,

The latest version of the TeamCity plugin has the fix for this.

Thank you and best regards,
Henrik

Hi Henrik,

Thanks for the reply.

I double-checked again today and v3.3.1 of the TeamCity plugin contains v3.3.8 of Octo.exe. (file info screenshot attached)

Assuming that I checked the correct file - below is the location inside the JAR of the file I checked:

agent\Octopus.TeamCity\Octopus.TeamCity\lib\Octopus.TeamCity.jar\resources\3\0\Octo.exe

Thanks,
James.

otcoexe-version-info.jpg

Hi James,

Yes, that is correct. Is there anything that isn’t working as you expect?

Thank you,
Henrik

Hi Henrik,

I think I’ve wandered down a path of red herrings, I’m afraid :slight_smile:

For some reason I’d understood that the change to the command-line tools that enables this support was included as part of 3.3.10, but I must have been looking at another issue as I now see is was part of 3.2.13.

I then conflated this with noticing that the ‘Deploy Release’ runner didn’t have a ‘Channel’ field (like the ‘Create Release’ runner does) and that the ‘Release number’ field was mandatory - I’ve now remembered that ‘latest’ is a valid version number!

Using ‘latest’ and specifying the ‘–channel’ switch works fine!

Sorry for wasting your time.

Cheers,
James.

Hi James,

Not a problem, glad you figured it all out.

Happy deployments!

Thanks,
Henrik

Hi

i am using channels to promote build from the CI environment to the QA environment but am getting the following error

[15:32:29]Running command: octo.exe promote-release --server http://octopusdeploy.britishcouncil.org/ --apikey SECRET --project Boss --enableservicemessages --from CI --deployto QA --progress --channel Main
[15:32:29]Promoting Octopus Deploy release
[15:32:29]Octopus Deploy Command Line Tool, version 3.3.16+Branch.master.Sha.47e0e502fcd994db2415887dc3bf8b3f248962a7
[15:32:29]
[15:32:30]Build environment is NoneOrUnknown
[15:32:30]Unrecognized command arguments: --channel, Main
[15:32:30]Exit code: -1
[15:32:30]Octo.exe exit code: -1

The version of octo.exe is 3.3.16 as seen in the debugging so it should contain the new channel feature.

Can anyone see what I am doing wrong here?

Hi Dino,

The --channel argument is not available (and not needed either) when promoting a release from one environment to another as the channel has already been specified when the release was created.

I hope that helps.

Thank you and best regards,
Henrik