Check parallel stages status

I have something like this:

stages {
    stage('createTemplate') {
        parallel {
            stage('template_a') {
                creating template a
            }
            stage('template_b') {
                creating template b
            }
        }
    }
    stage('deployVm') {
        parallel {
            stage('deploy_a') {
                deploy vm a
            }
            stage('deploy_b') {
                deploy vm b
            }
        }
    }
}

How can I make sure that deployVm stages run when and only when respective createTemplate stages were successful?

Upvotes: 1

Views: 634

Answers (1)

MaratC
MaratC

Reputation: 6859

You may want to run one parallel like this:

parallel {
  stage('a') { 
    stages { 
      stage ('template_a') { ... } 
      stage ('deploy_a') { ... } 
    }
  stage('b') {
    stages {
      stage ('template_b') { ... }
      stage ('deploy_b') { ... } 
    }
  }
}

This will make sure only stages that deploy are the ones following successful template stages.

Upvotes: 2

Related Questions