Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-54190

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • None
    • Worker Operating Systems: Debian Stretch
      Jenkins ver 2.138
      Pipeline ver 2.5
      Blue Ocean 1.8.3

      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}"
                  }
                }
              }
      
            }
          }
        }
      }
      

            abayer Andrew Bayer
            junzehe Junze He
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: