CN115827055A - Method and system for landing DevOps based on Gitlab CI - Google Patents

Method and system for landing DevOps based on Gitlab CI Download PDF

Info

Publication number
CN115827055A
CN115827055A CN202211612863.5A CN202211612863A CN115827055A CN 115827055 A CN115827055 A CN 115827055A CN 202211612863 A CN202211612863 A CN 202211612863A CN 115827055 A CN115827055 A CN 115827055A
Authority
CN
China
Prior art keywords
gitlab
code
module
devops
project
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
CN202211612863.5A
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.)
Xi'an Huaxun Technology Co ltd
Original Assignee
Xi'an Huaxun 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 Xi'an Huaxun Technology Co ltd filed Critical Xi'an Huaxun Technology Co ltd
Priority to CN202211612863.5A priority Critical patent/CN115827055A/en
Publication of CN115827055A publication Critical patent/CN115827055A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention relates to the technical field of operation and maintenance management, in particular to a method and a system for landing DevOps based on Gitlab CI, comprising the following steps: uploading project codes to a GitLab code warehouse, initiating a DevOps flow created based on an Activiti workflow engine, approving appointed nodes of the Activiti workflow engine, triggering the GitLab Pipeline triggers, starting to execute a Pipeline of the GitLab CI, binding with the nodes of the Activiti workflow, notifying the GitLab CI after receiving the triggering action, executing a script in a GitLab-ci.yml file, pulling the project codes in the GitLab code warehouse to a local place, identifying version baselines and static scanning of the project codes, automatically constructing a mirror image package, pushing the mirror image package to a Docker mirror image warehouse, or generating a pure code package, pushing the pure code package to a code version library, and then deploying projects. The process standardization, tracking visualization and process branch controllability of the DevOps life cycle are realized.

Description

Method and system for landing DevOps based on Gitlab CI
Technical Field
The invention relates to the technical field of operation and maintenance management, in particular to a method and a system for landing DevOps based on Gitlab CI.
Background
The GitLab CI is mainly a continuous integration tool for continuous compiling, constructing, deploying/releasing, testing and the like, solves the problem of manual packing and deploying, and realizes the function of automatic packing and deploying; however, in the prior art, the CI/CD flow processing is realized based on the GitLab CI by presetting a script file in advance, and after triggering, stopping of the CI/CD pipeline cannot be dynamically determined, and the flow direction can be manually adjusted in the execution process to determine different flow branches.
Disclosure of Invention
The invention aims to provide a method and a system for landing DevOps based on Gitlab CI, which mainly solve the technical problems in the prior art.
In order to achieve the purpose, the invention provides the following technical scheme:
in one aspect, a method for landing DevOps based on a Gitlab CI is provided, the method comprising:
uploading project codes to a GitLab code warehouse;
initiating a DevOps flow created based on an Activiti workflow engine;
approving the appointed nodes of the Activiti workflow engine, triggering a GitLab Pipeline trigger, starting to execute a Pipeline of the GitLab CI, and simultaneously binding with the nodes of the Activiti workflow;
after receiving the trigger action, the GitLab CI informs the GitLab Runner to execute a script in the GitLab-ci.yml file, and pulls the item code in the GitLab code warehouse to the local;
performing baseline and static scanning on the project code identification version, then automatically constructing a generated mirror image package, and pushing the mirror image package to a Docker mirror image warehouse; or generating a pure code package and pushing the pure code package to a code version library;
and then carrying out project deployment.
Further, the identifying a version baseline includes:
and archiving the source code, generating a specified Tag for marking the current project code version, informing the node of the task execution status to the Activiti workflow node, marking the Activiti workflow process so as to track the whole DevOps process execution stage, and generating a task execution report at the same time.
Further, the static scanning includes:
and scanning the project code after the version base line is identified by a SonarQube tool, checking code loopholes and safety specifications, informing a stage task execution state to an Activiti workflow node, and generating a task execution report.
Further, the method further comprises a unit test before the deployment, wherein the unit test comprises: and automatically scanning the unit test method defined in the project code, generating a unit test report, and simultaneously informing the node of the task execution state to the Activiti workflow node to generate a task execution report.
Further, the deploying comprises:
if the container environment is k8s, the k8s container arrangement engine pulls the mirror image package of the Docker mirror image warehouse to complete the creation of the containers with the preset copy number, and the containers created by the k8s container arrangement engine are arranged into each pod object;
if the environment is a physical machine or a virtual machine, after the original pure code packet is backed up, the pure code packet is pulled by the script to replace the original service process.
Further, if the deployment fails, a hook is added, and the background Activiti workflow engine is informed,
processing the corresponding flow state and informing the related person of failed deployment;
if the deployment is successful, the smoking test, quality inspection, safety scanning, test audit, quality issue audit and project issue audit are carried out, a flow report and a flow log are generated, and continuous monitoring is carried out.
In another aspect, there is provided a Gitlab CI based floor DevOps based system, the system comprising:
a code uploading module: for uploading project codes to a GitLab code repository;
a DevOps flow initiation module: a DevOps flow for initiating creation based on an Activiti workflow engine;
a triggering module: used for triggering GitLab Pipeline triggers after examining and approving the appointed nodes of the Activiti workflow engine,
an execution module: after receiving the trigger action, the GitLab CI informs the GitLab Runner to execute a script in a GitLab-ci.yml file and pull the item code in the GitLab code warehouse to the local;
a version baseline identification module: for identifying a version baseline for the project code;
a static scanning module: scanning the item code for which a version baseline is identified;
an automatic construction module: the system comprises a scanning module, a code version library, a data storage module, a data acquisition module and a data processing module, wherein the scanning module is used for automatically constructing and generating a mirror image package for the scanned project codes and pushing the mirror image package to the Docker mirror image warehouse or generating a pure code package and pushing the pure code package to the code version library;
a deployment module: for project deployment.
Further, the system further comprises:
a unit test module: the unit testing method is used for automatically scanning the unit testing method defined in the project code before deployment, generating a unit testing report, and simultaneously informing the node of the task execution state to the Activiti workflow node to generate a task execution report.
Further, the deployment module further comprises: an environment recognition module: for identifying a k8s container environment and a physical or virtual machine environment.
The invention has the beneficial effects that: the method is based on Gitlab CI, and is upgraded from an original CI/CD assembly line which is configured in a specified way into a dynamically controllable assembly line which is realized by an Activiti workflow engine and is provided with a custom approval; and controlling the approval work of the specific nodes of the DevOps life cycle by using the roles so as to control the execution process of the DevOps life cycle; meanwhile, an easy-to-operate webpage interface is supported, so that the process standardization, the tracking visualization and the controllability of the process branches of the DevOps life cycle are realized.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is an interaction diagram of a method for landing DevOps based on a Gitlab CI according to an embodiment of the present invention;
fig. 2 is a flowchart of a method for landing DevOps based on a Gitlab CI according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a system based on a Gitlab CI landing DevOps according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Technical terms related to the invention are explained as follows:
Figure BDA0004000770070000041
Figure BDA0004000770070000051
Figure BDA0004000770070000061
example one
A method for landing DevOps based on Gitlab CI mainly integrates Activiti workflow engines, so that the whole DevOps process is controllable, roles are added to limit the safe execution of each process node, and the process steps of the DevOps can be customized at the same time, so as to ensure the effective cooperation among development, technical operation and quality assurance departments on the basis of larger automatic deployment/release, and the method specifically comprises the following steps:
step (1): upload project codes to the GitLab code repository.
Step (2): and initiating a user-defined DevOps process created based on an Activiti workflow engine, triggering a GitLab Pipeline trigger notification through an approval action of a node specified by the Activiti workflow engine, starting to execute a phase task defined by a Pipeline of the GitLab CI, and simultaneously binding with the Activiti workflow node.
And (3): and after receiving the trigger event action, the GitLab CI informs the registered and bound GitLab Runner to start executing the script in the GitLab-ci.yml file, and pulls the item code in the GitLab code warehouse to the local.
And (4): and identifying a version base line, filing the source code deployed/released by the function, namely generating a specified Tag for marking the current version, informing the node of the task execution condition to an Activiti workflow node, marking the Activiti workflow process so as to track the whole DevOps process execution stage, and simultaneously generating a corresponding task execution report.
And (5): and static scanning, namely scanning the project codes by a SonarQube tool, checking code bugs, safety specifications and the like, informing phase task execution states to Activiti workflow nodes, and generating a task execution report.
And (6): and automatically constructing, namely if the environment is a physical machine or a virtual machine, compiling and constructing the project code by the script to generate a pure code packet, uploading the constructed pure code packet to a code version library, if the environment is a k8s container, finishing mirror image construction by the Docker according to a preset packaging file to generate a mirror image packet, and finally pushing the mirror image packet to the Docker mirror image library.
And (7): and unit testing, namely automatically scanning a unit testing method defined in the project code, generating a unit testing report, and simultaneously informing a stage task execution state to an active workflow node to generate a task execution report.
And (8): deployment, if the Deployment is in a k8s container environment, the k8s container arrangement engine pulls a mirror image package of a Docker mirror image warehouse to complete container creation of a preset copy number, and containers created by the k8s container arrangement engine are arranged in each Pod object, specifically, a script replaces a preset Deployment controller configuration file of the k8s container arrangement engine according to dynamic parameters, and after a complete and effective Deployment controller configuration file is generated, a k8s container arrangement engine controller creation update command is executed, and a Pod and a replay are updated; if the environment is a physical machine or a virtual machine, after the original pure code packet is backed up, the pure code packet is pulled by the script to replace the original service process, and finally the service health state is checked to determine whether to back; if the deployment fails, notifying a background Activiti workflow engine, processing a corresponding flow state, and notifying a related person of the failure of the deployment; otherwise, continuing.
After the pipeline stage task defined by the GitLab CI is executed, the whole DevOps flow returns to the workflow defined by the Activiti of the main line, and the next node task is continuously executed.
And (9): and (4) smoking test, preliminarily verifying a corresponding test case by a preset automatic test script, and generating a smoking test report.
Step (10): and quality inspection, namely automatically finishing quality inspection of the service and generating a quality inspection report.
Step (11): safety scanning: self-defining scripts, services, performing preliminary judgment on project data safety and the like.
Step (12): and (4) a process report, namely executing corresponding task nodes by an Activiti workflow engine to generate a process execution report of the whole process.
Step (13): testing and auditing, wherein a tester performs test regression on the whole system according to the smoking test and quality inspection report, and a test responsible person performs flow approval operation, if the test has no problem, the auditing is passed, and the flow is continued; if the test is not passed, the examination and approval is not passed, corresponding remark descriptions are filled in, and the examination and approval workflow nodes automatically send the notice to the related relatives.
Step (14): and quality issuing and auditing, wherein QA engineering personnel finally check the project issuing condition and confirm the project issuing, if the auditing is passed, the process is continued, otherwise, the system automatically notifies the relevant relatives.
Step (15): and (4) verifying the release of the project, and finally determining whether to release the project after being confirmed by a project principal.
Step (16): and the flow log is used for generating flow execution logs of all the branch flows so as to facilitate tracking.
Step (17): finally notifying development, test, related responsible persons and the like in the form of mails and the like;
meanwhile, the system is automatically monitored in a centralized mode, so that relevant persons can be directly notified after problems occur in the operation process of the system.
Example two
A Gitlab CI landing DevOps-based system is disclosed, and referring to FIG. 3, the system specifically comprises: a code uploading module: for uploading project codes to a GitLab code repository; a DevOps flow initiation module: a DevOps flow for initiating creation based on an Activiti workflow engine; a triggering module: the system is used for triggering GitLab Pipeline triggers after examining and approving the appointed nodes of the Activiti workflow engine, and comprises an execution module: after receiving the trigger action, the GitLab CI notifies the GitLab Runner to execute a script in a GitLab-CI-ym file and pull the item code in the GitLab code warehouse to the local; a version baseline identification module: for identifying a version baseline for the item code; a static scanning module: scanning the item code that identifies the version baseline; an automatic construction module: the system comprises a database, a project code database and a project code database, wherein the database is used for automatically constructing and generating a mirror image package for the scanned project code and pushing the mirror image package to the Docker mirror image warehouse or generating a pure code package and pushing the pure code package to the code version database; a deployment module: for project deployment; a unit test module: the unit test method is used for automatically scanning the unit test method defined in the project code before deployment, generating a unit test report, and simultaneously informing the node of the task execution state to the Activiti workflow node to generate a task execution report; the deployment module further comprises: an environment recognition module: for identifying a k8s container environment and a physical or virtual machine environment.
It is worth to explain that, in the invention, the DevOps life cycle is controlled by integrating the Activiti workflow engine on the basis of Gitlab CI, the examination and approval of the role configured at the key node are provided, and the cooperation of the technical operation and quality assurance department is added, so as to promote the safety and standardization of the DevOps life cycle, and meanwhile, the visualization of the process tracking can be realized.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (9)

1. A method for landing DevOps based on Gitlab CI, the method comprising:
uploading the project code to a GitLab code repository;
initiating a DevOps flow created based on an Activiti workflow engine;
approving the appointed nodes of the Activiti workflow engine, triggering a GitLab Pipeline trigger, starting to execute a Pipeline of the GitLab CI, and simultaneously binding with the nodes of the Activiti workflow;
after receiving the trigger action, the GitLab CI informs the GitLab Runner to execute a script in the GitLab-ci.yml file, and pulls the item code in the GitLab code warehouse to the local;
identifying version baselines and static scanning of the project codes, automatically constructing a generated mirror image package, and pushing the mirror image package to a Docker mirror image warehouse; or generating a pure code package and pushing the pure code package to a code version library;
and then carrying out project deployment.
2. The method of claim 1, wherein identifying a version baseline comprises:
filing the source code, generating a designated Tag for marking the current project code version, notifying the node of the task execution status to the Activiti workflow node, marking the Activiti workflow process so as to track the whole DevOps process execution stage, and generating a task execution report at the same time.
3. The method of claim 1, wherein the static scanning comprises:
and scanning the project code after the version base line is identified by a SonarQube tool, checking code loopholes and safety specifications, informing a stage task execution state to an Activiti workflow node, and generating a task execution report.
4. The method of claim 1, further comprising a unit test before the deploying, wherein the unit test comprises: and automatically scanning the unit test method defined in the project code, generating a unit test report, and simultaneously informing the node of the task execution state to the Activiti workflow node to generate a task execution report.
5. The method of claim 1, wherein the deploying comprises:
if the container environment is k8s, the k8s container arrangement engine pulls the mirror image package of the Docker mirror image warehouse to complete the creation of the containers with the preset copy number, and the containers created by the k8s container arrangement engine are arranged into each pod object;
if the environment is a physical machine or a virtual machine, after the original pure code packet is backed up, the pure code packet is pulled by the script to replace the original service process.
6. The method of claim 5, wherein if the deployment fails, a hook is added, a background Activiti workflow engine is notified, a corresponding flow state is processed, and a relevant person is notified of the deployment failure;
if the deployment is successful, the smoking test, quality inspection, safety scanning, test audit, quality issue audit and project issue audit are carried out, a flow report and a flow log are generated, and continuous monitoring is carried out.
7. A system based on a Gitlab CI to ground DevOps, the system comprising:
a code uploading module: for uploading project codes to a GitLab code repository;
a DevOps flow initiation module: a DevOps flow for initiating creation based on an Activiti workflow engine;
a triggering module: used for triggering GitLab Pipeline triggers after examining and approving the appointed nodes of the Activiti workflow engine,
an execution module: after receiving the trigger action, the GitLab CI informs the GitLab Runner to execute a script in the GitLab-ci.yml file and pull the item code in the GitLab code warehouse to the local;
a version baseline identification module: for identifying a version baseline for the project code;
a static scanning module: scanning the item code for which a version baseline is identified;
an automatic construction module: the system comprises a scanning module, a code version library, a data storage module, a data acquisition module and a data processing module, wherein the scanning module is used for automatically constructing and generating a mirror image package for the scanned project codes and pushing the mirror image package to the Docker mirror image warehouse or generating a pure code package and pushing the pure code package to the code version library;
a deployment module: for project deployment.
8. The Gitlab CI landing DevOps-based system of claim 7, further comprising:
a unit test module: the unit testing method is used for automatically scanning the unit testing method defined in the project code before deployment, generating a unit testing report, and simultaneously informing the node of the task execution state to the Activiti workflow node to generate a task execution report.
9. The Gitlab CI floor DevOps-based system of claim 7, wherein the deployment module further comprises: an environment recognition module: for identifying a k8s container environment and a physical or virtual machine environment.
CN202211612863.5A 2022-12-15 2022-12-15 Method and system for landing DevOps based on Gitlab CI Pending CN115827055A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211612863.5A CN115827055A (en) 2022-12-15 2022-12-15 Method and system for landing DevOps based on Gitlab CI

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211612863.5A CN115827055A (en) 2022-12-15 2022-12-15 Method and system for landing DevOps based on Gitlab CI

Publications (1)

Publication Number Publication Date
CN115827055A true CN115827055A (en) 2023-03-21

Family

ID=85545744

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211612863.5A Pending CN115827055A (en) 2022-12-15 2022-12-15 Method and system for landing DevOps based on Gitlab CI

Country Status (1)

Country Link
CN (1) CN115827055A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
CN109683899B (en) Software integration method and device
CN109960643B (en) Code testing method and device
US7735080B2 (en) Integrated system and method for the management of a complete end-to-end software delivery process
CN107634860B (en) Method for automatically upgrading weblogic cluster patches in batches
CN101477543A (en) System and method for automating ETL application
Friedman et al. RELIABILITY TECHNIQUES FOR COMBINED
US8640098B2 (en) Offline configuration and download approach
CN111897566A (en) Software development continuous integration method, device, equipment and medium
CN110673858B (en) Lightweight deployment method based on ssh password-free login protocol
CN111897671A (en) Failure recovery method, computer device, and storage medium
CN106874050A (en) A kind of system automatically updating method
CN113094066B (en) Multi-server code release method and system
CN110704082A (en) Continuous integration method and system for monitoring platform
CN112035233A (en) Big data batch job task scheduling method and device
CN111552629A (en) Docker-based continuous integration test environment construction method and system
CN111258591A (en) Program deployment task execution method and device, computer equipment and storage medium
CN114490319A (en) Distributed continuous integration automatic test method and system
CN114168213A (en) Software release method and device based on Jenkins and electronic equipment
CN115827055A (en) Method and system for landing DevOps based on Gitlab CI
CN114968272A (en) Algorithm operation method, device, equipment and storage medium
CN115525557A (en) Method and system for recovering CPLD (complex programmable logic device) capability under PFR (pulse frequency response) abnormal condition, electronic equipment and storage medium
CN113434180B (en) Data processing method and device for application, server and storage medium
CN112083947A (en) Software package issuing method for supply chain multi-language environment
CN111984373B (en) Method and system for guaranteeing environment consistency in Kubernetes container environment
CN110764785B (en) Cloud platform tool chain and cloud platform operation and maintenance method for power industry based on open source assembly

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