有条件地执行TeamCity构建步骤 [英] Conditionally execute a TeamCity build step

查看:96
本文介绍了有条件地执行TeamCity构建步骤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为所有项目定义通用构建模板-我将其放置在根项目"级别(由于TeamCity 8的这一新功能).我们的一些项目创建了一个安装程序,该安装程序需要由运行powershell脚本的单独构建步骤"生成.但是,我们的某些项目不会创建此安装程序,因此不需要此额外的构建步骤.

I am working on defining a general-purpose build template for all our projects -- which I have placed at the "root project" level (thanks to this new feature of TeamCity 8). Some of our projects create an installer, which needs to be generated by a separate "build step" that runs a powershell script. However, some of our projects do not create this installer, and hence do not need this additional build step.

是否有一种方法可以根据构建参数有条件地执行构建步骤?我认为也许可以在此处利用禁用构建步骤"功能,但是我没有看到一种通过参数定义步骤的启用/禁用状态的方法.

Is there a way to conditionally execute a build step, based on a build parameter? I thought that perhaps the "disable build step" feature could be leveraged here, but I don't see a way to define the enabled/disabled status of a step via a parameter.

当然,我可以将此条件纳入执行安装程序生成的构建步骤中,但是如果可以从teamcity本身内部进行处理,则会更干净.

Of course I could bake this conditional into the build step that performs the installer generation, but it would be cleaner if this could be handled from within teamcity itself.

推荐答案

在很多情况下,我都需要有条件的构建步骤,但是,此功能目前尚不存在. http://youtrack.jetbrains.com/issue/TW-17939

I've had need for conditional build steps on numerous occasions but alas, the feature does not exist at the moment. http://youtrack.jetbrains.com/issue/TW-17939

没有理由您不能让许多构建配置使用模板,然后仅在不需要创建安装程序的构建配置/项目中禁用构建步骤.禁用单个构建配置中的步骤不会影响它所基于的父模板.

There's no reason you can't have a template used by many build configurations and then simply disable the build step in the build configs/projects that do not need to create the installer. Disabling the step in an individual build config does not affect the parent template it is based on.

不像TC中内置运行时/动态方法那样整洁,但我有时会使用它.我也已经完成了我的建议.

Not as tidy as having a runtime/dynamic method built in to TC but I use it on occasion. I've done iwo has suggested as well.

这篇关于有条件地执行TeamCity构建步骤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆