Pergunta

I am using TeamCity for continuous integration and Octopus Deploy for continuous deployment.

In TeamCity, I have a project which I build and then package using Octopus Deploy's OctoPack. There are currently three build configurations defined:

  1. Build, Test, Package
  2. Deploy to CI
  3. Deploy to QA

For the OctoPack configuration in the first configuration, the package version is generated via the build number:

OctoPack package version: 1.0.0.%build.number%

The deploy to CI then initiates an Octopus Deploy release if Build, Test, Package successfully builds. Octopus Deploy uses the NuGet version number as the release version number when the release is created. So for build #400 I have a My.Project.1.0.0.400.nupkg NuGet package, which is released as version 1.0.0.400.

in the Deploy to QA step, I need to be able to promote the release associated with a specific Deploy to CI build from my CI environment to my QA environment.

In essence, I want to be able to have this kind of dependency tree:

Build, Test, Package
|-- #401 SUCCESS
|-- #400 FAILURE
|-- #399 FAILURE
|-- #398 SUCCESS
/   #391-397 FAILURE
|-- #390 SUCCESS

Deploy to CI
|-- #100 SUCCESS (Depends Build, Test, Package #401)
|-- #99  SUCCESS (Depends Build, Test, Package #398)
|-- #98  SUCCESS (Depends Build, Test, Package #390)

Deploy to QA
|-- #10 SUCCESS (Depends Deploy to CI #100)
|-- #9  SUCCESS (Depends Deploy to CI #98)

And in Octopus I would see the following:

Release
|-- 1.0.0.100 CI, QA
|-- 1.0.0.99  CI
|-- 1.0.0.98  CI, QA

How can I pass along a specific version number to promote to a given environment in TeamCity?

Foi útil?

Solução

When I went into the build steps for the various build configurations, I realized I can reference the properties of dependent build configurations.

For the example above, I have the following configurations and ids:

Build, Test, Package - btp1
Deploy to CI - dtc1
Deploy to QA - dtq1

In my Build, Test Package build configuration I configured my OctoPack version number as:

%MajorVersion%.%MinorVersion%.%build.vcs.number%.%build.number%

Then in the Deploy configurations, I changed the version number to be:

Deploy to CI - %MajorVersion%.%MinorVersion%.%dep.btp1.build.vcs.number%.%dep.btp1.build.number%
Deploy to QA - %MajorVersion%.%MinorVersion%.%dep.btp1.build.vcs.number%.%dep.btp1.build.number%

By doing so, I was able to reference the build number of the previous builds to promote the correct release from one environment to another.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top