Search code examples
buildcontinuous-integrationhudsoncommit-messagecontinuous-deployment

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.


Solution

  • 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