How to trigger a build only if changes happen on particular set of files

xavier.seignard picture xavier.seignard · Mar 9, 2011 · Viewed 103.6k times · Source

How do I tell Jenkins/Hudson to trigger a build only for changes on a particular project in my Git tree?

Answer

Aaron Kushner picture Aaron Kushner · Feb 10, 2012

The Git plugin has an option (excluded region) to use regexes to determine whether to skip building based on whether files in the commit match the excluded region regex.

Unfortunately, the stock Git plugin does not have a "included region" feature at this time (1.15). However, someone posted patches on GitHub that work on Jenkins and Hudson that implement the feature you want.

It is a little work to build, but it works as advertised and has been extremely useful since one of my Git trees has multiple independent projects.

https://github.com/jenkinsci/git-plugin/pull/49

Update: The Git plugin (1.16) now has the 'included' region feature.