Continuous Delivery - Blue Ocean Application

Blue Ocean provides a set of visual operation interface to help create and edit Pipeline tasks.
Blue Ocean Features:

  • Pipeline Editor: An intuitive and visual pipeline editor for creating continuous delivery pipelines throughout.
    • Visualization of pipelines: Visual representation of pipelines increases the clarity of the continuous delivery process across the enterprise.
    • Pipeline diagnostics: Immediately locate automation problems without constantly scanning logs or focusing on multiple screens.
    • Personalized Dashboard: Users can customize the dashboard to display only the pipelines relevant to them.

Install and start Blue Ocean

Blue Ocean is one of the Jenkins plugins. Go to System Management -> Plugin Management, and search for "Blue Ocean" in "Optional Plugins". You can see the following results:

Select Blue Ocean, and then click the Install button to install. After the installation is complete, restart the Jenkins process, and then you can see the Blue Ocean icon on the Jenkins page. Click the Blue Ocean icon to start Blue Ocean.

Create a Pipeline in Blue Ocean

Click New Pipeline in Blue Ocean to create a new pipeline.
Create a Pipeline

If you have a Jenkinsfile in the root directory of your repository, start the first build process directly. If there is no Jenkinsfile in the warehouse, open the pipeline-editor and edit the workflow graphically.
Blue Ocean Graphical Editing Workflow

After editing, a Jenkinsfile will be generated and submitted to the root directory of your code base. You can choose to submit to the master branch or to a newly created branch. After the submission is successful, a complete build process will begin.

Blue Ocean Create Pipeline Submit Code Base & Run

The Jenkinsfile code generated by Blue Ocean will be saved to the project's Github code base, which can be edited and modified later.
Jenkinsfile code generated by Blue Ocean

pipeline {
  agent any
    stages {
        stage('Setup') {
              parallel {
                      stage('clean env') {
                                steps {
                                            sh 'echo "Step1"'
                                                      }}
                                                              stage('Reset test data') {
                                                                        steps {
                                                                                    sh 'echo "reset config"'
                                                                                              }}
                                                                                                    }
                                                                                                        }
                                                                                                          }
                                                                                                          }

Running builds with view usage in Blue Ocean

run build

Open the Pipeline task in Blue Ocean and click the Run button to run the task directly.
Running Pipeline tasks in Blue Ocean

View task progress view

In the process of running a Pipeline task, you can click the task number to enter the task details view to view the graphical progress.
Blue Ocean task progress query

View log view

Click the corresponding worker node in the task to query the log details of the task running process. These log information can be used to debug the task, especially when the task fails, the log details can help to check the cause of the task error.
task log

Unit testing and result display with Blue Ocean

For projects that contain unit tests, Blue Ocean can run the unit tests and display their results. The following is an example of a single test project in java.

Pipeline code implementation

pipeline{
    agent {
            label 'master'
                }
    stages{
            stage('iTest源码') {
                        steps {
                                        sh 'mkdir -p iTest'
                                                        dir("iTest"){
                                                                            git branch:'master', url:'[email protected]:princeqjzh/iTest.git'
                                                                                            }
                                                                                                        }
                                                                                                                }
        stage('构建+单测') {
                    steps {
                                    sh '''
                                                        cd iTest
                                                                            mvn clean install test
                                                                                            '''
                                                                                                        }
                                                                                                                }
        stage('发布测试记录') {
                    steps {
                                    junit '**/*.xml'
                                                }
                                                        }
                                                            }
                                                            }

Single test result display

After the task is completed, enter the Tests view to view the test results. The
single test results show that

Blue Ocean provides developers with a more interesting way to use Jenkins, builds from the basics, and implements a new and modern user interface. Helps teams of any size achieve continuous delivery.

⬇️ Click "Read the original text" to improve the core competitiveness of the test!
Original link

More technical articles to share

Guess you like

Origin blog.csdn.net/hogwarts_2022/article/details/124255479
Recommended