TFS branching and Teamcity build and octopus deploy

We have TFS environment based branches. We have dev main release and hotfix.

Our octopus life cycle mandates that the code first be deployed into dev environment then into test env then into staging and then into production.

We develop in dev tfs branch and we have a Teamcity build that targets Dev branch and then triggers octopus deploy to deploy into Dev environment. But once dev testing is complete, we need to merge the code to Main branch and its from Main branch that we deploy it to test environment and then to staging and then to production. So the code that is in dev never goes to Test and stangig and production environments. How do it mange teamcity and octopus deploy in this scneario?

Option

Have a separate build in Teamcity for Dev branch called as dev branch build and have a separate project in ocotopus deploy for dev branch and have a separate lifecycle where the code is deployed only to dev environment

Have a separate build in Teamcity for Main branch called as Main branch build and have a separate project in ocotopus deploy for Main branch and have a separate lifecycle where the code is deployed to Test environment first then to Staging and then to production.

Any other options suggestions?

How do i define the build and deployment in this case?

Hi,

Thanks for getting in touch! It looks like you could use some Channels! You can set up Channels in Octopus to help you manage branching and versioning within the project, while using Lifecycles to direct the deployment phases for those different Channels.

You able to set up different Channels for each branch that you wish to have a different Lifecycle. Each Channel given a Lifecycle, and when you select a certain Channel the corresponding Lifecycle is will be used for the release.

For example, if you wish to have a hotfix Channel, you can create a Lifecycle that will deploy directly to a particular Environment. You can then set the new hotfix Channel to have your shortcut Lifecycle.
From here you are able to create a new release and select the hotfix Channel, deploying directly to the environment in that Channel.

Once you have created the Channels and assigned your Channels a Lifecycle you can set up some rules for what release qualifies for what Channel.
We have a lot more detailed information on how you can set these up and manage them in the following documentation.

We also have a large blog post providing a full Channels walkthrough that may interest you.

Let me know if that helps, or if you have any further questions, we are always happy to help. :slight_smile:

Best regards,
Daniel