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

job-dsl has deprecated concurrentBuild() on pipeline jobs

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • job-dsl-plugin
    • None
    • Job DSL 1.71

      Per https://github.com/jenkinsci/job-dsl-plugin/wiki/Migration#migrating-to-170, and warnings in the console on seed jobs, concurrentBuild() is deprecated for pipeline jobs. Is this is error? concurrent builds can certainly be enabled/disabled on pipeline jobs.

          [JENKINS-53359] job-dsl has deprecated concurrentBuild() on pipeline jobs

          When looking into the config.xml, it seems that it's still `<concurrentBuild>false</concurrentBuild>` - so what should the replacement be for the supposedly-deprecated `concurrentBuild(false)` in pipeline jobs?

          Klaus Schniedergers added a comment - When looking into the config.xml, it seems that it's still `<concurrentBuild>false</concurrentBuild>` - so what should the replacement be for the supposedly-deprecated `concurrentBuild(false)` in pipeline jobs?

          Workaround:

          pipelineJob('jobname') {
              configure {
                  (it / 'concurrentBuild').setValue('false')
              }
          

          Klaus Schniedergers added a comment - Workaround: pipelineJob( 'jobname' ) { configure { (it / 'concurrentBuild' ).setValue( ' false ' ) }

          Grigor Lechev added a comment -

          I believe this is the new correct way to do it:

          pipelineJob("name") {
              properties {
                  disableConcurrentBuilds()
              }
              ...
          

          Grigor Lechev added a comment - I believe this is the new correct way to do it: pipelineJob( "name" ) { properties { disableConcurrentBuilds() } ...

          Thanks, that seems to work, mooncrosser.

          Klaus Schniedergers added a comment - Thanks, that seems to work, mooncrosser .

          Ilguiz Latypov added a comment - - edited

          I would expect that concurrentBuild()s still be allowed by default, but my keeping the "Do not allow" checkbox clear and allowing the multiple node selection in a parameter still generates a single run. The concurrent runs should be allowed/controlled outside our pipeline script even when the latter limits itself to that parameter in a chain "has to run on the node parameter JENKINS_PARAM_RUN_NODE node" -> "fetch the Jenkinsfile script from SCM" -> "execute the script" -> "start the DSL pipeline on a label specified again in DSL via the node parameter JENKINS_PARAM_RUN_NODE".

          ========== SCM Jenkinsfile =====================
          LIBRARY_PIPELINE(
            [
              jenkinsJobInitialAgent: env.JENKINS_PARAM_RUN_NODE ?: 'windows',
              ...
             ]
          )
          
          ========== the library's vars/LIBRARY_PIPELINE.groovy ===========
          def call(Map configuration) {
              pipeline {
                  agent  {
                      label configuration.jenkinsJobInitialAgent
                  }
                  ...
               }
          }
          

          Ilguiz Latypov added a comment - - edited I would expect that concurrentBuild()s still be allowed by default, but my keeping the "Do not allow" checkbox clear and allowing the multiple node selection in a parameter still generates a single run. The concurrent runs should be allowed/controlled outside our pipeline script even when the latter limits itself to that parameter in a chain "has to run on the node parameter JENKINS_PARAM_RUN_NODE node" -> "fetch the Jenkinsfile script from SCM" -> "execute the script" -> "start the DSL pipeline on a label specified again in DSL via the node parameter JENKINS_PARAM_RUN_NODE". ========== SCM Jenkinsfile ===================== LIBRARY_PIPELINE( [ jenkinsJobInitialAgent: env.JENKINS_PARAM_RUN_NODE ?: 'windows' , ... ] ) ========== the library's vars/LIBRARY_PIPELINE.groovy =========== def call(Map configuration) { pipeline { agent { label configuration.jenkinsJobInitialAgent } ... } }

            daspilker Daniel Spilker
            jhoblitt Joshua Hoblitt
            Votes:
            6 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: