如果不同的构建测试失败,我可以让 TeamCity 禁用某个构建吗?

发布于 2024-11-06 22:06:38 字数 105 浏览 5 评论 0原文

我有一项 TeamCity 作业来构建我的项目并运行所有单元测试,另一项作业将构建部署到生产服务器。

我是否可以禁用“部署”作业,以便在构建项目中当前存在失败的测试时无法部署代码?

I have a TeamCity job that builds my project and runs all the unit tests, and another one that deploys the build to the production server.

Can I disable the "deploy" job so that it's impossible to deploy code if there's currently a failing test in the build project?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

温柔嚣张 2024-11-13 22:06:38

部署工作不应该已经依赖于构建工作吗?通过工件依赖?您可以将部署作业的构建触发器设置为构建作业上的成功构建触发器,以便在构建成功时进行部署。此外,如果触发部署作业,它将采用最后一次成功的构建。因此,如果构建作业中的单元测试失败,则不会考虑该构建。

不过,我不建议使用快照依赖项,因为这意味着在部署时尝试触发新构建,这不是逻辑流程。当然,在快照依赖项中,您可以说仅在合适的构建不可用(或类似的情况)时才触发,但快照依赖项仍然不是这种情况下的解决方法。

Shouldn't the deploy job already be dependent on the build one? Through Artifacts Dependency? You can set up the build trigger for the deploy job to be a successful build trigger on the build job so that the deploy happens when there is a successful build. Also, if a deploy job is triggered, it will take the last successful build. So if unit tests in the build job are failing, that build is not considered.

I wouldn't recommend snapshot dependency though, because it means when you deploy you try to trigger a new build, that is not the logical flow. Of course in the snapshot dependency you can say trigger only if a suitable build is not available ( or something like that ) but still snapshot dependency is not the way to go for this case.

习惯成性 2024-11-13 22:06:38

在最近完成的构建上设置部署的快照依赖关系,并确保属性显示如果失败则拒绝[并确保在常规设置中如果测试失败则构建失败]

Set up a Snapshot Dependency for Deploy on the most recetly finished Build and make sure the properties to say reject if failed [and make sure Build fails if tests fail in the General settings]

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文