Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-31983

Workflow: Polling ignores SCM setting changes in Groovy script

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • pipeline

      Steps to reproduce

      1. Create a workflow job
      2. Add a checkout step using GIT as SCM
      3. Add a DisableRemotePoll option
      4. Add a PathRestriction option with includedRegions set to resources/.*
      5. Set SCM polling to H/5 * * * *
      6. Trigger a build
      7. Change the PathRestriction option, set includedRegions to components/.*
      8. 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.

        1. patch.diff
          0.9 kB
        2. sample-config.xml
          1 kB
        3. screenshot.png
          screenshot.png
          163 kB

            jglick Jesse Glick
            roccivic Rouslan Placella
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: