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

Make WorkflowJob.concurrentBuild into a JobProperty

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • pipeline
    • None

      As described in JENKINS-30519.

          [JENKINS-34547] Make WorkflowJob.concurrentBuild into a JobProperty

          Jesse Glick added a comment -

          no, the live version inside Jenkins

          Jesse Glick added a comment - no, the live version inside Jenkins

          Sid S added a comment -

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

          valentin92: 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

          Sid S added a comment - jglick : Why won't you mention the actual syntax here instead of RTFM? valentin92 : 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

          Jesse Glick added a comment -

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

          You do not.

          Jesse Glick added a comment - I'm not sure why we need to pass the blank pipelineTriggers([]) You do not.

          Sid S added a comment - - edited

          jglick: 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
          }

          Sid S added a comment - - edited jglick : 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 }

          Jesse Glick added a comment -

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

          Jesse Glick added a comment - properties should generally be at the very start of a Jenkinsfile .

          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)

          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 )

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

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

          Stefan Cordes added a comment -

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

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

          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?

          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?

          Jesse Glick added a comment -

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

          Jesse Glick added a comment - pbrokemann this is a question for the users’ list, not JIRA.

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

              Created:
              Updated:
              Resolved: