使用dsl作业在jenkins中创建multibranch管道作业,使用插件运行jenkins 2.107.1使用Bitbucket分支源插件的Branch API Plugin 2.0.18 2.2.10无法找到合适的配置功能以启用属性“抑制自动SCM触发” - 帮助!
这是我的工作......但是只要它扫描分支
就会触发构建 multibranchPipelineJob("job") {
configure {
it / sources / data / 'jenkins.branch.BranchSource' / source(class: 'com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource') {
credentialsId('..')
id("..")
checkoutCredentialsId("..")
repoOwner("owner")
repository("my-repo")
includes()
excludes("PR-*")
}
}
}
答案 0 :(得分:3)
这是它现在的工作原理..借助以下源代码..
https://github.com/jenkinsci/bitbucket-branch-source-plugin
multibranchPipelineJob("job") {
branchSources {
branchSource {
source {
bitbucket {
credentialsId("myid")
repoOwner("iam")
repository("job")
traits {
headWildcardFilter {
includes("branchestoinclude")
excludes("toexclude")
}
}
}
}
strategy {
defaultBranchPropertyStrategy {
props {
// keep only the last 8 builds
buildRetentionBranchProperty {
buildDiscarder {
logRotator {
daysToKeepStr("-1")
numToKeepStr("8")
artifactDaysToKeepStr("-1")
artifactNumToKeepStr("-1")
}
}
}
}
}
}
}
}
// Branch behaviour
configure {
def traits = it / sources / data / 'jenkins.branch.BranchSource' / source
/ traits
traits << 'com.cloudbees.jenkins.plugins.bitbucket.BranchDiscoveryTrait' {
strategyId(3) // detect all branches -refer the plugin source code for various options
}
}
orphanedItemStrategy {
discardOldItems {
numToKeep(8)
}
}
}