Using failFast with closure map breaks “parallel” step

前端 未结 3 2135
粉色の甜心
粉色の甜心 2021-02-18 23:05

Not sure if it\'s my limited knowledge of Groovy or a quirk in Pipeline parallel step. I can\'t make it accept failFast if I use map instead of passing

相关标签:
3条回答
  • 2021-02-18 23:34

    It helps a little if you add the optional syntax in. The second option is passing a new Map while the third option is passing your original Map and an additional named parameter. Honestly I'm not sure what it thinks is going on.

    parallel(map)
    parallel([
        spam: map['spam'],
        eggs: map['eggs'],
        failFast: true
    ])
    parallel map, failFast: true
    

    In any case I think the simplest thing would be this:

    def map = [
        spam: {
            node {
                echo 'spam'
            }
        },
        eggs: {
            node {
                echo 'eggs'
            }
        },
        failFast: true
    ]
    parallel map
    

    or...

    parallel ([
        spam: {
            node {
                echo 'spam'
            }
        },
        eggs: {
            node {
                echo 'eggs'
            }
        },
        failFast: true
    ])
    
    0 讨论(0)
  • 2021-02-18 23:35
    map.failFast = true
    parallel map
    
    0 讨论(0)
  • 2021-02-18 23:49

    In addition to Jesse Glick's answer.

    Even if you use a for loop to create a parallel stages you can use the same code -

    map.failFast = true
    parallel map
    
    0 讨论(0)
提交回复
热议问题