
Example Multibranch Pipeline configuration file for a DSL module, with a custom Bitbucket server. Which will include branches: "develop", "staging" and "master". Will store the last 15 builds. And look for Jenkins file along the path: ".jenkins/Jenkinsfile"
- Repository name: artem-dsl
- Owner (project name): dev
- Loans of Jenkins access to Bitbucket: svn-bibucket
multibranchPipelineJob('artem-dsl') {
displayName('Artem-DSL')
description('DSL test')
branchSources {
branchSource {
source {
bitbucket {
serverUrl('https://git.artem.services')
repoOwner('dev')
repository('artem-dsl')
credentialsId('svc-bitbucket')
traits {
headWildcardFilter {
excludes('')
includes('develop staging master')
}
}
}
}
}
}
configure {
def traits = it / sources / data / 'jenkins.branch.BranchSource' / source / traits
traits << 'com.cloudbees.jenkins.plugins.bitbucket.BranchDiscoveryTrait' {
strategyId(3) // detect all branches
}
}
factory {
workflowBranchProjectFactory {
scriptPath('.jenkins/Jenkinsfile')
}
}
orphanedItemStrategy {
discardOldItems {
numToKeep(15)
}
}
}