Trigger build in Jenkins/Hudson using hashtag in commit-message

心不动则不痛 提交于 2019-12-19 08:11:30

问题


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 Fixed NPE in MyClass.java #deploy:DEV

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.

I would prefer to have this behavior in Hudson itself and not in an external system like commit-hooks or web-hooks.


回答1:


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

  1. Write your own Hudson SCM plugin
  2. Chain your jobs together into a build pipeline. The first job could simply look for that message in the changelog.xml to determine if the next build is triggered or not.

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??

Cheers,

Geoff




回答2:


There is a plugin called Commit Message Trigger Plugin, but it had just a 0.1 release.

Maybe the easiest way is to use a version control post commit (or push) trigger to start a Hudson Job. You'd one anyway to automatically start your build.



来源:https://stackoverflow.com/questions/5281816/trigger-build-in-jenkins-hudson-using-hashtag-in-commit-message

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!