Check parallel stages status

混江龙づ霸主 提交于 2021-02-10 17:33:25

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/60759214/check-parallel-stages-status

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!