不知道这是我对Groovy的有限了解还是Pipeline parallel步骤中的怪癖。failFast如果我使用map而不是单独传递每个闭包,则无法接受它:
parallel
failFast
def map = [:] map['spam'] = { node { echo 'spam' } } map['eggs'] = { node { echo 'eggs' } } parallel map // Works. parallel spam: map['spam'], eggs: map['eggs'], failFast: true // Works. parallel map, failFast: true // Fails with exception.
例外failFast是:
java.lang.IllegalArgumentException: Expected named arguments but got [{failFast=true}, {spam=org.jenkinsci.plugins.workflow.cps.CpsClosure2@51a382ad, eggs=org.jenkinsci.plugins.workflow.cps.CpsClosure2@718cb50d}] at org.jenkinsci.plugins.workflow.cps.DSL.parseArgs(DSL.java:276) at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:111)
map.failFast = true parallel map