简体   繁体   English

可视化 Jenkins 管道或多分支管道作业

[英]Visualize Jenkins pipeline or multibranch pipeline jobs

  • I have one Pipeline job for each component in my Jenkins 2.0.我的 Jenkins 2.0 中的每个组件都有一个流水线作业 All of them consist of many stages (build, UT, IT etc.), so they're working as a pipeline for a component.它们都包含许多阶段(构建、UT、IT 等),因此它们作为组件的管道工作。
  • 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.组件以指定的顺序相互依赖,所以我使用“在其他项目构建后构建”(我也尝试过JobFanIn Plugin )来触发这些“迷你管道”。 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:为此,我找到了 2 个插件:

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.两者都引入了新的视图类型,但都不支持“管道”或“多分支管道”作业类型(在 Jenkins 2.0 中引入),这些作业在视图配置页面的相关下拉列表中不可见。

How can I visualize the relation of these job types?如何可视化这些工作类型的关系? Is there any other plugin which supports these types?有没有其他插件支持这些类型?

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.原因是 mb 管道的每个工作台都可以有不同的构建配置。 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.不能在工作层面做到这一点。

Jenkins blue ocean plugins give the rich view to visualize all types (parallel, sequential stages) view out of the box. Jenkins 蓝海插件提供了丰富的视图来可视化开箱即用的所有类型(并行、顺序阶段)视图。

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但是这个视图是每个构建..你不能从它创建一个仪表板并将它全部结合在一起

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM