3

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

enter image description here

2

Got answer from StackOverflow and here is the link to the answer.

stage('Test') {
    parallel {
        stage("Test_A") { 
            stages {
                stage("Tests_A") { steps { echo 'from A' } } 
                stage("Archieve") { steps { echo 'from Archieve' } }
            }
        }
        stage("Test_B") {
            ...
        }

        ... and so on
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.