使用提交消息中的标签在 Jenkins/Hudson 中触发构建 [英] Trigger build in Jenkins/Hudson using hashtag in commit-message
问题描述
是否可以仅在提交消息中出现特定字符串时触发 Hudson/Jenkins 构建?
Is it possible to trigger a Hudson/Jenkins build only when a certain string appears in a commit-message?
例如,我想通过编写如下提交消息来触发将我的应用程序推出到开发环境的构建:
For instance, I want to trigger a build that rolls out my application to the dev environment by writing a commit message like:
MYPROJECT-123 修复了 MyClass.java 中的 NPE #deploy:DEV
MYPROJECT-123 Fixed NPE in MyClass.java #deploy:DEV
这个关于Continuos Deployment的精彩演讲中描述了总体思路 但我在 Hudson 找不到有关如何执行此操作的任何信息.
The general idea is described in this great talk on Continuos Deployment but I couldn't find any information on how to do this in Hudson.
我希望这种行为在 Hudson 本身中而不是在外部系统中,如 commit-hooks 或 web-hooks.
I would prefer to have this behavior in Hudson itself and not in an external system like commit-hooks or web-hooks.
推荐答案
我不知道有一种开箱即用的方式可以将 SCM 消息解析为触发器的一部分.不过,您有几个选项可以实现您想要的效果
I don't know of an out of the box way you can parse the SCM message as part of the trigger. You have a couple of options that might achieve what you want though
- 编写自己的 Hudson SCM 插件
- 将您的作业链接到构建管道中.第一项工作可以简单地在 changelog.xml 中查找该消息,以确定是否触发了下一个构建.
如果您正在考虑构建构建作业的管道,请查看 build-pipeline-plugin.http://www.centrumsystems.com.au/blog/?p=121一个>
If you are looking at building a pipeline of build jobs, check out the build-pipeline-plugin. http://www.centrumsystems.com.au/blog/?p=121
有人有更优雅的解决方案吗??
Anyone got a more elegant solution??
干杯,
杰夫
这篇关于使用提交消息中的标签在 Jenkins/Hudson 中触发构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!