我有一个DSL脚本来创建我的Jenkins管道作业。
String[] repos =
['xxx']
for (int i = 0; i < repos.length; i++) {
repoName = repos[i];
multibranchPipelineJob('PIPELINE-'+repoName) {
branchSources {
git {
remote('[email protected]:yyy/'+repoName+'.git')
credentialsId('112233445566')
}
}
description ("""<p> <b>generate by DSL - DO NOT CHANGE Manually </b> <p>""")
triggers {
periodic(2)
}
orphanedItemStrategy {
discardOldItems {
numToKeep(0)
daysToKeep(0)
}
}
}
}
这是一个添加子模块标签和分支发现的脚本
multibranchPipelineJob('example') {
branchSources {
branchSource {
source {
git {
credentialsId('1111-2222-3333')
remote('[email protected]:xxx/yyyy.git')
traits {
submoduleOptionTrait {
extension {
disableSubmodules(false)
recursiveSubmodules(true)
trackingSubmodules(false)
reference(null)
timeout(null)
parentCredentials(true)
}
}
cloneOptionTrait {
extension {
shallow (false)
noTags (false)
reference (null)
depth(0)
honorRefspec (false)
timeout (10)
}
}
}
}
}
}
}
triggers {
periodic(2)
}
configure {
def traits = it / sources / data / 'jenkins.branch.BranchSource' / source / traits
traits << 'jenkins.plugins.git.traits.BranchDiscoveryTrait' {}
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句