How do I create a release in Octopus Deploy with a specific version number from my build server?

I’m using TeamCity and I have it packaging my application and publishing it to Octopus Deploy. The problem is when I create a release I want to use a specific version number of my package. I can’t always use the latest. I’m leveraging a gitflow style branching strategy, and I might be pushing a release package which is 1 or 2 versions behind the latest dev package.

How can I accomplish this using TeamCity (or any build server)?

A little background, all build server plug-ins leverage the Octopus Deploy CLI tool known as octo.exe for a variety of tasks. For creating a release, it uses the octo.exe create-release command.

Jenkins
If you are using Jenkins, that functionality is provided via the UI:

Jenkins is our newest plug-in and it looks like we added some more functionality to it than we have in the past.

Other Build Servers

At the time of this writing, you will have to leverage the additional command line arguments for other build servers. Please ensure you have the latest build server plug-in, as this might have changed.

There are options with the command line arguments:

  • The command argument to deploy version 1.0.1 for all packages in your deployment would be: --packageVersion 1.0.1
  • The command line argument to have different versions for all steps in your deployment would be: --package StepA:1.0.1 --package StepB:1.0.2
  • If you want to have a specific version for one step, but have all other steps have the same version, then that would be: --version 1.0.3 --package StepA:1.0.1

Those command line arguments would be entered in the Additional command line arguments field. Typically this is found at the bottom of the screen for our plug-ins.