I fixed it using this:
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' { }
}
}
}
}
}
triggers {
periodic(5)
}
orphanedItemStrategy {
discardOldItems {
daysToKeep(3)
numToKeep(3)
}
}
}"""
}
}
}
}
On Monday, 20 January 2020 21:42:57 UTC, Alex wrote:
>
>
> 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)
> }
> }
> }"""
> }
> }
> }
> }
>
> I am trying to create a job using job-dsl to seed a multibranch job that
> includes auto discovery of branches and the supress scm strategy. For some
> reason in this format the includes option is not working. Any ideas?
>
>
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/234428ef-f769-4562-81c2-055333ee0f8d%40googlegroups.com.