pipeline { agent any stages { stage('test') { steps { jobDsl scriptText: """multibranchPipelineJob("job-features") { branchSources { branchSource { source { git { id('123456789') remote("gir-url.git") includes("feature/*") } } strategy { defaultBranchPropertyStrategy { props { noTriggerBranchProperty() } } } } } configure { def traits = it / sources / data / 'jenkins.branch.BranchSource' / source / traits traits << 'jenkins.plugins.git.traits.BranchDiscoveryTrait' {} } triggers { periodic(5) } orphanedItemStrategy { discardOldItems { daysToKeep(3) numToKeep(3) } } }""" } } }}
pipeline { agent any stages { stage('test') { steps { jobDsl scriptText:
"""multibranchPipelineJob("multibranch-name") { branchSources { git { id('12312312312') remote("gitproject.git") } } configure {
it / sources / data / 'jenkins.branch.BranchSource' / source / traits << { 'jenkins.plugins.git.traits.BranchDiscoveryTrait' {} 'jenkins.scm.impl.trait.WildcardSCMHeadFilterTrait' { includes('feature/*') excludes('') } }
it / sources / data / 'jenkins.branch.BranchSource' << {
strategy(class: 'jenkins.branch.DefaultBranchPropertyStrategy') { properties(class: 'java.util.Arrays\$ArrayList') { a(class: 'jenkins.branch.BranchProperty-array') { 'jenkins.branch.NoTriggerBranchProperty' { }