Rob*_*rdi 2 jenkins jenkins-job-dsl multibranch-pipeline
如何在 Jenkins 作业 DSL 中为多分支管道启用行为Discover Benches和 Property 策略Suppress 自动 SCM 触发?
可以这样做:
multibranchPipelineJob('job name') {
branchSources {
branchSource {
source {
git {
remote('https://<repo address>.git')
credentialsId('credential id')
}
}
strategy {
defaultBranchPropertyStrategy {
props {
noTriggerBranchProperty()
}
}
}
}
}
configure {
def traits = it / sources / data / 'jenkins.branch.BranchSource' / source / traits
traits << 'jenkins.plugins.git.traits.BranchDiscoveryTrait' {}
}
triggers {
periodic(2) // Trigger every 2 min.
}
orphanedItemStrategy { discardOldItems { numToKeep(-1) } }
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4701 次 |
| 最近记录: |