Scripted Pipeline 中如何正确设置并行构建的 stage 名称?
我在 Jenkins 的 Scripted Pipeline 里用 parallel 做并行任务,但每个分支的 stage 名字都显示成 “Branch A”、”Branch B” 这种默认名,想自定义成更有意义的名字,比如 “Build Frontend” 和 “Run Tests”,但改了之后 pipeline 就报错说 stage 名称无效,是不是写法有问题?
我试过这样写:
parallel(
"Build Frontend": {
stage("Build Frontend") {
sh 'npm run build'
}
},
"Run Tests": {
stage("Run Tests") {
sh 'npm test'
}
}
)
pre class="pure-highlightjs line-numbers">
parallel("Build Frontend": {
sh 'npm run build'
},
"Run Tests": {
sh 'npm test'
}
)