没有方法签名:hudson1563131133260457651.parallel()

时间:2018-08-30 19:04:11

标签: jenkins groovy

我试图通过尝试执行groovy命令来设置Jenkins作业。具体来说,我试图根据某些条件调用并行作业。我知道应该使用Pipeline插件,但是我们的Jenkins尚未具备处理此插件的能力。同时,我正在尝试使用并行构造来实现并行化。这是我的Groovy代码,

def projectName = "stage_run_test"
def testCategory = ["Test1","Test2"]
def runMap = [:]


for (int i = 0; i < testCategory.size(); i++) {

    def index = i

    runMap[index] = {build job: projectName, parameters: [[$class: 
    'StringParameterValue', name: 'TEST', value: testCategory[index]], 
    [$class: 'StringParameterValue', name: 'BRANCH', value: 
    env.BRANCH], [$class: 'StringParameterValue', name: 
    'CHANGE', value: env.CHANGE]]}


}

parallel runMap

但是,当我运行此作业时,它会显示错误消息,

11:52:16 [stage_initiate_test] $ groovy /home/jenkins/workspace/stage_initiate_test/hudson1563131133260457651.groovy
11:52:17 Caught: groovy.lang.MissingMethodException: No signature of 
method: hudson1563131133260457651.parallel() is applicable for argument 
types: (java.util.LinkedHashMap) values: 
[[0:hudson1563131133260457651$_run_closure1@3f686e67, ...]]
11:52:17 groovy.lang.MissingMethodException: No signature of method: 
hudson1563131133260457651.parallel() is applicable for argument types: 
(java.util.LinkedHashMap) values: 
[[0:hudson1563131133260457651$_run_closure1@3f686e67, ...]]
11:52:17    at 
hudson1563131133260457651.run(hudson1563131133260457651.groovy:17)

我应该为此导入特定的内容吗?为什么Groovy Shell中的常规Jenkins作业无法使用并行方法?我可能缺少一些琐碎的东西,请帮助

0 个答案:

没有答案