jenkinsci / jenkinsci/workflow-cps-plugin

[JENKINS-71838] Stage result unchangeable after parallel step

Open
#1,669 0 comments 0 reactions 0 assignees View on GitHub
component:workflow-cps-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
186
Forks
213
Avg merge
12h 12m
Merged PRs (30d)
8

Description

After parallel step, stage result (as observed through Stage View/wfapi) will be fixed to the result of the parallel step. Steps that follow within the same stage do not affect the stage result (build result works as expected).

For example, the following pipeline has a parallel step that succeeds and after that a step that fails.

Expected behavior:



  • build result: FAILURE

  • stage result: FAILURE

Actual behavior:



  • build result: FAILURE

  • stage result: SUCCESS (=result of parallel step)

 

node {

    stage('shouldFail') {
        def parallelMap = [
            'foo': {
                println 'foo'
            },
            'bar': {
                println 'bar'
            }
        ]
        
        parallel parallelMap // successful parallel step
        error 'Error after parallel step'
    }
}

 

 

Same behavior can be observed when the parallel step is used inside a script block of a declarative pipeline. Interestingly, the execution of post blocks is not affected and works as expected. In the example below, post blocks for stage failure and pipeline failure run.

 

pipeline {

    agent any
    stages {
        stage('ShouldFail') {
            steps {
                script {
                    def parallelMap = [
                        foo: {
                            println "foo"
                        },
                        bar: {
                            println "bar"
                        }
                    ]                   
parallel parallelMap // successful parallel step
                    error "Error after parallel step"
                }
            }
            post {
                success {
                    println 'Post Stage: SUCCESS'
                }
                failure {
                    println 'Post Stage: FAILURE'
                }
            }
        }
    }
    post {
        success {
            println 'Post Pipeline: SUCCESS'
        }
        failure {
            println 'Post Pipeline: FAILURE'
        }
    }
}

 

 

 

I found two Workarounds for this issue:



  • Ensure parallel step is the very last step of a stage

  • Use parallel section (only declarative pipeline)

---
Originally reported by lars_licha, imported from: Stage result unchangeable after parallel step


  • status: Open
  • priority: Minor
  • component(s): workflow-cps-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 2025-12-07

Raw content of original issue

After parallel step, stage result (as observed through Stage View/wfapi) will be fixed to the result of the parallel step. Steps that follow within the same stage do not affect the stage result (build result works as expected).

For example, the following pipeline has a parallel step that succeeds and after that a step that fails.

Expected behavior:



  • build result: FAILURE

  • stage result: FAILURE

Actual behavior:



  • build result: FAILURE

  • stage result: SUCCESS (=result of parallel step)

 



node {

    stage('shouldFail') {
        def parallelMap = [
            'foo': {
                println 'foo'
            },
            'bar': {
                println 'bar'
            }
        ]
        
        parallel parallelMap // successful parallel step
        error 'Error after parallel step'
    }
}


 

 

Same behavior can be observed when the parallel step is used inside a script block of a declarative pipeline. Interestingly, the execution of post blocks is not affected and works as expected. In the example below, post blocks for stage failure and pipeline failure run.

 



pipeline {

    agent any
    stages {
        stage('ShouldFail') {
            steps {
                script {
                    def parallelMap = [
                        foo: {
                            println "foo"
                        },
                        bar: {
                            println "bar"
                        }
                    ]                   
parallel parallelMap // successful parallel step
                    error "Error after parallel step"
                }
            }
            post {
                success {
                    println 'Post Stage: SUCCESS'
                }
                failure {
                    println 'Post Stage: FAILURE'
                }
            }
        }
    }
    post {
        success {
            println 'Post Pipeline: SUCCESS'
        }
        failure {
            println 'Post Pipeline: FAILURE'
        }
    }
}


 

 

 

I found two Workarounds for this issue:



  • Ensure parallel step is the very last step of a stage

  • Use parallel section (only declarative pipeline)


environment

```
workflow-cps version: 3731.ve4b_5b_857b_a_d3

Jenkins version: 2.401.2
```

1 attachment

- [Screenshot.png](https://issues.jenkins.io/secure/attachment/61019/Screenshot.png)
> ![Screenshot.png](https://issues.jenkins.io/secure/attachment/61019/Screenshot.png)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the scripted and declarative pipeline examples in the report, observing stage results through Stage View or wfapi. Trace the workflow-cps-plugin handling of parallel steps and subsequent failures; done means a failure after a successful parallel step reports the stage result as FAILURE while preserving the existing build result and post-block behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
ci-cd
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.