Jenkins Git plugin included regions not working

2020-05-25 07:10发布

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?

标签: git jenkins
4条回答
闹够了就滚
2楼-- · 2020-05-25 07:17

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:

service/Search/AbstractSearchServices/master/**/*

I changed the pattern to:

service/Search/AbstractSearchServices/master/.*

Once I changed to that pattern, it worked perfectly for me.

查看更多
戒情不戒烟
3楼-- · 2020-05-25 07:26

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

查看更多
▲ chillily
4楼-- · 2020-05-25 07:31

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.

查看更多
倾城 Initia
5楼-- · 2020-05-25 07:39

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 as included-region. The reason was that I did enable the shallow clone option in git scm settings. When the option was disabled the included-region parameter worked as expected.

查看更多
登录 后发表回答