gpt4 book ai didi

jenkins - "java.lang.IllegalArgumentException: Expected a closure or failFast"运行并行构建时出现异常

转载 作者:行者123 更新时间:2023-12-04 14:19:56 40 4
gpt4 key购买 nike

我有一个管道,它有两个按顺序并行运行。
在许多从站中并行设置,在所有机器设置完成后,我有一个构建和运行阶段,代码如下。但是当我尝试运行脚本时,我收到错误 java.lang.IllegalArgumentException: Expected a closure or failFast but found 0=org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper .
引用代码:

def slaves = params.slaves

stage('Setup'){
for(int i=0; i<slaves.size(); ++i){
def slave = slaves[i]
setup_builds[i] = build job: 'setup', parameters: [[$class: 'LabelParameterValue', name: 'TestMachine', label: slave]]
}
parallel setup_builds
}
stage('Build, run) {
for (int i = 0; i < 4; ++i){
def index = i
builds[i] = {
stage('Build') {
build job: 'Build'
}

stage('Run') {
build job: 'Run', parameters: [string(name: 'index', value: index)]
}
}
}

parallel builds
}

我试过使用 setup_builds.failFast = truebuilds.failFast = true之前 parallel setup_buildsparallel builds .但即使这样也没有解决问题。

最佳答案

我认为问题之一是它期望在 setup_builds 级别上关闭:

setup_builds[i] =  { build job: 'setup' ... }

关于jenkins - "java.lang.IllegalArgumentException: Expected a closure or failFast"运行并行构建时出现异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56122816/

40 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com