Setting Dependencies or Priorities in parallel stages in Jenkins pipeline

前端 未结 2 1987
忘了有多久
忘了有多久 2021-01-19 10:52

I am doing parallel steps as -

stages {
    stage (\'Parallel build LEVEL 1 - A,B,C ...\') {
        steps{
            parallel (
                \"Build          


        
2条回答
  •  面向向阳花
    2021-01-19 11:23

    You most definitely can. Try something like this:

    stages {
        stage ('Parallel build LEVEL 1 - A/C+B ...') {
            parallel {
                stage("Build A") {
                    agent { node { label 'A'}}
                    steps {
                        buildAndArchive(A)
                    }
                }
                stage("Build C and B") {
                  stages {
                    stage("Build C") {
                      agent { node { label 'C'}}
                      steps {
                          buildAndArchive(C)
                      }
                    }
                    stage("Build B") {
                      agent { node { label 'B'}}
                      steps {
                          buildAndArchive(B)
                      }
                    }
                  }
    
    

    This will execute two branches in parallel, where one is building A, and the other sequentially building C and then B.

    See also https://jenkins.io/blog/2018/07/02/whats-new-declarative-piepline-13x-sequential-stages/

提交回复
热议问题