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

Declarative Pipeline shows SUCCESS even though job FAILED

    Details

    • Similar Issues:
    • Released As:
      pipeline-model-definition 1.3.7

      Description

      Pipelines are "failing" with SUCCESS status. 

      This pipeline, taken from JENKINS-46325 illustrates this issue successfully:

      pipeline {
          agent any
          stages {
              stage ('Init') {
                  steps {
                      echo "Init result: ${currentBuild.result}"
                      echo "Init currentResult: ${currentBuild.currentResult}"
                  }
                  post {
                      always {
                          echo "Post-Init result: ${currentBuild.result}"
                          echo "Post-Init currentResult: ${currentBuild.currentResult}"
                      }
                  }
              }
              stage ('Build') {
                  steps {
                      echo "During Build result: ${currentBuild.result}"
                      echo "During Build currentResult: ${currentBuild.currentResult}"
                      sh 'exit 1'
                  }
                  post {
                      always {
                          echo "Post-Build result: ${currentBuild.result}"
                          echo "Post-Build currentResult: ${currentBuild.currentResult}"
                      }
                  }
              }
          }
          post {
              always {
                  echo "Pipeline result: ${currentBuild.result}"
                  echo "Pipeline currentResult: ${currentBuild.currentResult}"
              }
          }
      }
      

       

      My results are (trimmed down):

      Running on build-096575a3-e6af-4fff-9ca1-84cc46ba4b86-f9b8d29c in /var/vcap/data/jenkins-slave/workspace/test-job
      Init result: null
      Init currentResult: SUCCESS
      Post stage
      Post-Init result: null
      Post-Init currentResult: SUCCESS
      During Build result: null
      During Build currentResult: SUCCESS
      [Pipeline] sh
      + exit 1
      Post stage
      Post-Build result: null
      Post-Build currentResult: SUCCESS
      Pipeline result: null
      Pipeline currentResult: SUCCESS
      ERROR: script returned exit code 1
      Finished: FAILURE
      

       

        Attachments

          Issue Links

            Activity

            pzozobrado Philip Zozobrado created issue -
            pzozobrado Philip Zozobrado made changes -
            Field Original Value New Value
            Description Pipelines are "failing" with SUCCESS status. 

            This pipeline, taken from JENKINS-46325 illustrates this issues successfully:
            {code}
            pipeline {
                agent any
                stages {
                    stage ('Init') {
                        steps {
                            echo "Init result: ${currentBuild.result}"
                            echo "Init currentResult: ${currentBuild.currentResult}"
                        }
                        post {
                            always {
                                echo "Post-Init result: ${currentBuild.result}"
                                echo "Post-Init currentResult: ${currentBuild.currentResult}"
                            }
                        }
                    }
                    stage ('Build') {
                        steps {
                            echo "During Build result: ${currentBuild.result}"
                            echo "During Build currentResult: ${currentBuild.currentResult}"
                            sh 'exit 1'
                        }
                        post {
                            always {
                                echo "Post-Build result: ${currentBuild.result}"
                                echo "Post-Build currentResult: ${currentBuild.currentResult}"
                            }
                        }
                    }
                }
                post {
                    always {
                        echo "Pipeline result: ${currentBuild.result}"
                        echo "Pipeline currentResult: ${currentBuild.currentResult}"
                    }
                }
            }
            {code}
             

            My results are (trimmed down):
            {noformat}
            Running on build-096575a3-e6af-4fff-9ca1-84cc46ba4b86-f9b8d29c in /var/vcap/data/jenkins-slave/workspace/test-job
            Init result: null
            Init currentResult: SUCCESS
            Post stage
            Post-Init result: null
            Post-Init currentResult: SUCCESS
            During Build result: null
            During Build currentResult: SUCCESS
            [Pipeline] sh
            + exit 1
            Post stage
            Post-Build result: null
            Post-Build currentResult: SUCCESS
            Pipeline result: null
            Pipeline currentResult: SUCCESS
            ERROR: script returned exit code 1
            Finished: FAILURE
            {noformat}
             
            Pipelines are "failing" with SUCCESS status. 

            This pipeline, taken from JENKINS-46325 illustrates this issue successfully:
            {code:java}
            pipeline {
                agent any
                stages {
                    stage ('Init') {
                        steps {
                            echo "Init result: ${currentBuild.result}"
                            echo "Init currentResult: ${currentBuild.currentResult}"
                        }
                        post {
                            always {
                                echo "Post-Init result: ${currentBuild.result}"
                                echo "Post-Init currentResult: ${currentBuild.currentResult}"
                            }
                        }
                    }
                    stage ('Build') {
                        steps {
                            echo "During Build result: ${currentBuild.result}"
                            echo "During Build currentResult: ${currentBuild.currentResult}"
                            sh 'exit 1'
                        }
                        post {
                            always {
                                echo "Post-Build result: ${currentBuild.result}"
                                echo "Post-Build currentResult: ${currentBuild.currentResult}"
                            }
                        }
                    }
                }
                post {
                    always {
                        echo "Pipeline result: ${currentBuild.result}"
                        echo "Pipeline currentResult: ${currentBuild.currentResult}"
                    }
                }
            }
            {code}
             

            My results are (trimmed down):
            {noformat}
            Running on build-096575a3-e6af-4fff-9ca1-84cc46ba4b86-f9b8d29c in /var/vcap/data/jenkins-slave/workspace/test-job
            Init result: null
            Init currentResult: SUCCESS
            Post stage
            Post-Init result: null
            Post-Init currentResult: SUCCESS
            During Build result: null
            During Build currentResult: SUCCESS
            [Pipeline] sh
            + exit 1
            Post stage
            Post-Build result: null
            Post-Build currentResult: SUCCESS
            Pipeline result: null
            Pipeline currentResult: SUCCESS
            ERROR: script returned exit code 1
            Finished: FAILURE
            {noformat}
             
            pzozobrado Philip Zozobrado made changes -
            Environment Jenkins 2.150.3, using a slave build executioner Jenkins 2.150.3, Pipeline 2.6, using a slave build executioner
            dnusbaum Devin Nusbaum made changes -
            Component/s pipeline-model-definition-plugin [ 21706 ]
            Component/s pipeline [ 21692 ]
            dnusbaum Devin Nusbaum made changes -
            Link This issue relates to JENKINS-55459 [ JENKINS-55459 ]
            kapoorlakshya Lakshya Kapoor made changes -
            Comment [ Test. ]
            abayer Andrew Bayer made changes -
            Link This issue is duplicated by JENKINS-56430 [ JENKINS-56430 ]
            steffen_wilke Steffen Wilke made changes -
            Priority Major [ 3 ] Critical [ 2 ]
            steffen_wilke Steffen Wilke made changes -
            Environment Jenkins 2.150.3, Pipeline 2.6, using a slave build executioner Jenkins 2.150.3, Pipeline 2.6, Pipeline: Declarative plugin v1.3.5, using a slave build executioner
            danielbeck Daniel Beck made changes -
            Link This issue is duplicated by JENKINS-56536 [ JENKINS-56536 ]
            bkihm Benjamin Kihm made changes -
            Link This issue causes JENKINS-44322 [ JENKINS-44322 ]
            abayer Andrew Bayer made changes -
            Status Open [ 1 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            dnusbaum Devin Nusbaum made changes -
            Released As pipeline-model-definition 1.3.7
            dnusbaum Devin Nusbaum made changes -
            Link This issue is duplicated by JENKINS-56590 [ JENKINS-56590 ]

              People

              • Assignee:
                Unassigned
                Reporter:
                pzozobrado Philip Zozobrado
              • Votes:
                23 Vote for this issue
                Watchers:
                40 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: