运行以下管道代码,在管道阶段视图中仅显示“阶段1”。 我在这里缺少什么,这阻止了“第2阶段”的出现?
def jobs = ["JobA", "JobB", "JobC"]
def parallelStagesMap = jobs.collectEntries {
["${it}" : generateStage(it)]
}
def generateStage(job) {
return {
stage('stage 1') {
sh 'echo stage 1'
}
stage('stage 2') {
sh 'echo stage 2'
}
}
}
pipeline {
agent any
stages {
stage('non-parallel stage') {
steps {
echo 'This stage will be executed first.'
}
}
stage('parallel stage') {
steps {
script {
parallel parallelStagesMap
}
}
}
}
}