我正在为我的参数化管道作业尝试以下代码。我想启动从参数中取出的作业名称来并行运行。 而那些工作也参与了工作。如何启动参数化管道作业以触发并行构建。我也尝试过使用list,但它没有用。任何人都可以建议我哪里出错了
def stepsForParallel = [:]
node {
JOBS=JOB_NAMES.split(',');
for (job in JOBS) {
def stepName = "running_${job}"
stepsForParallel[stepName] = { -> build job: "runnning_$job", parameters: [string(name: 'BRANCH',value: $BRANCH),string(name: 'CHANGE_NUMBER',value: $CHANGE_NUMBER)] }
}
parallel stepsForParallel
}
我的输出如下:
[Pipeline] parallel
[Pipeline] [running_a] { (Branch: running_a)
[Pipeline] [running_b] { (Branch: running_b)
[Pipeline] [running_a] }
[running_a] Failed in branch running_a
[Pipeline] [running_b }
[running_b] Failed in branch running_b
[Pipeline] }
[Pipeline] End of Pipeline
an exception which occurred:
in field itr
in field target
in field continue_
in field parent
in field parent
in field parent
in field parent
in field parent
in field parent
in field capture
in field def
in field locals
in field capture
in field def
in field closures
in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@5e5624f3
Caused: java.io.NotSerializableException: java.util.AbstractList$Itr
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:860)
at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
如何启动参数化管道作业以触发并行构建。我也尝试过使用list,但它没有用。任何人都可以建议我哪里出错了
答案 0 :(得分:1)
与JENKINS-34645有关。
尝试删除heightInM = ((Double(heightInFeetText.text!)! * 30.48) + (Double(heightInInchText.text!)! * 2.54))/100
output = Double(weightInKgText.text!)! / (heightInM * heightInM)
bmiOutput.text = String(output)
循环周围的node {}
并将迭代移至for
函数。像这样的东西
@NonCPS