我有一个MultiBranch管道作业,我想轮询我的Github来扫描任何新的提交并触发构建,所以请参阅我添加的文档
#!/usr/bin/env groovy
multibranchPipelineJob('mb-build') {
displayName('Multi Branch Build')
orphanedItemStrategy {
discardOldItems {
daysToKeep(1)
numToKeep(1)
}
}
triggers { pollSCM('H/2 * * * *') }
factory {
workflowBranchProjectFactory {
scriptPath('Jenkinsfile')
}
}
branchSources {
branchSource {
source {
git {
id('some-id')
remote('https://github.com/org/repo')
credentialsId('my-cred-here')
}
}
}
}
configure {
def traitsBlock = it / sources / data / 'jenkins.branch.BranchSource' / source / traits
traitsBlock << 'jenkins.plugins.git.traits.BranchDiscoveryTrait' {}
}
}
但我得到的错误是
ERROR: (unknown source) No signature of method: javaposse.jobdsl.dsl.helpers.triggers.MultibranchWorkflowTriggerContext.pollSCM() is applicable for argument types: (java.lang.String) values: [H/2 * * * *]
Possible solutions: collect(), collect(groovy.lang.Closure)
版本:Jenkins 2.319.3 job-dsl 1.77
1条答案
按热度按时间dauxcl2d1#
试试这样的方法: