continuous-integration - 在 TeamCity 中推广特定的 OctopusDeploy 版本

标签 continuous-integration teamcity continuous-deployment octopus-deploy

我正在使用TeamCity用于持续集成和 Octopus Deploy用于持续部署。

在 TeamCity 中,我有一个项目,我使用 Octopus Deploy 的 OctoPack 构建然后打包该项目。 。目前定义了三种构建配置:

  1. 构建、测试、打包
  2. 部署到 CI
  3. 部署到质量检查

对于第一个配置中的OctoPack配置,包版本是通过内部版本号生成的:

OctoPack package version: 1.0.0.%build.number%

如果构建、测试、打包成功构建,则部署到 CI 会启动 Octopus Deploy 版本。创建发行版时,Octopus Deploy 使用 NuGet 版本号作为发行版本号。因此,对于构建 #400,我有一个 My.Project.1.0.0.400.nupkg NuGet 包,它作为版本 1.0.0.400 发布。

部署到 QA 步骤中,我需要能够从我的 CI 提升与特定部署到 CI 版本相关的版本> 环境到我的 QA 环境。

本质上,我希望能够拥有这种依赖树:

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)

在 Octopus 中我会看到以下内容:

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

如何传递特定版本号以升级到 TeamCity 中的给定环境?

最佳答案

当我进入各种构建配置的构建步骤时,我意识到我可以引用依赖构建配置的属性。

对于上面的示例,我有以下配置和 ID:

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

在我的 Build, Test Package 构建配置中,我将 OctoPack 版本号配置为:

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

然后在部署配置中,我将版本号更改为:

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%

通过这样做,我能够引用先前版本的版本号,以将正确的版本从一个环境提升到另一个环境。

关于continuous-integration - 在 TeamCity 中推广特定的 OctopusDeploy 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19597325/

相关文章:

git - 如果仅更改了特定文件,如何不触发 Teamcity 中的构建

java - 错误注入(inject) : org. jboss.as.plugin.deployment.Deploy

typescript - cdk CI/CD 管道 - 销毁重复堆栈

xcode - 如何在 xcode 持续集成中自动删除旧构建的文件?

android - 如何在 headless 服务器上安装 Android NDK Cmake 工具

continuous-integration - VSTS NuGet 步骤恢复错误 : You cannot call a method on a null-valued expression at CallSite. 目标(Closure、CallSite、Object、Object)

teamcity - 防止 TeamCity 中的意外构建

TeamCity "Retry on Fail"构建触发器 - 限制重试

azure - 当我在 Visual Studio 2017 的解决方案资源管理器中右键单击 Web 项目时,无法将“添加”->“现有项目”视为 Azure Web 作业选项

npm - 无法加载在 'react' : Cannot find module '.eslintrc.json' 中声明的插件 'eslint-plugin-react'