• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • git-plugin
    • None
    • 1.609.1
      git-plugin-2.4.0
      git-client-1.18.0

      1. Parametrise build with input string parameter BRANCH and default value *
      2. define branchspec
        origin/${BRANCH}
        
      1. enable polling

      Polling will see infinitely new changes.

      Fix - remove variable and directly set *

          [JENKINS-29714] infinite polling with variable in branchspec

          Mark Waite added a comment -

          Is this a new behavior, or has it always behaved this way?

          Since this is the refspec, can you explain your use case further so that I understand why you declared it to be critical?

          I'm accustomed to refspecs being used to limit what is fetched or is considered for fetch, but still you need to choose the branch which will be built. Help me better understand how you are using a parameterized refspec.

          Mark Waite added a comment - Is this a new behavior, or has it always behaved this way? Since this is the refspec, can you explain your use case further so that I understand why you declared it to be critical? I'm accustomed to refspecs being used to limit what is fetched or is considered for fetch, but still you need to choose the branch which will be built. Help me better understand how you are using a parameterized refspec.

          I saw such use cases before, people define variable to have ability trigger job with specified branch and in the same time enabling polling for automatically building all branches. So variable has * as default value (or **) for having working polling.
          AFAIR code, branchspec has substitution of default variables.
          Critical because it causes infinite build scheduling and always sees changes. I will try reproduce with previous versions and then define if it regression.

          Kanstantsin Shautsou added a comment - I saw such use cases before, people define variable to have ability trigger job with specified branch and in the same time enabling polling for automatically building all branches. So variable has * as default value (or **) for having working polling. AFAIR code, branchspec has substitution of default variables. Critical because it causes infinite build scheduling and always sees changes. I will try reproduce with previous versions and then define if it regression.

          Marc Rohlfs added a comment -

          I'm experiencing this, too. Seems like this happens when the polling interval is shorter than the build duration.

          Marc Rohlfs added a comment - I'm experiencing this, too. Seems like this happens when the polling interval is shorter than the build duration.

          I'm also affected by this. My use case is exactly as described by integer in https://issues.jenkins-ci.org/browse/JENKINS-29714?focusedCommentId=233448&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-233448 but I use ${ref} in the branchspec field (and the default value of parameter "ref" is an empty value).

          Leandro Lucarella added a comment - I'm also affected by this. My use case is exactly as described by integer in https://issues.jenkins-ci.org/browse/JENKINS-29714?focusedCommentId=233448&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-233448 but I use ${ref} in the branchspec field (and the default value of parameter "ref" is an empty value).

          If I do a manual build of the branch that keeps triggering the build (by setting my parameter ${ref} to that branch), then that particular branch build is not triggered anymore by the pooling, I have to repeat the process with all the "offending" branches, and then the job seems to work fine.

          Leandro Lucarella added a comment - If I do a manual build of the branch that keeps triggering the build (by setting my parameter ${ref} to that branch), then that particular branch build is not triggered anymore by the pooling, I have to repeat the process with all the "offending" branches, and then the job seems to work fine.

          More info, this is how my polling looks when using a parameter for the branch specification:

          Started on Mar 30, 2016 1:19:00 PM
          Using strategy: Default
          [poll] Last Built Revision: Revision ace29d00302d20dddb3763057f31ab40b1fe8b4b (origin/v2.x.x)
          using GIT_SSH to set credentials cred SSH key
           > git --version # timeout=10
           > git -c core.askpass=true ls-remote -h git@github.com:some/repo.git # timeout=10
          Found 32 remote heads on git@github.com:some/repo.git
          [poll] Latest remote head revision on refs/heads/v1.7.x is: 138b74fc9ce8885aefdeabfdf8bc3ecca572d264 - already built by 333
          [poll] Latest remote head revision on refs/heads/v1.4.x is: 57d03eb35379098071726699783055535a8bd425 - already built by 338
          [poll] Latest remote head revision on refs/heads/v1.17.x is: 22d0d8742bacf4c89602fc98f20017c323cdf7bc - already built by 18
          [poll] Latest remote head revision on refs/heads/v1.2.x is: b919d378aac4e503c21b58d940197553f4983344 - already built by 340
          [poll] Latest remote head revision on refs/heads/v1.27.x is: fe1052f3b95a5b75be18b45ce41743da900712f9 - already built by 343
          [poll] Latest remote head revision on refs/heads/v1.5.x is: 0ae940fecddcd4a5a785e5871e12b200ddfb7bee - already built by 345
          [poll] Latest remote head revision on refs/heads/v1.24.x is: 71c050ef5b8fc3430f80cafb27109d34aa103876 - already built by 347
          [poll] Latest remote head revision on refs/heads/v1.19.x is: d09a06c871bdc8f518f694877110189258792392 - already built by 349
          [poll] Latest remote head revision on refs/heads/v1.26.x is: 1d053f81485174957c38cee420eac1292ceb82ef - already built by 351
          [poll] Latest remote head revision on refs/heads/master is: 3a9bf5071b66bd78b2e90984b88dba22ffea489e - already built by 336
          [poll] Latest remote head revision on refs/heads/v1.25.x is: 912e94dbb7f9bdc4ceec75a9c7e56cb1dbbbce75 - already built by 352
          [poll] Latest remote head revision on refs/heads/v1.23.x is: b7919967ce1e152efbbbb4656b7b4866ba14b8ec - already built by 357
          [poll] Latest remote head revision on refs/heads/v1.6.x is: fababe9cd990e1867e28f501b0e91faf1e920a5a - already built by 359
          [poll] Latest remote head revision on refs/heads/v1.18.x is: 987f8c23304b99a6377cae63c7a9a7b5051f4e62 - already built by 361
          [poll] Latest remote head revision on refs/heads/v1.1.x is: 4008675d54b10bafd675a25ba093190697af867f - already built by 365
          [poll] Latest remote head revision on refs/heads/v1.22.x is: 2e47914dfa42cb595731b264cbecc277620aced0 - already built by 19
          [poll] Latest remote head revision on refs/heads/v1.13.x is: cf834f5d3968d8b3996025fc1eb570d17b6a3083
          Done. Took 2.4 sec
          Changes found
          

          refs/heads/v1.13.x is not detected as being already built, but instead of building that reference, the last reference is built (ace29d00302d20dddb3763057f31ab40b1fe8b4b (origin/v2.x.x)), so on the next polling the same happens, refs/heads/v1.13.x is detected as not being built and again the last version built gets rebuilt, getting into an infinite rebuilding loop.


          And this is how it looks when just leaving the branch specification empty:

          Started on Mar 30, 2016 12:59:00 PM
          Polling SCM changes on master
          Using strategy: Default
          [poll] Last Built Revision: Revision ace29d00302d20dddb3763057f31ab40b1fe8b4b (origin/v2.x.x)
           > git rev-parse --is-inside-work-tree # timeout=10
          Fetching changes from the remote Git repositories
           > git config remote.origin.url git@github.com:some/repo.git # timeout=10
          Pruning obsolete local branches
          Fetching upstream changes from git@github.com:some/repo.git
           > git --version # timeout=10
          using GIT_SSH to set credentials cred SSH key
           > git -c core.askpass=true fetch --tags --progress git@github.com:some/repo.git +refs/heads/*:refs/remotes/origin/* --prune
          Polling for changes in
          Seen branch in repository origin/master
          Seen branch in repository origin/timeout-ex-log
          Seen branch in repository origin/v1.0.x
          Seen branch in repository origin/v1.1.x
          Seen branch in repository origin/v1.10.x
          Seen branch in repository origin/v1.11.x
          Seen branch in repository origin/v1.12.x
          Seen branch in repository origin/v1.13.x
          Seen branch in repository origin/v1.14.x
          Seen branch in repository origin/v1.15.x
          Seen branch in repository origin/v1.16.x
          Seen branch in repository origin/v1.17.x
          Seen branch in repository origin/v1.18.x
          Seen branch in repository origin/v1.19.x
          Seen branch in repository origin/v1.2.x
          Seen branch in repository origin/v1.20.x
          Seen branch in repository origin/v1.21.x
          Seen branch in repository origin/v1.22.x
          Seen branch in repository origin/v1.23.x
          Seen branch in repository origin/v1.24.x
          Seen branch in repository origin/v1.25.x
          Seen branch in repository origin/v1.26.x
          Seen branch in repository origin/v1.27.x
          Seen branch in repository origin/v1.28.x
          Seen branch in repository origin/v1.3.x
          Seen branch in repository origin/v1.4.x
          Seen branch in repository origin/v1.5.x
          Seen branch in repository origin/v1.6.x
          Seen branch in repository origin/v1.7.x
          Seen branch in repository origin/v1.8.x
          Seen branch in repository origin/v1.9.x
          Seen branch in repository origin/v2.x.x
          Seen 32 remote branches
          Done. Took 2.8 sec
          No changes
          

          All works well in this case.

          Leandro Lucarella added a comment - More info, this is how my polling looks when using a parameter for the branch specification: Started on Mar 30, 2016 1:19:00 PM Using strategy: Default [poll] Last Built Revision: Revision ace29d00302d20dddb3763057f31ab40b1fe8b4b (origin/v2.x.x) using GIT_SSH to set credentials cred SSH key > git --version # timeout=10 > git -c core.askpass=true ls-remote -h git@github.com:some/repo.git # timeout=10 Found 32 remote heads on git@github.com:some/repo.git [poll] Latest remote head revision on refs/heads/v1.7.x is: 138b74fc9ce8885aefdeabfdf8bc3ecca572d264 - already built by 333 [poll] Latest remote head revision on refs/heads/v1.4.x is: 57d03eb35379098071726699783055535a8bd425 - already built by 338 [poll] Latest remote head revision on refs/heads/v1.17.x is: 22d0d8742bacf4c89602fc98f20017c323cdf7bc - already built by 18 [poll] Latest remote head revision on refs/heads/v1.2.x is: b919d378aac4e503c21b58d940197553f4983344 - already built by 340 [poll] Latest remote head revision on refs/heads/v1.27.x is: fe1052f3b95a5b75be18b45ce41743da900712f9 - already built by 343 [poll] Latest remote head revision on refs/heads/v1.5.x is: 0ae940fecddcd4a5a785e5871e12b200ddfb7bee - already built by 345 [poll] Latest remote head revision on refs/heads/v1.24.x is: 71c050ef5b8fc3430f80cafb27109d34aa103876 - already built by 347 [poll] Latest remote head revision on refs/heads/v1.19.x is: d09a06c871bdc8f518f694877110189258792392 - already built by 349 [poll] Latest remote head revision on refs/heads/v1.26.x is: 1d053f81485174957c38cee420eac1292ceb82ef - already built by 351 [poll] Latest remote head revision on refs/heads/master is: 3a9bf5071b66bd78b2e90984b88dba22ffea489e - already built by 336 [poll] Latest remote head revision on refs/heads/v1.25.x is: 912e94dbb7f9bdc4ceec75a9c7e56cb1dbbbce75 - already built by 352 [poll] Latest remote head revision on refs/heads/v1.23.x is: b7919967ce1e152efbbbb4656b7b4866ba14b8ec - already built by 357 [poll] Latest remote head revision on refs/heads/v1.6.x is: fababe9cd990e1867e28f501b0e91faf1e920a5a - already built by 359 [poll] Latest remote head revision on refs/heads/v1.18.x is: 987f8c23304b99a6377cae63c7a9a7b5051f4e62 - already built by 361 [poll] Latest remote head revision on refs/heads/v1.1.x is: 4008675d54b10bafd675a25ba093190697af867f - already built by 365 [poll] Latest remote head revision on refs/heads/v1.22.x is: 2e47914dfa42cb595731b264cbecc277620aced0 - already built by 19 [poll] Latest remote head revision on refs/heads/v1.13.x is: cf834f5d3968d8b3996025fc1eb570d17b6a3083 Done. Took 2.4 sec Changes found refs/heads/v1.13.x is not detected as being already built, but instead of building that reference, the last reference is built (ace29d00302d20dddb3763057f31ab40b1fe8b4b (origin/v2.x.x)), so on the next polling the same happens, refs/heads/v1.13.x is detected as not being built and again the last version built gets rebuilt, getting into an infinite rebuilding loop. And this is how it looks when just leaving the branch specification empty: Started on Mar 30, 2016 12:59:00 PM Polling SCM changes on master Using strategy: Default [poll] Last Built Revision: Revision ace29d00302d20dddb3763057f31ab40b1fe8b4b (origin/v2.x.x) > git rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repositories > git config remote.origin.url git@github.com:some/repo.git # timeout=10 Pruning obsolete local branches Fetching upstream changes from git@github.com:some/repo.git > git --version # timeout=10 using GIT_SSH to set credentials cred SSH key > git -c core.askpass=true fetch --tags --progress git@github.com:some/repo.git +refs/heads/*:refs/remotes/origin/* --prune Polling for changes in Seen branch in repository origin/master Seen branch in repository origin/timeout-ex-log Seen branch in repository origin/v1.0.x Seen branch in repository origin/v1.1.x Seen branch in repository origin/v1.10.x Seen branch in repository origin/v1.11.x Seen branch in repository origin/v1.12.x Seen branch in repository origin/v1.13.x Seen branch in repository origin/v1.14.x Seen branch in repository origin/v1.15.x Seen branch in repository origin/v1.16.x Seen branch in repository origin/v1.17.x Seen branch in repository origin/v1.18.x Seen branch in repository origin/v1.19.x Seen branch in repository origin/v1.2.x Seen branch in repository origin/v1.20.x Seen branch in repository origin/v1.21.x Seen branch in repository origin/v1.22.x Seen branch in repository origin/v1.23.x Seen branch in repository origin/v1.24.x Seen branch in repository origin/v1.25.x Seen branch in repository origin/v1.26.x Seen branch in repository origin/v1.27.x Seen branch in repository origin/v1.28.x Seen branch in repository origin/v1.3.x Seen branch in repository origin/v1.4.x Seen branch in repository origin/v1.5.x Seen branch in repository origin/v1.6.x Seen branch in repository origin/v1.7.x Seen branch in repository origin/v1.8.x Seen branch in repository origin/v1.9.x Seen branch in repository origin/v2.x.x Seen 32 remote branches Done. Took 2.8 sec No changes All works well in this case.

          Using wildcards (* or **) in a default value of Git Parameter plugin is the only way (as far as I know) to use both SCM polling and manual revision choosing for a job. Leaving it empty breaks polling. So infinite polling breaks this kind of jobs.
          For my case (build takes a half of hour) new job is scheduled exactly at next polling interval and starts after a previous build finished.

          Evgeny Seliverstov added a comment - Using wildcards (* or **) in a default value of Git Parameter plugin is the only way (as far as I know) to use both SCM polling and manual revision choosing for a job. Leaving it empty breaks polling. So infinite polling breaks this kind of jobs. For my case (build takes a half of hour) new job is scheduled exactly at next polling interval and starts after a previous build finished.

          Eyal David added a comment -

          Hi
          is there a road map for this issue to be solved ?

          Eyal David added a comment - Hi is there a road map for this issue to be solved ?

          Mark Waite added a comment -

          eyaldavid there is not a road map for this issue to be solved. I'd love to see one or more automated tests written which show the problem, then a proposed change which fixes the problem. I am unlikely to investigate this failure for a long time.

          Mark Waite added a comment - eyaldavid there is not a road map for this issue to be solved. I'd love to see one or more automated tests written which show the problem, then a proposed change which fixes the problem. I am unlikely to investigate this failure for a long time.

          Alex Taylor added a comment -

          eyaldavid integer Have you been able to reproduce recently? I am having trouble reproducing a simple case with a freestyle job using a parameter. Mine seems to mark as already build by a previous version. If you have any pointers on how to recreate, I was going to make a test case.

          Alex Taylor added a comment - eyaldavid integer Have you been able to reproduce recently? I am having trouble reproducing a simple case with a freestyle job using a parameter. Mine seems to mark as already build by a previous version. If you have any pointers on how to recreate, I was going to make a test case.

            Unassigned Unassigned
            integer Kanstantsin Shautsou
            Votes:
            7 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated: