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

Declarative pipeline with pollSCM triggers 2 builds

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I have a multibranch declarative pipeline with a pollSCM trigger to poll every 2 minutes. Whenever there is a change to the branch in BitBucket it triggers correctly but about 2 minutes later it triggers again. I'm not sure if this is a bug or some configuration error on my behalf.

       

      I've attached a screenshot of the duplicate builds and poll log for one of the duplicate builds. Below is the top of my declarative pipeline for reference to how I am setting it up.

      pipeline {
         agent none
         environment {
            APPVERSION = '0.1.0'
            NUGET_API_KEY = credentials('build-server-nuget-id-readonly')
         }
         triggers {
             // poll repo every 2 minute for changes
             pollSCM('*/2 * * * *')
         }
         options {
             // add timestamps to output
             timestamps()
             overrideIndexTriggers(false)
             buildDiscarder(logRotator(numToKeepStr: '10'))
             skipStagesAfterUnstable()
             durabilityHint('PERFORMANCE_OPTIMIZED')
         }
      ...
      }

       

        Attachments

          Activity

          Hide
          jonathank Jonathan Kuleff added a comment -

          Mark Waite this has mostly fixed itself up. We are using AWS EFS to back our container cluster that Jenkins is running on and it turns out it didn't have enough IOPS credits, a recently feature that allows us to provision IOPS has seems to fix this up for us bar the occasional double build.

          Show
          jonathank Jonathan Kuleff added a comment - Mark Waite this has mostly fixed itself up. We are using AWS EFS to back our container cluster that Jenkins is running on and it turns out it didn't have enough IOPS credits, a recently feature that allows us to provision IOPS has seems to fix this up for us bar the occasional double build.
          Hide
          ascheman Gerd Aschemann added a comment - - edited

          I still encounter this problem every now and then. On a public Jenkins you can see it occasionally here: https://dev.dukecon.org/jenkins/job/dukecon_pwa/job/develop/, the respective Jenkinsfile is here: https://github.com/dukecon/dukecon_pwa/blob/develop/Jenkinsfile with 

          options { 
            disableConcurrentBuilds() 
            buildDiscarder(logRotator( numToKeepStr: '5', daysToKeepStr: '5'))
          }
          
          triggers { 
            pollSCM('* * * * *')
          }
           
          Show
          ascheman Gerd Aschemann added a comment - - edited I still encounter this problem every now and then. On a public Jenkins you can see it occasionally here:  https://dev.dukecon.org/jenkins/job/dukecon_pwa/job/develop/ , the respective Jenkinsfile is here:  https://github.com/dukecon/dukecon_pwa/blob/develop/Jenkinsfile  with  options { disableConcurrentBuilds() buildDiscarder(logRotator( numToKeepStr: '5' , daysToKeepStr: '5' )) } triggers { pollSCM( '* * * * *' ) }
          Hide
          priyatham Priyatham Tadikonda added a comment -

          I encounter this issue too. Do we have a solution for this yet? I'm using Multibranch Pipeline project and Github repostitory. We are polling every 5minutes but the build takes more than 30mins to complete.Duplicate Builds are being triggered with the same  commit ID.

          Please help me.

           

          Thank you.

          Show
          priyatham Priyatham Tadikonda added a comment - I encounter this issue too. Do we have a solution for this yet? I'm using Multibranch Pipeline project and Github repostitory. We are polling every 5minutes but the build takes more than 30mins to complete.Duplicate Builds are being triggered with the same  commit ID. Please help me.   Thank you.
          Hide
          markewaite Mark Waite added a comment -

          Priyatham Tadikonda no solution in progress and no solution proposed. We recommend that webhooks are better than polling (faster response, lighter load on the git server). See "polling must die" by Kohsuke Kawaguchi for more details. If polling is truly the only way to achieve your goal, then you might also consider setting the polling interval to be greater than the average build time.

          Show
          markewaite Mark Waite added a comment - Priyatham Tadikonda no solution in progress and no solution proposed. We recommend that webhooks are better than polling (faster response, lighter load on the git server). See "polling must die" by Kohsuke Kawaguchi for more details. If polling is truly the only way to achieve your goal, then you might also consider setting the polling interval to be greater than the average build time.
          Hide
          ganthore Mark Austin added a comment - - edited

          I'm seeing this happen with one of my teams using the multi-branch pipeline setup. Two different people are able to trigger the problem rather easily, but I can't for the life of me reproduce it, so this leads me to question if local browser configs/plugins are contributing to the problem.

          Now my use case is a little different since I don't even want polling, but I've noticed that PollSCM is switched on by default with any multibranch pipeline I setup.

          Show
          ganthore Mark Austin added a comment - - edited I'm seeing this happen with one of my teams using the multi-branch pipeline setup. Two different people are able to trigger the problem rather easily, but I can't for the life of me reproduce it, so this leads me to question if local browser configs/plugins are contributing to the problem. Now my use case is a little different since I don't even want polling, but I've noticed that PollSCM is switched on by default with any multibranch pipeline I setup.

            People

            • Assignee:
              Unassigned
              Reporter:
              jonathank Jonathan Kuleff
            • Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated: