Steps to reproduce
- Create a workflow job
- Add a checkout step using GIT as SCM
- Add a DisableRemotePoll option
- Add a PathRestriction option with includedRegions set to resources/.*
- Set SCM polling to H/5 * * * *
- Trigger a build
- Change the PathRestriction option, set includedRegions to components/.*
- Commit a file to components/foobar.txt in GIT and push to origin
Expected results
A build is triggered next time SCM polling takes place.
Actual results
New builds are not triggered.
However, a new build is triggered for changes in the resources folder.
Comments
The changes in job configuration (Groovy script) do not seem to be picked up by the SCM polling component until a new build is triggered.
It looks like the Groovy workflow script is only recompiled after a build is triggered, so polling just keeps using the old SCM settings.
This is counter-intuitive as a user would expect the configuration changes to be applied when they click "Save" or "Apply" at the bottom of the job configuration page.
Additional information
I patched git-plugin on my local installation in order to debug the issue.
I added additional logging to git-plugin-master\src\main\java\hudson\plugins\git\extensions\impl\PathRestriction.java
(see attached patch.diff).
You can see the issue in the attached screenshot.png (occurring after following all the steps to reproduce) including the additional logging as mentioned above.