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

multibranchPipelineJob: add property strategy & script path options

XMLWordPrintable

      The job-dsl-plugin does not support the `Branch Sources > Property Strategy` and `Build Configuration > Script Path` options for multi-branch pipeline projects.

      It would useful to be able to specify these in the DSL similar to these examples:

      Apply Default Property Strategy to a Branch Source

      multibranchPipelineJob("my_awesome_job") {
          displayName "my awesome job"
          description "multi-branch pipeline job thingy"
          branchSources {
              git {   
                  remote('https://github.com/jenkinsci/job-dsl-plugin.git')
                  credentialsId('github-ci')
                  includes('JENKINS-*')
                  // set the default property strategy
                  defaultBranchPropertyStrategy {
                      noTriggerBranchProperty()
                  }
              }
          }
      }
      

       

      Apply Named Branch Property Strategy to a Branch Source

      multibranchPipelineJob("my_awesome_job") {
          displayName "my awesome job"
          description "multi-branch pipeline job thingy"
          branchSources {
              git {   
                  remote('https://github.com/jenkinsci/job-dsl-plugin.git')
                  credentialsId('github-ci')
                  includes('JENKINS-*')
                  // set the named branch property strategy
                  namedExceptionsBranchPropertyStrategy {
                      // only trigger branch build for the `master` branch
                      defaultProperties {
                          noTriggerBranchProperty()
                      }
                      namedException {
                          // could include noTriggerBranchProperty() here if there was no default properties
                          branch('master')
                      }
                  }
              }
          }
      }
      

      Set Script Path for the Project Factory

      multibranchPipelineJob("my_awesome_job") {
          displayName "my awesome job"
          description "multi-branch pipeline job thingy"
          branchSources {
              git {   
                  remote('https://github.com/jenkinsci/job-dsl-plugin.git')
                  credentialsId('github-ci')
                  includes('JENKINS-*')
              }
          }
          factory {
              workflowBranchProjectFactory {
          	    scriptPath('pipelines/entryPoint.groovy')
              }
          }
      }
      

            daspilker Daniel Spilker
            djfdyuruiry matthew snoddy
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: