Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallel Stages Status Update Delay in Pipeline Execution #521

Open
Deboprk opened this issue Oct 4, 2024 · 0 comments
Open

Parallel Stages Status Update Delay in Pipeline Execution #521

Deboprk opened this issue Oct 4, 2024 · 0 comments

Comments

@Deboprk
Copy link

Deboprk commented Oct 4, 2024

Jenkins and plugins versions report

Environment
Jenkins 2.440.2
Pipeline Graph View Plugin  Version243.vc9e11fec486a_

What Operating System are you using (both controller, and any agents involved in the problem)?

Ubuntu22

Reproduction steps

  1. Create dummy Job using below pipeline script( This job will be called using the other job )
pipeline {
    agent any
    stages {
        stage('Hello') {
            steps {
                script{
                    if ("${params.StatusChoice}" == "Fail"){
                        error("Failing Job")
                    }
                
                    if ("${params.StatusChoice}" == "Unstable"){
                        unstable("unstable Job")
                    }
                }
            }
        }
    }
}
  1. Create Test Job using below pipeline script
pipeline {
    agent any
    stages {
        stage('Stage 1') {
            steps {
                echo 'This is stage 1'
            }
        }
        stage('Parallel Stage') {
            steps {
                script {
                    LinkedHashMap parallelStages = [:]
                    for (int i = 0; i < 3; i++) {
                        def stageName = "Stage P-${i}"
                        parallelStages[stageName] = {
                            script {
                                def stageStatus="Pass"
                                if ("${stageName}" == "Stage P-0") {
                                   sh "sleep 30"
                                }
                                if ("${stageName}" == "Stage P-1") {
                                    println("At stage 2")
                                    stageStatus = "Fail"
                                }
                                if ("${stageName}" == "Stage P-2") {
                                    println("At stage 3")
                                    stageStatus = "Unstable"
                                }
                                def childJobBuild = build(
                                    job: "dummy",
                                    propagate: false,
                                    wait: true,
                                    parameters: [
                                        string(name: 'StatusChoice', value: "${stageStatus}")
                                    ]
                                )
                                if (childJobBuild.result == "ABORTED" || childJobBuild.result == "FAILURE" ) {
                                    catchError(stageResult: 'FAILURE'){
                                        error("${childJobBuild.displayName} STATUS: ${childJobBuild.result}")
                                    }
                                }
                                if (childJobBuild.result == "UNSTABLE") {
                                    catchError(stageResult: 'UNSTABLE'){
                                        unstable("${childJobBuild.displayName} STATUS: ${childJobBuild.result}")
                                    }
                                }
                                
                            }
                        }
                    }
                    parallel parallelStages
                }
            }
        }
    }
}
  1. Trigger Test Job and this should allow you to reproduce the issue

Expected Results

At runtime the all stages should be updated

Actual Results

Initially all stages are shown passed even though there are failures only after pipeline execution completes the stages are shown correctly.

While Other stages are running:
Image

After all the stages are completed
Image

Anything else?

No response

Are you interested in contributing a fix?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant