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

Make WorkflowJob.concurrentBuild into a JobProperty

    Details

    • Type: Improvement
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: pipeline
    • Labels:
      None
    • Similar Issues:

      Description

      As described in JENKINS-30519.

        Attachments

          Issue Links

            Activity

            jglick Jesse Glick created issue -
            jglick Jesse Glick made changes -
            Field Original Value New Value
            Link This issue depends on JENKINS-30519 [ JENKINS-30519 ]
            jglick Jesse Glick made changes -
            Link This issue is duplicated by JENKINS-33939 [ JENKINS-33939 ]
            jglick Jesse Glick made changes -
            Epic Link JENKINS-35386 [ 171179 ]
            jglick Jesse Glick made changes -
            Link This issue is duplicated by JENKINS-35359 [ JENKINS-35359 ]
            abayer Andrew Bayer made changes -
            Assignee Jesse Glick [ jglick ] Andrew Bayer [ abayer ]
            abayer Andrew Bayer made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            abayer Andrew Bayer made changes -
            Remote Link This issue links to "workflow-job-plugin PR #8 (Web Link)" [ 14618 ]
            abayer Andrew Bayer made changes -
            Remote Link This issue links to "Test in workflow-multibranch-plugin PR #19 (Web Link)" [ 14619 ]
            jglick Jesse Glick made changes -
            Status In Progress [ 3 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 170693 ] JNJira + In-Review [ 198924 ]
            abayer Andrew Bayer made changes -
            Component/s pipeline-general [ 21692 ]
            abayer Andrew Bayer made changes -
            Component/s workflow-plugin [ 18820 ]
            Hide
            sid_s Sid S added a comment -

            How do users use this in their Jenkinsfile? Can't seem to find any documentation on this ...

            Show
            sid_s Sid S added a comment - How do users use this in their Jenkinsfile? Can't seem to find any documentation on this ...
            Hide
            jglick Jesse Glick added a comment -

            See Pipeline Syntax for properties.

            Show
            jglick Jesse Glick added a comment - See Pipeline Syntax for properties .
            Hide
            valentin92 Valentin Chartier added a comment -

            @Jesse : Are you refering to this "Pipeline Syntax" document https://jenkins.io/doc/book/pipeline/syntax/ ?
            Can you point where it addresses the issue ?

            Show
            valentin92 Valentin Chartier added a comment - @Jesse : Are you refering to this "Pipeline Syntax" document https://jenkins.io/doc/book/pipeline/syntax/ ? Can you point where it addresses the issue ?
            Hide
            jglick Jesse Glick added a comment -

            no, the live version inside Jenkins

            Show
            jglick Jesse Glick added a comment - no, the live version inside Jenkins
            Hide
            sid_s Sid S added a comment -

            Jesse Glick: Why won't you mention the actual syntax here instead of RTFM?

            Valentin Chartier: The syntax inside the jenkins' install itself suggests

            properties([disableConcurrentBuilds(), pipelineTriggers([])])

            I'm not sure why we need to pass the blank pipelineTriggers([]) ... but that's what it says

            Show
            sid_s Sid S added a comment - Jesse Glick : Why won't you mention the actual syntax here instead of RTFM? Valentin Chartier : The syntax inside the jenkins' install itself suggests properties([disableConcurrentBuilds(), pipelineTriggers([])]) I'm not sure why we need to pass the blank pipelineTriggers([]) ... but that's what it says
            Hide
            jglick Jesse Glick added a comment -

            I'm not sure why we need to pass the blank pipelineTriggers([])

            You do not.

            Show
            jglick Jesse Glick added a comment - I'm not sure why we need to pass the blank pipelineTriggers([]) You do not.
            Hide
            sid_s Sid S added a comment - - edited

            Jesse Glick: When trying to make the entire operation contained in the Jenkinsfile single instanced, do we stick that inside the node block, outside the node block or inside/outside every stage block?

            Putting it inside the node block doesn't seem to prevent concurrent builds.

            node

            { properties([disableConcurrentBuilds()]) // stages are here }
            Show
            sid_s Sid S added a comment - - edited Jesse Glick : When trying to make the entire operation contained in the Jenkinsfile single instanced, do we stick that inside the node block, outside the node block or inside/outside every stage block? Putting it inside the node block doesn't seem to prevent concurrent builds. node { properties([disableConcurrentBuilds()]) // stages are here }
            Hide
            jglick Jesse Glick added a comment -

            properties should generally be at the very start of a Jenkinsfile.

            Show
            jglick Jesse Glick added a comment - properties should generally be at the very start of a Jenkinsfile .
            Hide
            sc_rsc Stefan Cordes added a comment -

            Moving

            properties ([
            buildDiscarder(logRotator(numToKeepStr: '5'))
            ,
            disableConcurrentBuilds()
            ]);
            

            to the very first line does not hinder 2 feature branches to build in parallel (as reported in JENKINS-35359)

            Show
            sc_rsc Stefan Cordes added a comment - Moving properties ([ buildDiscarder(logRotator(numToKeepStr: '5')) , disableConcurrentBuilds() ]); to the very first line does not hinder 2 feature branches to build in parallel (as reported in JENKINS-35359 )
            Hide
            pleibiger Peter Leibiger added a comment -

            Stefan Cordes AFAIK two feature branches are two different jobs with two different workspaces. You can not prevent concurrent builds this way.

            Show
            pleibiger Peter Leibiger added a comment - Stefan Cordes AFAIK two feature branches are two different jobs with two different workspaces. You can not prevent concurrent builds this way.
            Hide
            sc_rsc Stefan Cordes added a comment -

            Correct. Taking a look into WorkflowJob.java shows that it is kind of Workspace-Lock.

            Show
            sc_rsc Stefan Cordes added a comment - Correct. Taking a look into  WorkflowJob.java  shows that it is kind of Workspace-Lock.
            Hide
            pbrokemann Kofi Brokemann added a comment -

            Hi is there a way to set properties for a multibranch / organization job to prevent concurrent builds? I know multi-branch jobs work in two different workspaces but would it be possible to provide a setting prevent concurrent builds at the project level?

            Show
            pbrokemann Kofi Brokemann added a comment - Hi is there a way to set properties for a multibranch / organization job to prevent concurrent builds? I know multi-branch jobs work in two different workspaces but would it be possible to provide a setting prevent concurrent builds at the project level?
            Hide
            jglick Jesse Glick added a comment -

            Kofi Brokemann this is a question for the users’ list, not JIRA.

            Show
            jglick Jesse Glick added a comment - Kofi Brokemann this is a question for the users’ list, not JIRA.

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                jglick Jesse Glick
              • Votes:
                2 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: