Reputation: 1511
I am completely new to the jenkins pipeline. I'm trying to create a project with multiple stages but in my Import
stage , I want to execute parallel
. For each stage
in parallel
, I have again multiple stages
. I'm trying the following way, but getting syntax error as It is not allowed to use stages more than once
.Can someone correct me how to achieve this, I have tried some online resources but unable to get clear syntax.
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'from build'
}
}
}
stage('Test_A') {
parallel {
stages("GUI") { stage("Tests_A") { steps {echo 'from A'}} stage("Archive") {echo 'from Publish' } }
stages("API") { stage("Tests_B") {steps {echo 'from B'} } }
stages("CLI") { stage("Tests_C") {steps {echo 'from C'} }}
}
}
}
I want to create something like this where a parallel stage will have a sequence of stages
Upvotes: 0
Views: 953
Reputation: 27766
A parallel
block can only have stage
children:
stage('Import') {
parallel {
stage("Import_A") {
stages {
stage("Tests_A") { steps { echo 'from A' } }
stage("Publish") { steps { echo 'from Publish' } }
}
}
stage("Import_B") {
...
}
... and so on
}
}
Also see example of official documentation.
Upvotes: 1