我可以从 msbuild 脚本取消 TeamCity 构建吗?
TeamCity 允许我使用 ##teamcity 交互从 MsBuild 脚本返回报告。我可以用它来告诉 TeamCity 构建失败,或者确实成功,但我想告诉它取消构建。有谁知道有什么方法可以做到这一点?
我可以用它来通知 TeamCity 失败...
<Message Text="##teamcity[buildStatus status='FAILURE']" Condition="Something==SomeCondition" />
我很乐意这样做...
<Message Text="##teamcity[buildStatus status='CANCEL']" Condition="Something==SomeCondition" />
我已经尝试过 TeamCity 服务任务,但到目前为止还没有。
编辑:
所以看来这个功能不可用,尽管 解决方法http请求可用于取消构建。还有一个用于取消构建 TC 网站的功能请求 。
TeamCity allows me to report back from my MsBuild script using the ##teamcity interaction. I can use this to tell TeamCity that the build has FAILED, or indeed SUCCEEDED, however I would like to tell it to CANCEL the build instead. Does anyone know of a way to do this?
I can use this to inform TeamCity of failure...
<Message Text="##teamcity[buildStatus status='FAILURE']" Condition="Something==SomeCondition" />
I would love to do this...
<Message Text="##teamcity[buildStatus status='CANCEL']" Condition="Something==SomeCondition" />
I've tried out the TeamCity Service Tasks but nothing thus far.
EDIT:
So it seems this feature is not available, although a workaround http request can be used to cancel a build. There is also a feature request for Cancelling a build the TC website.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
根据 JetBrains 问题跟踪器 和 发布页面,自 TeamCity 2019.1 EAP 1可以通过服务消息停止构建,如下所示:
According to JetBrains issue tracker and release page, since TeamCity 2019.1 EAP 1 builds can be stopped with service message as in:
您可以使用自 最初发布以来已更改的未记录的 http 请求< /a>.您现在需要“operationKind=1”。我使用了像这样的powershell运行器:
另一个SO帖子可以告诉你如何制作一个来自 MSBuild 的 http 请求
“guest=1”表示我正在使用访客帐户,对于要取消的项目,它至少需要“停止构建/从队列中删除”。
You can use the undocumented http request which has changed since it was originally posted. You now need "operationKind=1". I used a powershell runner like so:
Another SO post can tell you how to make an http request from MSBuild
The "guest=1" means I'm using the guest account, which at minimum needs the "Stop build / remove from queue" for the project you're going to cancel.
从 Teamcity 8.1(来源)开始,可以取消构建通过 REST API。
摘自 9.x 文档,取消当前运行构建
Since Teamcity 8.1 (Source) it is possible to Cancel the Build via REST API.
Taken from the 9.x Documentation, cancelling a currently running build
您不能只使用错误任务吗,这应该会导致执行构建停止。
Can you not just use the Error task, this should cause the execution of the build to stop.