4

I have a Jenkins pipeline script with the key pieces shown below. Everything seems to be executing in the background but is not showing on BlueOcean.

enter image description here

Am I doing something wrong or it is some kind of bug on the UI?

def projects = [
    [name: 'API', folder: 'api-tests', repo: 'url'],
    [name: 'UI',folder: 'selenium-tests', repo: 'url']
]

// Create List of build stages to suit
def jobs = [:]

pipeline {
    agent {
        kubernetes {
            cloud "url"
            yaml """contents"""
        }
    }
    stages {
        stage('Downstream Testing') {
            steps {
                script{
                    // Set up List<Map<String,Closure>> describing the builds
                    projects.each { project ->
                        print "Adding stages for ${project.folder}"
        
                        jobs[project.name] = {
                            stage("Checkout Project") {
                                ...
                            }
                            stage("Smoke Tests") {
                                dir("${project.folder}") {
                                        container('maven') {
                                            // Run the maven build
                                            sh """mvn package test"""
                                        }
                                    }
                                }
                            }
                    }
                    
                    // Run all Nth step for all Projects in Parallel. 
                    parallel jobs
                }
            }   
        }
    }
}
javydreamercsw
  • 5,363
  • 13
  • 61
  • 106
  • what's your goal for this pipeline? are you planning to run both `checkout` and `smoke test` parallelly or parallelly run 2 stages i.e. api and ui with `checkout` and `smoke test ` one after another? – Samit Kumar Patel Feb 08 '21 at 17:46
  • Each branch will have a series of stages. Each branch should run in parallel. Each branch is a different project. That's why there are checkout and tests for each. – javydreamercsw Feb 08 '21 at 18:10
  • looks like you are correct. I have added my scenario in the answer. If you just convert your declarative to scripted the UI will show correctly – Samit Kumar Patel Feb 08 '21 at 18:34

1 Answers1

3

Yes, It seems there is a bug in the Blueocean UI.

The scenario works fine for the scripted pipeline but the same fail in declarative pipeline

scripted pipeline

def j=[:]
node {
    [
        [name: "api", folder: "api"],
        [name: "ui", folder: "ui"]
    ].each { m -> 
        j[m.name] = {
            stage('a') {
                echo "A"
            }
            stage('b') {
                echo "B"
            }
        }
    }
    parallel j
}

enter image description here

declarative pipeline

pipeline {
    agent any;
    stages {
        stage("parallel") {
            steps {
                script {
                    def j=[:]
                    [
                        [name: "api", folder: "api"],
                        [name: "ui", folder: "ui"]
                    ].each { m -> 
                        j[m.name] = {
                            stage('a') {
                                echo "A"
                            }
                            stage('b') {
                                echo "B"
                            }
                        }
                    }
                    parallel j
                }
            }
        }
    }
}

enter image description here

Samit Kumar Patel
  • 1,932
  • 1
  • 13
  • 20