-
Bug
-
Resolution: Unresolved
-
Critical
-
Jenkins 2.150.3, Pipeline 2.6, Pipeline: Declarative plugin v1.3.5, using a slave build executioner
-
-
pipeline-model-definition 1.3.7
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
- 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