Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 769
Thomas Avatar asked Oct 12 '22 13:10

Thomas


1 Answers

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

like image 118
Geoff Bullen Avatar answered Oct 14 '22 19:10

Geoff Bullen