Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

teamcity octopus deploy handling multiple code branches (default and develop) with same project name

At the moment teamcity is watching and building a mercurial develop branch using the AssemblyInfoPatcher plugin and Project.Website.2.x.x.x.nupkg turns up in artifacts and octopus is deploying this to a staging environment. awesome stuff.

Now I am just trying to get my head around how to set up octopus deploy to handle the default branch getting deployed to production as well now.

I have set up teamcity to produce the Project.Website.1.x.x.x.nupkg from the default branch but how does octopus know which package is a staging build from the develop branch and which is production from the default branch seeing apart from version number they have the same project name as in Project.Website ?

At the moment I have a staging environment, staging roles and a staging project group. do I just need to create a new group environment and roles for production and if so how does octopus know how to do its bit?

Both tools awesome bits of kit and I am sure I'm pretty close now.

like image 996
solrevdev Avatar asked Jan 18 '13 09:01

solrevdev


1 Answers

You'll need to setup an environment for Production in Octopus Deploy.

Assumptions:

  • Your Production environment in Octopus is named Production
  • You are using octo.exe in a Command Line build step in TeamCity to create and deploy the releases.

You can use the --deployto option of octo.exe to specify an environment to deploy your newly created release to. Something like this:

octo create-release --server=http://your-octopus/api --project=Project.Website --version=%build.number% --packageVersion=%build.number% --deployto=Production

This command will:

  • Create a release using your TeamCity build number as the version
  • Use your TeamCity build number as the package version for all packages
  • Deploy the release to the Production environment

TIP: Sometimes it takes a few seconds for TeamCity to get the artifacts published into it's NuGet feed. If your octo command tries to create a release using package versions that are not yet published the command (and build step) will fail. I build in a 30 second "sleep" in my script before running the octo.exe command to ensure that the build server has had time to publish the current version of the packages.

like image 147
Jeff French Avatar answered Oct 07 '22 22:10

Jeff French