-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Minor
-
Component/s: workflow-cps-plugin
-
None
-
Environment:Jenkins 2.462.3
Pipeline: Groovy 3961.ve48ee2c44a_b_3
When a branch of "parallel" fails other branches still see currentBuild.currentResult == "SUCCESS".
I expected the whole build to be already marked as failed when one branch failed.
Example pipeline, with logs below. Note that "Failed in branch Fail fast" is printed a few seconds before entering the Deploy stage:
pipeline {
agent any
stages {
stage('Parallel stage') {
parallel {
stage('Fail fast') {
steps {
script { sh 'false' }
}
}
stage('Fail slow') {
steps {
script { sh 'sleep 10 && false' }
}
}
stage("Build and deploy") {
stages {
stage('Build') {
steps {
script { sh 'sleep 5' }
}
}
stage('Deploy') {
when { expression { currentBuild.currentResult == "SUCCESS" } }
steps {
script {sh 'echo "running the deploy"' }
}
}
}
}
}
}
} // stages
} // pipeline
Log:
2024-10-23 15:28:35.993 | [Pipeline] {
2024-10-23 15:28:36.033 | [Pipeline] stage
2024-10-23 15:28:36.038 | [Pipeline] { (Parallel stage)
2024-10-23 15:28:36.072 | [Pipeline] parallel
2024-10-23 15:28:36.086 | [Pipeline] { (Branch: Fail fast)
2024-10-23 15:28:36.089 | [Pipeline] { (Branch: Fail slow)
2024-10-23 15:28:36.092 | [Pipeline] { (Branch: Build and deploy)
2024-10-23 15:28:36.113 | [Pipeline] stage
2024-10-23 15:28:36.117 | [Pipeline] { (Fail fast)
2024-10-23 15:28:36.129 | [Pipeline] stage
2024-10-23 15:28:36.135 | [Pipeline] { (Fail slow)
2024-10-23 15:28:36.148 | [Pipeline] stage
2024-10-23 15:28:36.153 | [Pipeline] { (Build and deploy)
2024-10-23 15:28:36.187 | [Pipeline] stage
2024-10-23 15:28:36.190 | [Pipeline] { (Build)
2024-10-23 15:28:36.198 | [Pipeline] script
2024-10-23 15:28:36.206 | [Pipeline] {
2024-10-23 15:28:36.212 | [Pipeline] script
2024-10-23 15:28:36.216 | [Pipeline] {
2024-10-23 15:28:36.224 | [Pipeline] sh
2024-10-23 15:28:36.271 | [Pipeline] sh
2024-10-23 15:28:36.311 | [Pipeline] script
2024-10-23 15:28:36.315 | [Pipeline] {
2024-10-23 15:28:36.332 | [Pipeline] sh
2024-10-23 15:28:36.523 | + false
2024-10-23 15:28:36.545 | [Pipeline] }
2024-10-23 15:28:36.546 | + sleep 10
2024-10-23 15:28:36.593 | [Pipeline] // script
2024-10-23 15:28:36.607 | + sleep 5
2024-10-23 15:28:36.627 | [Pipeline] }
2024-10-23 15:28:36.667 | [Pipeline] // stage
2024-10-23 15:28:36.677 | [Pipeline] }
2024-10-23 15:28:36.688 | Failed in branch Fail fast
2024-10-23 15:28:41.867 | [Pipeline] }
2024-10-23 15:28:41.893 | [Pipeline] // script
2024-10-23 15:28:41.901 | [Pipeline] }
2024-10-23 15:28:41.927 | [Pipeline] // stage
2024-10-23 15:28:41.944 | [Pipeline] stage
2024-10-23 15:28:41.948 | [Pipeline] { (Deploy)
2024-10-23 15:28:42.003 | [Pipeline] script
2024-10-23 15:28:42.008 | [Pipeline] {
2024-10-23 15:28:42.031 | [Pipeline] sh
2024-10-23 15:28:42.303 | + echo 'running the deploy'
2024-10-23 15:28:42.303 | running the deploy
2024-10-23 15:28:42.334 | [Pipeline] }
2024-10-23 15:28:42.360 | [Pipeline] // script
2024-10-23 15:28:42.369 | [Pipeline] }
2024-10-23 15:28:42.394 | [Pipeline] // stage
2024-10-23 15:28:42.403 | [Pipeline] }
2024-10-23 15:28:42.429 | [Pipeline] // stage
2024-10-23 15:28:42.440 | [Pipeline] }
2024-10-23 15:28:46.507 | + false
2024-10-23 15:28:46.524 | [Pipeline] }
2024-10-23 15:28:46.555 | [Pipeline] // script
2024-10-23 15:28:46.585 | [Pipeline] }
2024-10-23 15:28:46.615 | [Pipeline] // stage
2024-10-23 15:28:46.627 | [Pipeline] }
2024-10-23 15:28:46.636 | Failed in branch Fail slow
2024-10-23 15:28:46.675 | [Pipeline] // parallel
2024-10-23 15:28:46.692 | [Pipeline] }
2024-10-23 15:28:46.716 | [Pipeline] // stage
2024-10-23 15:28:46.728 | [Pipeline] }
2024-10-23 15:28:46.753 | [Pipeline] // node
2024-10-23 15:28:46.773 | [Pipeline] End of Pipeline
2024-10-23 15:28:46.788 | ERROR: script returned exit code 1
2024-10-23 15:28:46.802 | Finished: FAILURE