Practical exploration of CICD project development | Jingdong logistics technical team

This article introduces the author's understanding of CICD and several scenarios for implementing CICD in projects, and summarizes the key nodes of each scenario practice, the benefits it brings, and the practical application of specific projects. Readers can learn from the scenarios described in this article, or learn from the practical methods mentioned in the article, to carry out CICD in the project, and provide specific support for the continuous integration deployment of the project.

 

1 Introduction

Based on the company's Bamboo, EOS, and SonarQube platforms, CICD continuous integration and deployment are carried out in the project. Introduce the scene of CICD development, the practical application in the project, and the follow-up planning.

2 Basic concepts of CICD

CICD is short for Continuous Integration and Continuous Deployment. It refers to the automatic execution of a series of scripts in the development process to reduce the probability of introducing bugs in development, and minimize manual intervention in the process of new code from development to deployment.

CICD Core: Continuous Integration, Continuous Deployment, Continuous Delivery.

CI: Continuous Integration, which means continuous integration.

After pushing the code to the remote warehouse, a series of testing, building and other processes are carried out before this submission is merged into the main branch.
Assume that there is an application code stored in the warehouse, and the development will push many times every day. For each push, you can create a series of scripts for automatic testing to reduce the probability of introducing errors into the application. It can be applied on multiple branches including the development branch.
In the process of continuous integration, we attach great importance to the results of automated test verification to ensure the quality of all submissions after merging the mainline, and to warn of possible problems.

CD: Continuous Delivery, which means continuous delivery.

It means that the verified code can be automatically released to the warehouse after the CI is completed.
The goal of continuous delivery is to have a codebase ready to be deployed to production.

CD: Continuous Deployment, which means continuous deployment.

It refers to a further step on the basis of continuous integration, and refers to deploying the code of the default branch of the push-repository warehouse to a specific environment.
Deliver high-quality products quickly with automated build, test, and deploy loops. To some extent, it represents the degree of engineering of a development team. Any modification that passes all existing workflows will directly meet with customers. Only when a modification fails to build in the workflow can it prevent it from being deployed to the product line.

3 Development Scenarios of CICD

3.1 Compile and deploy

Realize the automatic compilation-deployment process after code submission, replacing the manual operation of building-deployment on j-one

content:

  • Automatic build, automatic deployment, build deployment result notification after code submission;

income:

  • Remove the waiting time in the manual deployment operation after the code build on Jone is completed;

3.2 Unit testing

Carry out Junit-based unit testing

content:

  • For the back-end code, write unit test scripts based on Junit, carry out unit testing, and obtain unit test reports and jacoco code coverage reports;

income:

  • Improve test coverage and improve code quality;
  • Reduce bugs and quickly locate bugs;
  • Refactoring with limited support;

3.3 Code scanning

Implement SonarQube-based code quality detection

Implement EOS-based code quality detection

content:

  • Realize code scanning detection based on SonarQube or company platform EOS;
  • Code submission automatically triggers code scanning, and finally generates reports and result notifications;
  • The scanning results are included in the project quality, and the problems are recorded and tracked until the problems are closed-loop resolved.

income:

  • Rich means of code quality detection;
  • Multi-level automated testing to improve code quality;
  • Automatically trigger test execution, reduce test waiting time, improve efficiency, and realize unattended;

3.4 Automated testing

Realize automated testing based on Python, EasyOne, DeepTest, Jmeter.

content:

  • Implement code quality detection based on SonarQube;
  • Realize the automated testing of each link of the whole link;
  • Code submission automatically triggers test execution, report generation, and report notification;

income:

  • Multi-level automated testing to improve code quality;
  • Automatically trigger test execution, reduce test waiting time, improve efficiency, and realize unattended;

3.5 Full Link Test Exploration

Combine the above individual scenarios to form a full-link test scenario;
code submission triggers the automatic operation of the link, as well as report generation and email sending.

4 Project practice

Combining with the company's internal platform to carry out CICD in actual projects.

4.1 Company internal platform

Bamboo
Bamboo is a set of CI/CD pipeline solutions developed by JD.com, covering the complete life cycle of software development.

EOS
EOS is a code scanning system independently developed by Technology and Data Center. By scanning and analyzing codes, it locates irregular code segments in the project and gives suggestions for modification. It can effectively supervise and restrict developers to unify their coding habits and reduce problems caused by irregular coding. The low-level errors caused by it can improve the readability of the code and improve the efficiency of teamwork.

4.2 Practical application of the project

1) Compile-deploy

Build a pipeline on Bamboo for the high-frequency build deployment branch on Jone to achieve:
code submission - call Jone's build - call Jone's deployment - result notification

Several ways to trigger compilation and build:

  • Manual execution;
  • Code submission triggers execution;
  • Timing task triggers execution;
  • Cascade other pipelines to trigger execution;

Application situation:

  • All tests and coverage in the group have deployed relevant pipelines;
  • Support testers to deploy automatic build pipelines in the project under test, with a total of 364 calls.

2) Unit testing

Carry out unit testing for the back-end project to achieve:
code submission-maven build-get unit test report-result notification

Application effect:

  • It greatly simplifies the process of obtaining the unit test report, through a simple process, you can carry out the unit test for the project, execute the unit test, and obtain the unit test results;
  • Support more than 8 projects to deploy a single-test pipeline, JDL-CRM authority system single-test effective improvement rate: 20%

3) Automated testing

After the project is deployed, carry out automated regression testing for regression testing before the project goes online, to achieve:
automated testing - test report - test result notification

Currently based on the Python language and relying on the Py third-party module, it realizes scripting, integrates into the Bamboo platform, executes the pipeline, and obtains reports.

Application effect:

  • Responsible for the UAT automatic regression test before going online in the sales and service project;

4) Code scanning

Based on the SonarQube and EOS platforms built by the company, code scanning is carried out to realize:
code submission-code scanning-scanning report-problem manual record line cloud

5 Follow-up planning

CICD process data is combined with quality performance data.
Carry out automated testing for more projects based on DeepTest and integrate it into the BamBoo platform.
Application of code scanning in projects.

Author: JD Logistics Chen Wei

Source: JD Cloud Developer Community Reprinted from Yuanqishuo Tech, please indicate the source

The country's first IDE that supports multi-environment development——CEC-IDE Microsoft has integrated Python into Excel, and Uncle Gui participated in the framework formulation. Chinese programmers refused to write gambling programs and were pulled out 14 teeth, with 88% body damage . Podman Desktop, an open-source imitation Song font, breaks through 500,000 downloads. Automatically skips opening screen advertisements. The application "Li Tiao Tiao" stops updating indefinitely. There is a remote code execution vulnerability Xiaomi filed mios.cn website domain name
{{o.name}}
{{m.name}}

Guess you like

Origin my.oschina.net/u/4090830/blog/10102774