Jenkins从阵列中按顺序运行防御阶段

fcg9iug3  于 2022-12-03  发布在  Jenkins
关注(0)|答案(2)|浏览(170)

我目前得到了一个数组,其中定义了并行运行的构建阶段

def build_stages =[:]

build_stages["one"]={echo "one"}
build_stages["two"]={echo "two"}
build_stages["three"]={echo "three"}

parallel build_stages

显然,这些阶段并行运行
是否有语法选项允许以串行运行方式运行这些阶段?

build_stages["one"] --> build_stages["two"] --> build_stages["three"]
idfiyjo8

idfiyjo81#

作者:Patrice M build_stages.each {它-〉it.call()}

wb1gzix0

wb1gzix02#

对我来说,build_stages.each { it -> it.call() }不工作,并在日志中获得异常:

hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: java.util.AbstractMap$SimpleImmutableEntry.call() is applicable for argument types: () values: []
Possible solutions: wait(), any(), wait(long), each(groovy.lang.Closure), any(groovy.lang.Closure), wait(long, int)

正确的解决方案是调用Map中每个键的存储值,如下所示:
build_stages.each {key, value -> value()}

相关问题