CN112130956A - Jenkins-based automatic CI/CD pipeline method - Google Patents

Jenkins-based automatic CI/CD pipeline method Download PDF

Info

Publication number
CN112130956A
CN112130956A CN202010937280.4A CN202010937280A CN112130956A CN 112130956 A CN112130956 A CN 112130956A CN 202010937280 A CN202010937280 A CN 202010937280A CN 112130956 A CN112130956 A CN 112130956A
Authority
CN
China
Prior art keywords
jenkins
pipeline
devops
code
mirror image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010937280.4A
Other languages
Chinese (zh)
Inventor
王志坤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhongying Youchuang Information Technology Co Ltd
Original Assignee
Zhongying Youchuang Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhongying Youchuang Information Technology Co Ltd filed Critical Zhongying Youchuang Information Technology Co Ltd
Priority to CN202010937280.4A priority Critical patent/CN112130956A/en
Publication of CN112130956A publication Critical patent/CN112130956A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/4557Distribution of virtual machine instances; Migration and load balancing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Stored Programmes (AREA)

Abstract

The invention belongs to the technical field of software development and discloses an automatic CI/CD assembly line method based on Jenkins. Through the integration of Jenkins, SonarQube, Harbor and Kubernetes, Jenkins, Kubernetes and the like become transparent, all links are automatically completed, the program uniformity is high, the communication efficiency of all posts is improved, and the probability of problems caused by manual intervention of all links is reduced. Moreover, the operation in each link of Jenkins Pipeline is realized by directly adopting Jenkins to automatically call Kubernets to realize the creation and destruction and dynamic expansion and contraction of the container without additionally occupying host resources.

Description

Jenkins-based automatic CI/CD pipeline method
Technical Field
The invention belongs to the technical field of software development, and particularly relates to an automatic CI/CD pipeline method based on Jenkins.
Background
Currently, in the field of software Development, DevOps (combination words of Development and Operations) is an increasingly popular culture and methodology. IT aims to attach importance to the culture or practice of communication and cooperation between software developers (Dev) and IT operation and maintenance technicians (Ops). The software can be built, tested and released more quickly, frequently and reliably through the automatic CI (continuous integration of software) and CD (continuous delivery of software) processes.
For example, chinese patent application No. 202010102269.6 discloses a method for deploying DevOps based on Jenkins, which completes automatic construction and packaging by means of gitlab + Jenkins pipeline through advanced specification and unified configuration, generates a helm chart capable of managing images and configuration files, and deploys the chart to various environments, thereby greatly reducing the artificial communication cost and the possibility of misoperation, and improving the efficiency. However, in the link of determining variables required by the development project, the development personnel is required to perform advanced configuration according to the project flow, and the integration level is not very high.
Although there are mature tools for each link of development, testing, deployment, operation and maintenance, a complete system with maturity is lacking to solve the problem of continuous integration and delivery of DevOps rapidly, frequently and automatically and reliably, so that each link needs the participation of corresponding personnel, takes huge communication cost and needs human intervention to run the complete process.
Disclosure of Invention
The invention aims to solve the defects of the prior art and provides an automatic CI/CD pipeline method based on Jenkins.
In order to achieve the purpose, the invention provides the following technical scheme:
an automatic CI/CD pipeline method based on Jenkins comprises the following steps:
step 1, determining CI/CD pipeline related parameter data according to a business process, and submitting the related parameter data through a DevOps UI;
step 2, the DevOps micro-service receives related parameter data of the DevOps UI, integrates the related parameter data to automatically generate a Jenkins Pipeline script and a Kubernetes script, and calls a Jenkins platform interface;
step 3, Jenkins runs Kubernets scripts to call Kubernets as a program deployment environment, and at the same time, Jenkins Pipeline scripts are run to pull corresponding codes from a code warehouse, so that continuous integration of the codes is carried out, a mirror image is constructed, and the mirror image is pushed to a Harbor mirror image private warehouse for management;
step 4, Jenkins operates the Kubectl container to carry out continuous deployment, and pulls a corresponding mirror image from the Harbor mirror image private warehouse according to a Kubectl deployment command to complete the overall deployment of the program;
and 5, Jenkins runs an automatic test script, generates a test report and informs related personnel.
As a preferred scheme of the above technical solution, in the step 2, the DevOps micro-service calls a template engine freemaker to automatically generate a Pipeline script meeting requirements of Jenkins Pipeline, and calls a rest interface provided by Jenkins to create Jenkins Pipeline, if the Pipeline is the existing Jenkins Pipeline, error reporting information is given to the DevOps micro-service, a response is given to a DevOps UI page, and the operation is quitted; if the operation is normal, the Jenkins Pipeline creating operation is completed.
As a preferable scheme of the above technical solution, in the step 2, the DevOps microserver automatically generates a yaml file meeting the kubernets deployment container format requirement; in the step 4, the mirror image pulled by the Harbor mirror image private warehouse is integrally deployed according to the yaml file.
As a preferable solution of the above technical solution, in the step 3, the continuous integration of the code further includes compiling the code, scanning the code, and compiling and packaging the code, where the scanning the code analyzes the code by using a SonarQube program source code quality measurement tool to give a program quality report.
As an optimization, in the steps 3 to 5, a certain link of the Jenkins Pipeline script fails to execute, the whole Pipeline terminates execution, the related log is executed, and the DevOps micro-service presents data to the DevOps UI page by calling a Jenkins platform interface.
As an optimization, the relevant parameter data in step 1 includes: the method comprises the steps of obtaining a product to which a pipeline belongs, a group to which the pipeline belongs, a project to which the pipeline belongs, a pipeline description, a code warehouse address, whether source code scanning is carried out or not, an instruction is constructed, a name space required by Kubernets deployment, CPU configuration, Memory configuration, copy number and environment variables.
The invention realizes the following technical effects:
the invention relates to an automatic CI/CD pipeline method based on Jenkins, which integrates Jenkins through a DevOps UI and a DevOps micro-service, so that the CI/CD pipeline is completely automatic, and the integration level is high. Through the integration of Jenkins, SonarQube, Harbor and Kubernets, Jenkins, Kubernets and the like become transparent, detailed knowledge of the Jenkins Pipeline grammar and the yaml file of the Kubernets script is not needed to be known, flow automation is achieved, all links are automatically completed, the program uniformity is high, the communication efficiency of all posts is improved, and the probability of problems caused by manual intervention of all the links is reduced. Moreover, the operation in each link of Jenkins Pipeline is realized by directly adopting Jenkins to automatically call Kubernets to realize the creation and destruction and dynamic expansion and contraction of the container without additionally occupying host resources.
Drawings
FIG. 1 is a system flow diagram of the method of the present invention.
Detailed Description
For the purpose of enhancing the understanding of the present invention, the present invention will be further described in detail with reference to the following examples and the accompanying drawings, which are only used for explaining the present invention and are not to be construed as limiting the scope of the present invention.
Referring to fig. 1, an automatic CI/CD pipeline method based on Jenkins provided by the embodiment of the present invention, taking Java source program managed by Maven as an example, includes the following steps:
step 1, determining CI/CD pipeline related parameter data according to a business process, and submitting the related parameter data through a DevOps UI;
step 2, the DevOps micro-service receives related parameter data of the DevOps UI, integrates the related parameter data to automatically generate a Jenkins Pipeline script and a Kubernetes script, and calls a Jenkins platform interface;
step 3, Jenkins runs Kubernets scripts to call Kubernets as a program deployment environment, and at the same time, Jenkins Pipeline scripts are run to pull corresponding codes from a code warehouse, so that continuous integration of the codes is carried out, a mirror image is constructed, and the mirror image is pushed to a Harbor mirror image private warehouse for management;
step 4, Jenkins operates the Kubectl container to carry out continuous deployment, and pulls a corresponding mirror image from the Harbor mirror image private warehouse according to a Kubectl deployment command to complete the overall deployment of the program;
and 5, Jenkins runs an automatic test script, generates a test report and informs related personnel.
Since the program is a Java source program managed by Maven, in step 1, the user fills in a flow step form through a DevOps UI page, which mainly includes: the method comprises the steps of submitting data such as a pipeline name, a product to which the pipeline belongs, a group to which the pipeline belongs, a project to which the pipeline belongs, a pipeline description, a code warehouse address, whether source code scanning is carried out or not, a Maven construction instruction, a namespace required by Kubernetes deployment, CPU configuration, Memory configuration, copy number, environment variables and the like to a DevOps micro-service interface.
In step 2, the DevOps micro-service combines with related parameter data of the DevOps UI, calls a template engine Freemarker to automatically generate a Pipeline script meeting requirements of Jenkins Pipeline, and simultaneously automatically generates a yaml file meeting requirements of a Kubernets deployment container format. After the file is generated, calling a rest interface provided by Jenkins to create Jenkins Pipeline, if the Jenkins Pipeline exists, giving error reporting information to a DevOps micro-service, responding to a DevOps UI page by the DevOps micro-service, and exiting the operation; if the operation is normal, the Jenkins pipeline creating operation is completed.
In step 3, Jenkins runs Kubernets scripts to call Kubernets as a program deployment environment, Jenkins Pipeline scripts are run to pull corresponding codes from a code warehouse, continuous integration of the codes is carried out according to the Jenkins Pipeline scripts, compiling codes, scanning the codes and compiling and packaging the codes, mirror images are constructed, and the mirror images are pushed to a Harbor private mirror image warehouse to be managed.
In the step 4, Jenkins operates the Kubectl container to carry out continuous deployment, a Kubectl deployment command is sent, a corresponding mirror image is pulled from the Harbor mirror image private warehouse, the whole program deployment is completed, and the mirror image pulled by the Harbor mirror image private warehouse carries out the whole program deployment according to the yaml file.
In order to reflect the program quality, in step 3, the code is scanned by analyzing the code through a source code quality measurement tool of the sonarqbe program, and a program quality report is given.
If a certain link of the Jenkins Pipeline script fails to execute in the steps 3-5, the whole Pipeline is stopped to execute, a related log is executed, the DevOps micro-service provides data to a DevOps UI page by calling a Jenkins platform interface to be presented to a user, and the user can quickly locate the related link of the CI/CD Pipeline failure according to the related log.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (6)

1. An automatic CI/CD pipeline method based on Jenkins is characterized by comprising the following steps:
step 1, determining CI/CD pipeline related parameter data according to a business process, and submitting the related parameter data through a DevOps UI;
step 2, the DevOps micro-service receives related parameter data of the DevOps UI, integrates the related parameter data to automatically generate a Jenkins Pipeline script and a Kubernetes script, and calls a Jenkins platform interface;
step 3, Jenkins runs Kubernets scripts to call Kubernets as a program deployment environment, and at the same time, Jenkins Pipeline scripts are run to pull corresponding codes from a code warehouse, so that continuous integration of the codes is carried out, a mirror image is constructed, and the mirror image is pushed to a Harbor mirror image private warehouse for management;
step 4, Jenkins operates the Kubectl container to carry out continuous deployment, and pulls a corresponding mirror image from the Harbor mirror image private warehouse according to a Kubectl deployment command to complete the overall deployment of the program;
and 5, Jenkins runs an automatic test script, generates a test report and informs related personnel.
2. The Jenkins-based automatic CI/CD pipelining method of claim 1, wherein in step 2, the DevOps micro-service calls a template engine FreeMarker to automatically generate a Pipeline script meeting Jenkins Pipeline requirements, and calls a rest interface provided by Jenkins to create Jenkins Pipeline, if the Jenkins Pipeline exists, an error message is given to the DevOps micro-service, and the operation is exited in response to the DevOps UI page; if the operation is normal, the Jenkins Pipeline creating operation is completed.
3. The Jenkins-based automated CI/CD pipeline method of claim 1, wherein in step 2, the DevOps micro-service automatically generates a yaml file that conforms to Kubernets deployment container format requirement; in the step 4, the mirror image pulled by the Harbor mirror image private warehouse is integrally deployed according to the yaml file.
4. The Jenkins-based automated CI/CD pipeline method according to claim 1, wherein in the step 3, the continuous integration of the code further comprises compiling the code, scanning the code, and compiling and packaging the code, wherein the scanning the code is performed by analyzing the code through a Source code quality metric tool of the SonarQube program to give a program quality report.
5. The Jenkins-based automated CI/CD Pipeline method of claim 1, wherein in the steps 3-5, a certain link of Jenkins Pipeline script fails to execute, the whole Pipeline is terminated to execute, the related log is executed, and the DevOps micro-service presents data to a user by calling Jenkins platform interface to provide the data to a DevOps UI page.
6. The Jenkins-based automated CI/CD pipeline method according to claim 1, wherein the related parameter data in step 1 comprises: the method comprises the steps of obtaining a product to which a pipeline belongs, a group to which the pipeline belongs, a project to which the pipeline belongs, a pipeline description, a code warehouse address, whether source code scanning is carried out or not, an instruction is constructed, a name space required by Kubernets deployment, CPU configuration, Memory configuration, copy number and environment variables.
CN202010937280.4A 2020-09-09 2020-09-09 Jenkins-based automatic CI/CD pipeline method Pending CN112130956A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010937280.4A CN112130956A (en) 2020-09-09 2020-09-09 Jenkins-based automatic CI/CD pipeline method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010937280.4A CN112130956A (en) 2020-09-09 2020-09-09 Jenkins-based automatic CI/CD pipeline method

Publications (1)

Publication Number Publication Date
CN112130956A true CN112130956A (en) 2020-12-25

Family

ID=73845112

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010937280.4A Pending CN112130956A (en) 2020-09-09 2020-09-09 Jenkins-based automatic CI/CD pipeline method

Country Status (1)

Country Link
CN (1) CN112130956A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112783653A (en) * 2021-01-25 2021-05-11 中国工商银行股份有限公司 Resource scheduling method and device based on containerization
CN112925610A (en) * 2021-03-04 2021-06-08 浪潮云信息技术股份公司 Kubernetes-based pipeline automation construction and deployment method and system
CN113467829A (en) * 2021-09-03 2021-10-01 广州嘉为科技有限公司 Code inspection method based on Docker and code inspection server
CN114168213A (en) * 2021-10-26 2022-03-11 青岛海尔科技有限公司 Software release method and device based on Jenkins and electronic equipment
CN115048313A (en) * 2022-06-30 2022-09-13 中国电信股份有限公司 Automatic testing method and device, computer readable storage medium and electronic equipment
CN117806654A (en) * 2024-03-01 2024-04-02 杭州云掣科技有限公司 Tekton-based custom cloud native DevOps pipeline system and method

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106997297A (en) * 2017-03-31 2017-08-01 广东亿迅科技有限公司 A kind of software development management platform and method based on DevOps
CN111443940A (en) * 2020-05-08 2020-07-24 南京大学 Complete software life cycle management method and platform based on DevOps

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106997297A (en) * 2017-03-31 2017-08-01 广东亿迅科技有限公司 A kind of software development management platform and method based on DevOps
CN111443940A (en) * 2020-05-08 2020-07-24 南京大学 Complete software life cycle management method and platform based on DevOps

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112783653A (en) * 2021-01-25 2021-05-11 中国工商银行股份有限公司 Resource scheduling method and device based on containerization
CN112925610A (en) * 2021-03-04 2021-06-08 浪潮云信息技术股份公司 Kubernetes-based pipeline automation construction and deployment method and system
CN113467829A (en) * 2021-09-03 2021-10-01 广州嘉为科技有限公司 Code inspection method based on Docker and code inspection server
CN114168213A (en) * 2021-10-26 2022-03-11 青岛海尔科技有限公司 Software release method and device based on Jenkins and electronic equipment
CN115048313A (en) * 2022-06-30 2022-09-13 中国电信股份有限公司 Automatic testing method and device, computer readable storage medium and electronic equipment
CN115048313B (en) * 2022-06-30 2023-12-08 中国电信股份有限公司 Automatic test method and device, computer readable storage medium and electronic equipment
CN117806654A (en) * 2024-03-01 2024-04-02 杭州云掣科技有限公司 Tekton-based custom cloud native DevOps pipeline system and method
CN117806654B (en) * 2024-03-01 2024-06-07 杭州云掣科技有限公司 Tekton-based custom cloud native DevOps pipeline system and method

Similar Documents

Publication Publication Date Title
CN112130956A (en) Jenkins-based automatic CI/CD pipeline method
US20150100829A1 (en) Method and system for selecting and executing test scripts
US20150100832A1 (en) Method and system for selecting and executing test scripts
CN110008123B (en) Method for automatically deploying test software and corresponding device
US20150100831A1 (en) Method and system for selecting and executing test scripts
CN111966366A (en) Cluster deployment method and device of multi-CPU architecture
WO2023231704A1 (en) Algorithm running method, apparatus and device, and storage medium
CN113741958A (en) Software development and delivery method and system based on cloud-native
CN111984529A (en) APP software compatibility automatic test method
CN115344300A (en) Branch pipeline construction method, device, equipment and storage medium
CN110928796A (en) Automatic change test platform
CN113672502A (en) Program multi-system testing method and corresponding device, equipment and medium
CN116400987B (en) Continuous integration method, device, electronic equipment and storage medium
CN115357258B (en) Application deployment method and device, storage medium and electronic device
CN113986263A (en) Code automation test method, device, electronic equipment and storage medium
CN113704081B (en) Automatic testing method and system for compatibility of application program
CN109344069A (en) A kind of the synergetic office work method and synergetic office work platform of software automated testing
CN111581081B (en) Automatic test system and method
CN115145826A (en) Full-process automatic testing method and system
CN114996039A (en) Cloud native system joint debugging method, system and medium based on third-party system docking
CN113934642A (en) Software compatibility testing method based on dynamic and static combination
CN114253564A (en) Container cluster mirror image template generation method and device
CN112835789A (en) Realization technology for automatic test of automatic test framework
CN112836220B (en) Cloud center environment inspection method
CN118152269A (en) Embedded code automatic test platform based on GIT management tool

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20201225

RJ01 Rejection of invention patent application after publication