I cannot get the "included regions" feature to work in Jenkins with the Git plugin. I want a job only to be built when there a changes in "his" directory. Example: the project mytool should only be build when there are changes under GIT_ROOT/tools/mytool/
. I tried several forms for the regex in the included regions field:
/tools/mytool/.*
tools/mytool/.*
^tools/mytool/.*
With any of these regexes the result is the same: mytool builds every time a change is commited - no matter where. I also tried the excluded regions the same way - also not working. What am I doing wrong?
I just had this problem, and the answer was slightly different than the other answers. That being said, the solution lay in the question itself. For me, I had paths in the "Included Regions" with the pattern:
I changed the pattern to:
Once I changed to that pattern, it worked perfectly for me.
For me it started working when checking "Force polling using workspace" under "Source-Code-Management - Additional Behaviours" in the job config. Smells like a bug - there are several open regarding the included/excluded regions feature of the git plugin.
EDIT: it stopped working after updating jenkins and the git plugin. The cause is probably:
https://issues.jenkins-ci.org/browse/JENKINS-20607
I am thinking of moving to this method here
Make sure under Build Trigger Poll SCM is checked, or you have some other way of letting Jenkins know there are changes.
You are currently just defining the regions, but Jenkins still has to pull the updates before it can see a change.
Just a note for others visiting this site because they have problems with
included-regions
as I had:I also had trouble with path pattern
tools/mytool/.*
which was not working asincluded-region
. The reason was that I did enable theshallow clone
option in git scm settings. When the option was disabled theincluded-region
parameter worked as expected.