我目前有这个:
multibranchPipelineJob("myjob") {
branchSources {
branchSource {
source {
bitbucket {
credentialsId('bitbucket-login-user-pass')
repoOwner('myteam')
repository('myrepo')
autoRegisterHook(true)
}
}
}
}
}
如何在配置中添加这些设置?他们是“特征”,我该去哪里查看我拥有的特征?
答案 0 :(得分:2)
这就是我用的(用organizationFolder
包装的位桶)
organizationFolder('example') {
description('This contains branch source jobs for Bitbucket')
displayName('The Organization Folder')
triggers {
periodic(86400)
}
organizations {
bitbucket {
repoOwner('myorg')
credentialsId('BITBUCKET_CRED')
autoRegisterHooks(false)
traits {
sourceRegexFilter {
// A Java regular expression to restrict the project names.
regex('.*')
}
}
}
}
properties {
mavenConfigFolderOverrideProperty {
override(true)
settings {
settingsConfigId('DEFAULT_MAVEN_SETTINGS')
}
}
}
// discover Branches (workaround due to JENKINS-46202)
configure { node ->
// node represents <jenkins.branch.OrganizationFolder>
def traits = node / 'navigators' / 'com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMNavigator' / 'traits'
traits << 'com.cloudbees.jenkins.plugins.bitbucket.BranchDiscoveryTrait' {
strategyId(3) // detect all branches
}
}
}
答案 1 :(得分:0)
您可以查看jenkins-instance的jobDSL-API-Viewer。这将为您显示实例的所有可用jodDSL函数(已安装插件的jobDSL):
https://plugin/job-dsl/api-viewer/index.html
答案 2 :(得分:0)
multibranchPipelineJob('example'){
branchSources{
branchSource{
source{
bitbucket{
repoOwner(project)
repository(name)
credentialsId('git_user')
traits {
bitbucketBranchDiscovery{
strategyId(1)
}
}
}
}
}
}
DSL documentation中定义了特征,而我在bitbucket plugin source code中找到了strategyId正确值。
必须很容易从这里发现其余选项。