詹金斯从阵列开始按顺序防守赛段



我目前得到了一个数组,它具有在并行中运行的已定义的构建阶段

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"]

@Patrice Mbuild_stages.each{it->it.call((}

对我来说,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()}

最新更新