在我的Jenkinsfile中,我并行执行两个阶段,其中一个阶段将由几个其他连续的阶段组成。当我运行脚本并检查BlueOcean中的管道时,该阶段序列表示为一个节点。
(简化的)脚本如下:
node {
stage('Stage 1') {...}
stage('Stage 2') {...}
stage('Stages 3 & 4 in parallel') {
parallel(
'Stage 3': {
stage('Stage 3') {...}
},
'Stage 4': {
stage('Stage 4a') {...}
stage('Stage 4b') {...}
}
)
}
}因此,在BlueOcean中,此脚本为阶段4生成一个节点,而我希望看到两个节点,因为它由两个连续的阶段组成。
发布于 2020-02-15 01:32:39
对于脚本管道,我也遇到过同样的问题。如果您可以使用声明性管道,则可以使用以下代码:
pipeline {
agent any
stages {
stage('Stage 1') { steps {pwd()}}
stage('Stage 2') { steps {pwd()}}
stage('Stages 3 & 4 in parallel') {
parallel {
stage('Stage 3') { steps {pwd()}}
stage('Stage 4') {
stages {
stage('Stage 4a') { steps {pwd()}}
stage('Stage 4b') { steps {pwd()}}
}
}
}
}
}
}

发布于 2020-08-04 22:20:13
在最新版本的jenkins 2.235.3和最新的插件中,这一点现在正在脚本管道中工作。
node ('fetch') {
stage('Stage 1') { sh(script:"echo Stage1",label: "sh echo stage 1")}
stage('Stage 2') { sh(script:"echo Stage2",label: "sh echo stage 2")}
stage('Stages 3 & 4 in parallel') {
parallel(
'Stage 3': {
stage('Stage 3') {sh(script:"echo Stage3",label: "sh echo stage 3")}
},
'Stage 4': {
stage('Stage 4a') {sh(script:"echo Stage4a",label: "sh echo stage 4a")}
stage('Stage 4b') {sh(script:"echo Stage4b",label: "sh echo stage 4b")}
}
)
}
}https://stackoverflow.com/questions/60230566
复制相似问题