如何在 TeamCity 中有条件地 运行 构建步骤
How to run a build step conditionally in TeamCity
这是这个问题的更通用的版本:
例如,如果 '%teamcity.build.branch.is_default%' -eq 'true'
或 '%teamcity.build.branch%' -eq 'master'
,我可以使用 PowerShell 脚本来 运行 MSBuild,但我会错过 TeamCity MSBuild 构建附带的可折叠日志 运行纳尔。有没有更简单的方法来有条件地 运行 构建步骤?
无法根据条件执行构建步骤。为相关请求投票:https://youtrack.jetbrains.com/issue/TW-17939.
推荐的方法是为每个分支创建单独的构建配置。您可以使用 templates 来简化设置。在这种情况下,将更容易解释结果,并且构建的统计数据将提供信息。
另请参阅相关的 answer(建议 hack)。
JetBrains 在 TeamCity 2020.1 中引入了对 conditional build steps 的支持。
这是他们的博客 post 宣布这项新功能的片段:
Have you ever wanted to execute different command line scripts on different platforms, or deploy changes in different branches to different staging servers? Now you’re free to do just about anything! TeamCity 2020.1 allows you to specify conditions for your build steps and execute them only if the criteria are met.
这是这个问题的更通用的版本:
例如,如果 '%teamcity.build.branch.is_default%' -eq 'true'
或 '%teamcity.build.branch%' -eq 'master'
,我可以使用 PowerShell 脚本来 运行 MSBuild,但我会错过 TeamCity MSBuild 构建附带的可折叠日志 运行纳尔。有没有更简单的方法来有条件地 运行 构建步骤?
无法根据条件执行构建步骤。为相关请求投票:https://youtrack.jetbrains.com/issue/TW-17939.
推荐的方法是为每个分支创建单独的构建配置。您可以使用 templates 来简化设置。在这种情况下,将更容易解释结果,并且构建的统计数据将提供信息。
另请参阅相关的 answer(建议 hack)。
JetBrains 在 TeamCity 2020.1 中引入了对 conditional build steps 的支持。
这是他们的博客 post 宣布这项新功能的片段:
Have you ever wanted to execute different command line scripts on different platforms, or deploy changes in different branches to different staging servers? Now you’re free to do just about anything! TeamCity 2020.1 allows you to specify conditions for your build steps and execute them only if the criteria are met.