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

multibranchPipelineJob: add property strategy & script path options

      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')
              }
          }
      }
      

          [JENKINS-49615] multibranchPipelineJob: add property strategy & script path options

          matthew snoddy created issue -
          matthew snoddy made changes -
          Description Original: 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:

          {code:groovy}
          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()
                      }
                  }
              }
          }
          {code}
           
          New: 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*

          {code:java}
          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()
                      }
                  }
              }
          }
          {code}
           

          *Apply Named Branch Property Strategy to a Branch Source*

          {code:java}
          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')
                          }
                      }
                  }
              }
          }
          {code}

          *Set Script Path for the Project Factory*

          {code:java}
          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')
                  }
              }
          }
          {code}
          matthew snoddy made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Daniel Spilker made changes -
          Assignee Original: matthew snoddy [ djfdyuruiry ] New: Daniel Spilker [ daspilker ]
          Resolution New: Fixed [ 1 ]
          Status Original: In Progress [ 3 ] New: Resolved [ 5 ]
          Daniel Spilker made changes -
          Status Original: Resolved [ 5 ] New: Closed [ 6 ]

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

              Created:
              Updated:
              Resolved: