以编程方式固定 Teamcity 中的构建
是否可以通过编程/自动方式在 Teamcity 中固定构建? 如果部署构建成功,我想固定构建。
Is it possible to pin a build in Teamcity programmatically/automatically?
I want to pin a build if a Deploy-build is successfull.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
刚刚发现可以通过 REST API
我可以 f.ex 发送这样的 PUT 命令
http://teamcityserver:81/httpAuth/app/rest/builds/ id:688/pin/
然后 ID 为 688 (teamcity.build.id) 的构建将被固定。
Just found out that its possible through the REST API
I can f.ex send a PUT command like this
http://teamcityserver:81/httpAuth/app/rest/builds/id:688/pin/
and then the build with id 688 (teamcity.build.id) will be pinned.
我想用最新的答案来挑战已接受的答案,该答案已使用 TeamCity 9 EAP 4(内部版本 31717)和 8.1.x 进行了测试。
标记和固定可以通过一个简单的插件来实现,该插件仅包含一个事件适配器,如下所示:
您还需要在
src/main/resources/META-INF/my-plugin.xml 下有一个 Spring 上下文:
I would like to challenge the accepted answer with an up-to-date answer, which was tested with TeamCity 9 EAP 4 (build 31717) and 8.1.x.
Tagging and pinning could be implemented via a simple plugin that contains just an event adapter such as the following:
You'll also need to have a Spring context under
src/main/resources/META-INF/my-plugin.xml
:受到 carlspring 答案的启发,我编写了一个小 teamcity 插件,以编程方式将标签添加到您的构建中:
https:// github.com/echocat/teamcity-buildTagsViaBuildLog-plugin
您可以轻松修改它以固定您的构建。此外,标记成功的构建而不是固定它们并使用标签作为过滤器可能会有所帮助。
Inspired by carlspring's answer, I wrote a little teamcity plugin that programmatically adds tags to your build:
https://github.com/echocat/teamcity-buildTagsViaBuildLog-plugin
You could easily modify it to also pin your build. Furthermore, it might be helpful to tag your successful builds instead of pinning them and use the tag as a filter.
如果您愿意安装一个插件,我编写了一个插件,能够根据构建功能或系统消息以编程方式标记和固定构建。
https://github.com/ocroquette/teamcity-autopin
另请参阅:https://youtrack.jetbrains.com/issue/TW-38017
If you are willing to install a plugin, I wrote one that is able to tag and pin builds programmatically based on build features or system messages.
https://github.com/ocroquette/teamcity-autopin
See also: https://youtrack.jetbrains.com/issue/TW-38017