Packages & Releases - Best Practice with TeamCity

Hi Guys,

Apologies if this has been asked before, but I am looking for best practices approach to do releases with Octopus from multiple branches that TeamCity can be set to monitor and build.
For example our Octopus instance is new and previous release have been done from TeamCity as the last step of a build.

Now TeamCity publishes the packages to the Octopus repository fine and we have been releasing to our DEv/UAT environments however at present I just created a release branch for an upcoming release and I am not sure what is the best approach to have separate packages for this release?

Apologies if I am missing something obvious but I am looking for help as I am not sure what is the best approach…

Many thanks in advance!

Hi Emil,

Thanks for reaching out! The overall recommendation when working with branches in source control and channels in Octopus goes something like this:

  • Customize your TC builds so when it builds a branch with [BranchName], it also creates a package with a tag referencing the name of the branch, like MyApp.1.0.0-[BranchName]

  • In Octopus, create a Channel per branch, and set a rule on the channel so it only picks up the packages that belong to the branch you want to deploy to it.

  • Finally, back in TC, in your Octopus Deploy: Create Release step, pass the name of the channel you want to deploy to using the --channel parameter (see attached screenshot). This will of course have to change depending on the Branch you are building, which will require son TC logic on your side.

In our Channels walkthrough we have a description of a scenario very similar to yours that I’d recommend you to check:

Hope that helps!

Hi Dimiro,

I did go through your walkthrough and I am glad to discover I am already on the right path with the TeamCity multi-branch building approach.

A number of gotchas I came across were related to OctoPack Error: <>…is not a valid version string - where my branch name was:
“2017-07-branchname” - the problem here I thought were the dashes
"201707branchname" - again invalid because it starts with digits
"branchname201707" - finally worked

I understand the above issue is dependency on the NuGet implementation of SemVer 2.0 for which there is an open issue here:

Many thanks for your comprehensive answer - I’ll experiment with version rules and most likely setup a channel as recommended!

Thanks again!

Glad I could help Emil!