
Пример Multibranch Pipeline файла конфигурации для DSL модуля, с кастомным Bitbucket сервером. Который будет включать в себя ветки: "develop", "staging" и "master". Будет хранить последние 15 сборок. И искать Jenkins файл по пути: ".jenkins/Jenkinsfile"
- Имя репозитория: artem-dsl
- Владелец (имя проекта): dev
- Креды доступа Jenkins’а к 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)
}
}
}