Deploying specific version with Team City

Hi there,

I’m having some problems with deploying with Octopus through TeamCity. There problem is release numbers are occasionally getting out of sync.

I have Team City creating a release with our projects version number as the release number. Octopus creates the release but picks up the previous version from TeamCity’s nuget feed (I guess TeamCity doesn’t publish the package instantly?). So for example, TeamCity will create an octopus release with the name 1.1.13. Octopus then deploys version 1.1.12, but with the name 1.1.13. This can be really confusing.

Is there anything I can configure to tell Octopus to deploy a specific package, rather than the latest one? or is my set up not quite right?

Many thanks,

Josh

We were bit by this too. We fixed it by adding --packageversion %build.number% as an addition command line argument in the TeamCity OctopusDeploy: Create release build step.

Hi Josh,

Thanks for getting in touch! TeamCity does not release it’s packages to it’s own feed until after ALL the build steps are completed.
So if you have a build configuration that creates the package, and then creates and deploys the release, Octopus only knows about the previous package because TC hasn’t released the new one yet.
This is only when using the TC feed. To combat the issue, creating a second build configuration to run after the package that includes your create and deploy release steps will pickup the correct package.
Our video “TeamCity Built-in Feed” http://octopusdeploy.wistia.com/projects/gguvhmqn6b explains a little more about this.

Hope that helps!
Vanessa

Interesting. We stopped using TeamCity’s NuGet feed and instead publish to An external artifact repository so we hadn’t hit the issue Venessa highlighted.

Hi Chris,

Yeah, this situation only occurs if you use the TC NuGet feed, if you instead publish to an external feed during that step, then it gets the correct package.
Your --packageversion hint is also excellent when you need to define it due to naming conventions.

Vanessa

Thank you for the replies.

My current setup does have a separate steps. I have a build chain of:

build -> deploy to testing

And the problem still persists (I’d say it gets the version number wrong 1 in every 10 builds).

I’ve tried adding --packageversion to TeamCity.

I’ll report back if this fixes the problem.

Many thanks.

Josh

This can be solved while still only needing one build configuration in TeamCity as long as you can use Octopus’ nuget feed instead of TeamCity’s. I detailed how I set this up in the following (tangentially related) question:

http://help.octopusdeploy.com/discussions/problems/27891