Details
-
Bug
-
Status: Reopened (View Workflow)
-
Critical
-
Resolution: Unresolved
-
Jenkins 2.150.3, Pipeline 2.6, Pipeline: Declarative plugin v1.3.5, using a slave build executioner
-
-
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
- causes
-
JENKINS-44322 email-ext sends wrong build status when called from declarative script
-
- Closed
-
- is duplicated by
-
JENKINS-56430 In latest version of pipeline plugins, currentBuild.result is not correctly set any more for unstable/failure/aborted builds
-
- Closed
-
-
JENKINS-56536 currentBuild.currentResult not set to failed
-
- Closed
-
-
JENKINS-56590 Declarative pipeline post stage - Always step set wrong currentResult status
-
- Closed
-
- relates to
-
JENKINS-55459 failFast option for parallel stages should be able to set build result to FAILED
-
- Closed
-
- links to
Activity
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} |
Environment | Jenkins 2.150.3, using a slave build executioner | Jenkins 2.150.3, Pipeline 2.6, using a slave build executioner |
Component/s | pipeline-model-definition-plugin [ 21706 ] | |
Component/s | pipeline [ 21692 ] |
Link |
This issue relates to |
Comment | [ Test. ] |
Link |
This issue is duplicated by |
Priority | Major [ 3 ] | Critical [ 2 ] |
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 |
Link |
This issue is duplicated by |
Link |
This issue causes |
Resolution | Fixed [ 1 ] | |
Status | Open [ 1 ] | Resolved [ 5 ] |
Released As | pipeline-model-definition 1.3.7 |
Link |
This issue is duplicated by |
Status | Resolved [ 5 ] | Closed [ 6 ] |
Resolution | Fixed [ 1 ] | |
Status | Closed [ 6 ] | Reopened [ 4 ] |
Resolution | Fixed [ 1 ] | |
Status | Reopened [ 4 ] | Closed [ 6 ] |
Remote Link | This issue links to "jenkinsci/pipeline-model-definition-plugin#319 (Web Link)" [ 24222 ] |
Resolution | Fixed [ 1 ] | |
Status | Closed [ 6 ] | Reopened [ 4 ] |
I'm experiencing the same. currentBuild.currentResult for all failed and aborted builds returns "SUCCESS". Same when using $BUILD_STATUS through the emailext plugin.
Using Jenkins version 2.150.3 and Pipeline 2.6. All pipeline related plugins are at the latest version as well.