Visualize Jenkins pipeline or multibranch pipeline jobs

允我心安 提交于 2021-02-17 22:12:39

问题


  • I have one Pipeline job for each component in my Jenkins 2.0. All of them consist of many stages (build, UT, IT etc.), so they're working as a pipeline for a component.
  • The components are depending on each other in a specified order, so I used "Build after other projects are built" (I also tried JobFanIn Plugin) to trigger these "mini-pipelines" after each other. This works like a pipeline of "mini pipelines"

I'd like to visualize the relationship between the jobs. For this purpose I've found 2 plugins:

  • Delivery Pipeline Plugin
  • Build Pipeline Plugin

Both introduce a new View type, but none of them supports the "Pipeline" or "Multibranch pipeline" job types (introduced in Jenkins 2.0), these jobs are not visible in the related dropdown list on the view config page.

How can I visualize the relation of these job types? Is there any other plugin which supports these types?


回答1:


Thinking about this.

I don't think a visualisation of multi branch pipelines makes sense in the same way it would for a single branch build. The reason is that each bench of a mb pipeline can have a different build configuration. Eg with master triggering a promotion job but branch doing something else or nothing.

Do the best one could do I think is trace an individual build number and it's links. Can't do it at the job level.




回答2:


Jenkins blue ocean plugins give the rich view to visualize all types (parallel, sequential stages) view out of the box.

Let say if you have a pipeline like this

pipeline {
    agent any;
    stages {
        stage('build') {
            stages {
                stage('compile') {
                    steps {
                        echo "steps for unitest"
                    }
                }
                stage('security scan') {
                    parallel {
                        stage('sonarqube') {
                            steps {
                                echo "steps for parallel sonarqube"
                            }
                        }
                        stage('blackduck') {
                            steps {
                                echo "steps for parallel blackduck"
                            }
                        }
                    }
                }
                stage('package') {
                    steps {
                        echo "steps for package"
                    }
                }
            }
        }
        stage('deployment') {
            stages {
                stage('dev') {
                    steps {
                        echo "Development"
                    }
                }
                stage('pp') {
                    when { branch 'master' }
                    steps {
                        echo "PreProduction"
                    }
                }
                stage('prod') {
                    when { 
                        branch 'master' 
                        beforeInput true
                    }
                    input {
                        message "Deploy to production?"
                        id "simple-input"
                    }
                    steps {
                        echo "Production"
                    }
                }
            }
        }
    }
}

It will visualize like this :

is this what you are looking for? Note- it can customize. but this view is per build ..you can't create a dashboard from it and combine it all in one



来源:https://stackoverflow.com/questions/38913295/visualize-jenkins-pipeline-or-multibranch-pipeline-jobs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!