Jenkins job dsl for bitbucket branch source plugin documentation with complete examples?
Jenkins job dsl for bitbucket branch source plugin documentation with complete examples?
我目前有这个:
multibranchPipelineJob("myjob") {
branchSources {
branchSource {
source {
bitbucket {
credentialsId('bitbucket-login-user-pass')
repoOwner('myteam')
repository('myrepo')
autoRegisterHook(true)
}
}
}
}
}
但我还需要添加以下设置:
如何在配置中添加这些设置?他们 "traits" 我该去哪里查看我有哪些特质?
您可以查看您的 jenkins 实例的 jobDSL-API-Viewer。这将向您显示您的实例的所有可用 jodDSL 函数(已安装插件的 jobDSL):
https:///plugin/job-dsl/api-viewer/index.html
这是我使用的(用 organizationFolder
包装的 bitbucket):
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
}
}
}
multibranchPipelineJob('example'){
branchSources{
branchSource{
source{
bitbucket{
repoOwner(project)
repository(name)
credentialsId('git_user')
traits {
bitbucketBranchDiscovery{
strategyId(1)
}
}
}
}
}
}
在 DSL documentation and the strategyId correct value I found in the bitbucket plugin source code 中定义特征的地方。
从这里一定很容易发现其余的选项。
我目前有这个:
multibranchPipelineJob("myjob") {
branchSources {
branchSource {
source {
bitbucket {
credentialsId('bitbucket-login-user-pass')
repoOwner('myteam')
repository('myrepo')
autoRegisterHook(true)
}
}
}
}
}
但我还需要添加以下设置:
如何在配置中添加这些设置?他们 "traits" 我该去哪里查看我有哪些特质?
您可以查看您的 jenkins 实例的 jobDSL-API-Viewer。这将向您显示您的实例的所有可用 jodDSL 函数(已安装插件的 jobDSL):
https:///plugin/job-dsl/api-viewer/index.html
这是我使用的(用 organizationFolder
包装的 bitbucket):
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
}
}
}
multibranchPipelineJob('example'){
branchSources{
branchSource{
source{
bitbucket{
repoOwner(project)
repository(name)
credentialsId('git_user')
traits {
bitbucketBranchDiscovery{
strategyId(1)
}
}
}
}
}
}
在 DSL documentation and the strategyId correct value I found in the bitbucket plugin source code 中定义特征的地方。
从这里一定很容易发现其余的选项。