How to create a deployment of Octopus, choose a package version in several environments?

We create packages for several deployment environments using the TeamCity and OctoPack server. The problem is that the tentacle agent selects the latest version of the package number, so it has the same (last) package that is deployed in all environments. Here is a brief description of our installation:

  • DEV and STAGE environments;
  • Deployment in DEV is launched from the Git branch "dev"
  • Deployment to STAGE starts from the Git branch "stage"
  • OctoPack is configured to create MyProduct.1.0.0.dev-% build_counter% packages for DEV build configuration;
  • OctoPack is configured on the created packages MyProduct.1.0.0.% Build_counter% for the configuration of the STAGE assembly;
  • TeamCity is configured to expose OctoPack artifacts (NuGet packages) through the NuGet feed;
  • The Octopus project is set up to deploy packages with the NuGet Id MyProduct from the TeamCity NuGet feed.

So what happens is that since DEV assemblies run more often, they have more than% build_counter%, and STAGE does not get the ability to deploy their own packages. Octopus tentacle prefers packages with 1.0.0.dev - * suffix.

This should be a fairly common scenario, but I have not found an easy way to solve it.

+7
deployment nuget teamcity octopus-deploy
source share
2 answers

There are some parts that are not described here: https://github.com/OctopusDeploy/Octopus-Tools . But if you look at https://github.com/OctopusDeploy/Octopus-Tools/blob/master/source/OctopusTools/Commands/CreateReleaseCommand.cs , you can figure out what you can do.

I think the tools are backward compatible, but not 100% sure of that.

When you use the octo tools that I expect you are using, you can set the version parameter (also called releasenumber now) to indicate the release number. If you do not specify anything else, this will take the last package, so you want to install packageversion (also called defaultpackageversion ), which should be used for release.

I think this should be done. If this is not the case, what do you use to create the release?

An example of what we use from our TeamCity when using the octo tools that we added to the environment path for build agents:

 create-release --server=%conf.OctoServerApi% --project=%conf.OctoProject% --version=%env.OctopusPackageVersion% --deployto=%conf.OctoDeployEnv% --packageversion=%env.OctoPackPackageVersion% --apiKey=%conf.OctoApiKey% --waitfordeployment %conf.OctoExtraParams% 

UPDATE:

The documentation for 2.0 is much better: http://docs.octopusdeploy.com/pages/viewpage.action?pageId=360596

+9
source share

Inspired by Tomas Jansson, answer by simply adding the following to the Advanced command line arguments in the OctopusDeploy step : Create a release (TeamCity v9) that worked for me:

 --packageversion=%build.number% 
+3
source share

All Articles