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

            Hide
            kostrzewa9ld Zbigniew Kostrzewa added a comment -

            Does anyone know when 1.3.7 will be released?

            Show
            kostrzewa9ld Zbigniew Kostrzewa added a comment - Does anyone know when 1.3.7 will be released?
            Hide
            abayer Andrew Bayer added a comment -

            Hopefully this week - we’re trying to solve a bug in the original fix that created this problem in the first place, but if we aren’t able to nail that down in the next couple days, I’ll release 1.3.7 as it is now.

            Show
            abayer Andrew Bayer added a comment - Hopefully this week - we’re trying to solve a bug in the original fix that created this problem in the first place, but if we aren’t able to nail that down in the next couple days, I’ll release 1.3.7 as it is now.
            Hide
            abayer Andrew Bayer added a comment -

            Released just now as 1.3.7 - let us know if you see any problems and we'll get on them ASAP!

            Show
            abayer Andrew Bayer added a comment - Released just now as 1.3.7 - let us know if you see any problems and we'll get on them ASAP!
            Hide
            flx Felix Retter added a comment -

            Thanks Andrew. 1.3.7 looks very promising

            Show
            flx Felix Retter added a comment - Thanks Andrew. 1.3.7 looks very promising
            Hide
            bitwiseman Liam Newman added a comment -

            Bulk closing resolved issues.

            Show
            bitwiseman Liam Newman added a comment - Bulk closing resolved issues.

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: