脚本式pipeline中failFast使用

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
def generateJobStage(String jobName) {
return {
node('master') {
echo "${jobName} start"
sleep 5
sh "exit 1"
echo "job end"
}
}
}
script {
def jobs = ['jobA', 'jobB', 'jobC']

def parallelStagesMap = jobs.collectEntries { def jobName ->
["${jobName}", generateJobStage(jobName)]
}
parallelStagesMap.failFast = true
println parallelStagesMap
stage("test") {
parallel parallelStagesMap
}
}