Saturday, July 9, 2016

Deploying Releases using Octopus Deploy and Jetbrains TeamCity

If you are using Octopus Deploy for your Release Management process, you can use the Octopus Deploy TeamCity plugin to assist in your deployments!

You can read about the TeamCity plugin here: http://docs.octopusdeploy.com/display/OD/TeamCity

Using Octopus Deploy provides many benefits over standard script-based deployments as outlined here: https://blog.jetbrains.com/teamcity/2015/11/automating-deployments-with-teamcity-and-octopus-deploy/

You can use one of 4 different build steps in TeamCity:


  • Create Release
  • Deploy Release
  • Promote Release
  • Push Packages

The most common build steps you will probably use are the "Create Release" or "Deploy Release" build steps:







One of the unfortunate parts of these build steps, however, is that the API Key does not allow parameterization, so you have to either enter this API Key manually each time or else derive from a Build Configuration Template in order to be able to inherit this property.  All other parameters in this build step can be parameterized readily through TeamCity.

Installing and configuring Octopus Deploy

If you are not using Team Foundation Server for your source control system, then you will not have TFS Release Management available to you as an option for your release management process.

Therefore, you are left to find an alternative tool that can still provide release management capabilities for your application.  Fortunately, Octopus Deploy can fulfill that need!  https://octopus.com/

You can read the Getting Started guide for Octopus Deploy here: http://docs.octopusdeploy.com/display/OD/Getting+started

However, the Getting Started guide is not really a step-by-step guide, so I thought I would provide one here.

First of all, as is outlined in the Getting Started guide, you have to install and configure the Octopus Deploy server:




















Once your Octopus Deployment Server is installed, you have to configure it by setting up an environment:









In the process of setting up your environment, you also need to set up Octopus Tentacles in order to be able to deploy to that environment!
















Next, you have to actually configure a Project for your deployment:







Of course, you will then need to create a package in order to be able to add it to your project, but you can add something as simple as a .zip file for deployment (http://docs.octopusdeploy.com/display/OD/Supported+Packages)

Once you have created the package according to the specifications, you can then upload your package:


 Make sure you also know the ID of your package because you will need this information in order to deploy your package:


Now you are ready to actually create a deployment step for your package:



By clicking on the "Configure features" link, you can specify additional options for your deployment build step:



 Before you can actually deploy, though, you need to create a release:


Once the release has been created, you can FINALLY deploy the Release!





 The Release will then be deployed to the designated target for your Octopus Tentacle.  The whole process from start to finish is extremely lengthy, but once it is set up, you will be quite happy with the results!