Packages & Releases - Best Practice with TeamCity

Emil's Avatar

Emil

17 Jul, 2017 05:31 PM

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!
Emil

  1. Support Staff 1 Posted by Dalmiro Grañas on 18 Jul, 2017 05:00 PM

    Dalmiro Grañas's Avatar

    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: https://octopus.com/blog/channels-walkthrough#feature-branch-deploy...

    Hope that helps!
    Dalmiro

  2. 2 Posted by Emil on 18 Jul, 2017 09:45 PM

    Emil's Avatar

    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: <1.0.0.0-branchname>...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: https://github.com/NuGet/Home/issues/1359

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

    Thanks again!
    Emil

  3. Support Staff 3 Posted by Dalmiro Grañas on 19 Jul, 2017 01:53 AM

    Dalmiro Grañas's Avatar

    Glad I could help Emil!

    Cheers

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac