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

Multibranch pipeline does not allow quiet time or throttle

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • branch-api-plugin
    • None
    • Running jenkins 2.15 with pipeline-multibranch 2.8.
    • branch-api-plugin-2.6.0

      Currently, for an individual pipeline job I can set a quiet time to avoid one-for-one commit-to-build ratio when there are many commits in a short time. I like to use the multibranch plugin to allow branch automation, but there does not appear to be a way for a multibranch config (either the meta-job itself or from within a Jenkinsfile) to define a quiet time or some other ability to throttle job runs.

          [JENKINS-37588] Multibranch pipeline does not allow quiet time or throttle

          addib I tested it (Declarative) in multibranch as ogmueller reported and I had luck to see it working. Unfortunately I needed it to work in scripted mode because JTE (Jenking Template Engine) does not support Declarative.
          I ended up using this instruction and it works!

          }}{{currentBuild.rawBuild.getParent().setQuietPeriod(10){{}}

          About maven-release-plugin, I prefer not to use it anymor. Now I'm using :
          https://github.com/aleksandr-m/gitflow-maven-plugin{{}}

          vincenzo cerbone added a comment - addib I tested it (Declarative) in multibranch as ogmueller reported and I had luck to see it working. Unfortunately I needed it to work in scripted mode because JTE (Jenking Template Engine) does not support Declarative. I ended up using this instruction and it works! }}{{currentBuild.rawBuild.getParent().setQuietPeriod(10) {{}} About maven-release-plugin, I prefer not to use it anymor. Now I'm using : https://github.com/aleksandr-m/gitflow-maven-plugin {{}}

          Dibakar Aditya added a comment - - edited

          vincenzo_cerbone, I have tried both the Declarative and Scripted approach that you suggested on Jenkins 2.204.1 with the latest version of plugins. Though I can see the quiet period being set in the job configuration page of the branch, multibranch still chooses to ignore it.

          Dibakar Aditya added a comment - - edited vincenzo_cerbone , I have tried both the Declarative and Scripted approach that you suggested on Jenkins 2.204.1 with the latest version of plugins. Though I can see the quiet period being set in the job configuration page of the branch, multibranch still chooses to ignore it.

          Joe Cavanaugh added a comment - - edited

          I know I got this working when I was using Polling on the Multibranch pipeline. The quietPeriod was respected... however, when I moved to webhooks to kick off the pipeline through Bitbucket the quietPeriod(60) is no longer respected. I have gotten multiple complaints from Developers on this one as well.

              options {
                   buildDiscarder logRotator(numToKeepStr: '5')
                   disableConcurrentBuilds()
                   disableResume()
                   quietPeriod 60
                   timeout(time: 3, unit: 'HOURS')
                   skipStagesAfterUnstable()
                   parallelsAlwaysFailFast()
               }

          Joe Cavanaugh added a comment - - edited I know I got this working when I was using Polling on the Multibranch pipeline. The quietPeriod was respected... however, when I moved to webhooks to kick off the pipeline through Bitbucket the quietPeriod(60) is no longer respected. I have gotten multiple complaints from Developers on this one as well.     options {         buildDiscarder logRotator(numToKeepStr:  '5' )         disableConcurrentBuilds()         disableResume()         quietPeriod 60         timeout(time: 3, unit:  'HOURS' )         skipStagesAfterUnstable()         parallelsAlwaysFailFast()     }

          This would be useful in GitHub if one has a GitHub Action that pushes a commit to one's PR – to prevent the the PR from building prior to the GH Actions adding the new commit.

           

          Brian J Murrell added a comment - This would be useful in GitHub if one has a GitHub Action that pushes a commit to one's PR – to prevent the the PR from building prior to the GH Actions adding the new commit.  

          Chris Hemp added a comment -

          ^ Related to Github - With dependabot being enabled for a repo to update dependencies, it can be common to have a few PRs merge at once.  This quiet period would be helpful to have in those situations. 

          Chris Hemp added a comment - ^ Related to Github - With dependabot being enabled for a repo to update dependencies, it can be common to have a few PRs merge at once.  This quiet period would be helpful to have in those situations. 

          Deiwin Sarjas added a comment -

          Would it be possible possible to configure this once for the entire GitHub Organization? I read the thread and the PRs but I don't see how one could do that.

          Deiwin Sarjas added a comment - Would it be possible possible to configure this once for the entire GitHub Organization ? I read the thread and the PRs but I don't see how one could do that.

          Yogya Raj added a comment -

          Would it be possible to trigger one to one build for every commit with GitHub branch source plugin ,as i can see its triggering only one build for two PR merge

          Yogya Raj added a comment - Would it be possible to trigger one to one build for every commit with GitHub branch source plugin ,as i can see its triggering only one build for two PR merge

          Lenny added a comment -

          Quiet period does not work for ORG pipeline projects

          Lenny added a comment - Quiet period does not work for ORG pipeline projects

          Erich Mauerböck added a comment - - edited

          This still does not work with me, latest LTS jenkins 2.375.2 & branch-api-plugin 2.1051.v9985666b_f6cc

          I have the following in my declarative multibranch pipeline:

          options {
              quietPeriod 5
          }

          Unfortunately when viewing the configuration, the option is not checked, and obviously does not work either, the job is started immediately.

          yes, the job has run numerous times since the pipeline change.

          Btw. I need this only for a job triggered by some upstream job, like so:

          triggers {
              upstream 'Build Parent/develop'
          } 

          Erich Mauerböck added a comment - - edited This still does not work with me, latest LTS jenkins 2.375.2 & branch-api-plugin 2.1051.v9985666b_f6cc I have the following in my declarative multibranch pipeline: options { quietPeriod 5 } Unfortunately when viewing the configuration, the option is not checked, and obviously does not work either, the job is started immediately. yes, the job has run numerous times since the pipeline change. Btw. I need this only for a job triggered by some upstream job, like so: triggers { upstream 'Build Parent/develop' }

          Dennis added a comment -

          Thank you very much. Your post provided me with a wealth of information, allowing me to broaden my horizons. 

          redactle unlimited

           

          Dennis added a comment - Thank you very much. Your post provided me with a wealth of information, allowing me to broaden my horizons.  redactle unlimited  

            Unassigned Unassigned
            bsipos Brian Sipos
            Votes:
            51 Vote for this issue
            Watchers:
            59 Start watching this issue

              Created:
              Updated: