All of the parallel stages with a regression post trigger will trigger if one of the stages fail.

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      This happens only if that stage fails before the other stages. If the failing stage happens last then the stages which have already completed as passing do not have their regression post conditions triggered. 

      Otherwise, the currentBuild.currentResult of the other stages, which should be passing, become FAILURE despite all of the steps being green.

      // Sample Jenkinsfile to test this
      #!groovy
      
      pipeline {
        agent {
          node {
            label ""
            customWorkspace "workspace/test_regression"
          }
        }
      
        options {
          buildDiscarder(logRotator(numToKeepStr: '50'))
          compressBuildLog()
          timestamps()
        }
      
        stages {
          stage('Parallel'){
            parallel {
              stage("Passing Stage 1") {
                options {
                  timeout(time: 120, unit: 'MINUTES')
                }
                steps {
                  sh "ls"
                }
                post {
                  regression {
                    echo "This stage has a regression"
                    echo "Current Result: ${currentBuild.currentResult}"
                    echo "Previous Build Result: ${currentBuild.previousBuild.result}"
                  }
                }
              }
      
              stage("Failing Stage 1") {
                options {
                  timeout(time: 120, unit: 'MINUTES')
                }
                steps {
                  sh "ls nothing"
                }
                post {
                  regression {
                    echo "This stage has a regression"
                    echo "Current Result: ${currentBuild.currentResult}"
                    echo "Previous Build Result: ${currentBuild.previousBuild.result}"
                  }
                }
              }
      
              stage("Passing Stage 2") {
                options {
                  timeout(time: 120, unit: 'MINUTES')
                }
                steps {
                  echo "Passing Stage"
                }
                post {
                  regression {
                    echo "This stage has a regression"
                    echo "Current Result: ${currentBuild.currentResult}"
                    echo "Previous Build Result: ${currentBuild.previousBuild.result}"
                  }
                }
              }
      
            }
          }
        }
      }
      

            Assignee:
            Andrew Bayer
            Reporter:
            Junze He
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: