A Flexible and Secure CI / CD Service Deployment System and Method Based on GitLab CI
Through the CI/CD service deployment system based on gitlab-ci, the flexibility and security issues of multiple environment deployment and service package management are solved, efficient continuous integration and continuous deployment are realized, and the security and deployment efficiency of configuration items are enhanced. .
Patent Information
- Application Number
- CN202111559653.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-20
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2041-12-20
AI Technical Summary
Existing CI/CD tools lack flexibility and security in multiple environment deployments and service package management, resulting in confusing configuration item management and security risks, as well as low efficiency in continuous integration and continuous deployment.
Designed a flexible and secure CI/CD service deployment system based on gitlab-ci, including configuration management module, preprocessing module, gitlab-ci packaging module and service package integration module, through configuration item encryption management, automatic deployment and role permission control , to achieve multiple environment adaptation and efficient deployment.
It realizes the flexible adaptation of service packages in various deployment solutions and network environments, improves the security of configuration items and the efficiency of continuous integration and continuous deployment, reduces manual participation, and enhances information privacy and security of division of labor and collaboration.
Smart Images

Figure CN114371881B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of operation and maintenance management, and in particular to a flexible and secure CI / CD service deployment system and method based on gitlab-ci. Background Art
[0002] CI / CD refers to continuous integration and continuous deployment. The current mainstream CI / CD tool is Jenkins. However, given that Jenkins needs to configure plug-ins to link with GitLab and that GitLab is currently widely used for version management, gitlab-ci combined with automatic deployment solutions has gradually become a better alternative.
[0003] Currently, many gitlab-ci service deployment methods are managed based on containers. For deployment solutions that are not suitable for containers, there is no good solution for private deployment solutions in multiple environments.
[0004] In addition, the management and storage of service packages deployed in multiple environments, and the management of configuration items of deployment service packages will become chaotic if they are recorded manually. If the management of configuration items is directly placed in the management file of gitlab-ci, it will not only make the management file lengthy, but also expose a lot of key information to all project-related personnel, bringing certain security risks.
[0005] Therefore, how to make the service deployment package adapt to various deployment schemes and network environments, improve the security of configuration items, and improve the efficiency of continuous integration and continuous deployment is an urgent problem to be solved. Summary of the invention
[0006] The technical task of the present invention is to provide a flexible and secure CI / CD service deployment system and method based on gitlab-ci to solve the problem of how to adapt the service deployment package to multiple deployment schemes and network environments, improve the security of configuration items, and improve the efficiency of continuous integration and continuous deployment.
[0007] The technical task of the present invention is achieved in the following way: a flexible and secure CI / CD service deployment system based on gitlab-ci, the system comprising:
[0008] Configuration management module, used for project management, configuration file structure management and configuration item encryption management;
[0009] The preprocessing module is used to trigger packaging and parse the environment and machine to generate corresponding configuration files;
[0010] The gitlab-ci packaging module is used to trigger CI / CD, start the gitlab-ci pipeline, read the scheduling system parameters and the configuration files assembled by the scheduling system, and push the task to the gitlab runner (CI / CD execution machine) queue;
[0011] The service package integration module is used for service package storage and automatic deployment of service packages.
[0012] Preferably, the configuration management module includes:
[0013] Project management submodule, used to modify configuration files;
[0014] Configuration file structure management submodule, used to submit the latest configuration file structure;
[0015] The configuration item encryption management submodule is used to organize various environment configuration items based on the latest configuration files and store them in encrypted form.
[0016] Preferably, the preprocessing module comprises:
[0017] The package trigger submodule is used to trigger pre-configured packaging by submitting code or manually triggering packaging through the visual interface;
[0018] The environment and machine management submodule is used to parse the environment and machine, read configuration files, and generate configuration files.
[0019] Preferably, the preprocessing module further includes:
[0020] Select submodule to select development, test or production environment and target machine.
[0021] Preferably, the gitlab-ci packaging module includes:
[0022] Configuration items are written into submodules, which are used to write packaging and process configuration file scripts;
[0023] Automatic packaging submodule, used to obtain configuration files and automatically complete the packaging of gitlab-ci;
[0024] The service package upload submodule is used to upload the service package.
[0025] Preferably, the service package integration module includes:
[0026] The service package storage submodule is used to receive the deployment package, standardize the version information, upload it to the specified location of the resource center according to the environment, and record the latest version;
[0027] The service package automatic deployment submodule is used to automatically deploy the service package according to the target machine or generate a one-click deployment script.
[0028] Preferably, the working process of the service package integration module is as follows:
[0029] (1) After gitlab-ci is packaged, it notifies the scheduling system to start uploading the deployment package to the resource center;
[0030] (2) Based on the initial trigger condition, start generating the deployment script of the deployment package, including the update script, the initial deployment script, and the update rollback script;
[0031] (3) The scheduling system will check whether the target machine is automatically deployed:
[0032] If the check passes, the deployment package is automatically pushed to the target environment machine and the automatic deployment script is triggered.
[0033] A flexible and secure CI / CD service deployment method based on gitlab-ci. The method is as follows:
[0034] Initialization phase: The super administrator sets the system roles and configures role permissions. The default initialization roles of the scheduling system include super administrators, devops personnel, implementers, testers, and developers.
[0035] Configuration and environment definition stage: Define configuration file templates and environment templates based on actual business needs. The scheduling system will automatically extract encrypted configuration items based on the environment and generate configuration files.
[0036] Packaging and deployment phase: Each role triggers the automatic packaging and deployment process based on actual business needs;
[0037] Version maintenance stage: When a project needs to be released, the scheduling system will automatically tag the current project configuration file template and release branch with the version number, and save the configuration items as new entries based on the version number, so that each version deployment package can be easily retrieved at any time.
[0038] Preferably, the configuration file template is a general template made according to the submitted ontology configuration file, replacing the configuration file in the configuration item; the configuration file template is managed by a version management tool;
[0039] The environment template is used to classify and manage various project environments; project environments include development environment, test environment, online single-node environment, and online cluster environment;
[0040] For developers, CI / CD is automatically triggered after the code is submitted based on the project branch, and deployed in an environment that matches the branch name.
[0041] Preferably, the packaging and deployment phase is as follows:
[0042] For all roles, in the scheduling system, after filling in the information of whether to deploy, environment, machine, and project branch, the CI / CD process is actively triggered;
[0043] After CI / CD is triggered, gitlab-ci starts the pipeline, reads the scheduling system parameters and the configuration files assembled by the scheduling system, and pushes the tasks to the gitlab runner (CI / CD execution machine) queue;
[0044] After gitlab-ci is packaged, it notifies the scheduling system to start uploading the deployment package to the resource center;
[0045] Based on the initial trigger conditions, start generating deployment scripts for the deployment package, including update scripts, initial deployment scripts, and update rollback scripts;
[0046] The scheduling system will check if the target machine is automatically deployed:
[0047] If the check passes, the deployment package is automatically pushed to the target environment machine and the automatic deployment script is triggered.
[0048] The flexible and secure CI / CD service deployment system and method based on gitlab-ci of the present invention has the following advantages:
[0049] (1) The present invention can distinguish between multiple environments, has very high flexibility, and can quickly meet changing environmental requirements;
[0050] (ii) The present invention realizes encrypted storage of configuration items, which are invisible to non-business personnel, ensuring the privacy and integrity of information and preventing tampering and denial;
[0051] (3) The present invention can customize roles and permissions, which is conducive to division of labor and collaboration based on actual business, and maintains security and convenience;
[0052] (iv) The present invention reduces manual involvement in the packaging and deployment process, thereby improving work efficiency;
[0053] (V) The present invention realizes automatic management of deployment packages and versions, reducing omissions and confusion caused by manual participation. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] The present invention is further described below in conjunction with the accompanying drawings.
[0055] Attached Figure 1 A structural diagram of a flexible and secure CI / CD service deployment system based on gitlab-ci;
[0056] Attached Figure 2A flowchart of the flexible and secure CI / CD service deployment method based on gitlab-ci;
[0057] Attached Figure 3 This is a role distribution diagram. DETAILED DESCRIPTION
[0058] The flexible and secure CI / CD service deployment system and method based on gitlab-ci of the present invention are described in detail below with reference to the accompanying drawings and specific embodiments of the specification.
[0059] Embodiment 1:
[0060] As attached Figure 1 As shown, the flexible and secure CI / CD service deployment system based on gitlab-ci of the present invention includes:
[0061] Configuration management module, used for project management, configuration file structure management and configuration item encryption management;
[0062] The preprocessing module is used to trigger packaging and parse the environment and machine to generate corresponding configuration files;
[0063] The gitlab-ci packaging module is used to trigger CI / CD, start the gitlab-ci pipeline, read the scheduling system parameters and the configuration files assembled by the scheduling system, and push the task to the gitlab runner (CI / CD execution machine) queue;
[0064] The service package integration module is used for service package storage and automatic deployment of service packages.
[0065] The configuration management module in this embodiment includes:
[0066] Project management submodule, used to modify configuration files;
[0067] Configuration file structure management submodule, used to submit the latest configuration file structure;
[0068] The configuration item encryption management submodule is used to organize various environment configuration items based on the latest configuration files and store them in encrypted form.
[0069] The preprocessing module in this embodiment includes:
[0070] The package trigger submodule is used to trigger pre-configured packaging by submitting code or manually triggering packaging through the visual interface;
[0071] The environment and machine management submodule is used to parse the environment and machine, read configuration items in the configuration file, and generate the configuration file;
[0072] Select submodule to select development, test or production environment and target machine.
[0073] The gitlab-ci packaging module in this embodiment includes:
[0074] Configuration items are written into submodules, which are used to write packaging and process configuration file scripts;
[0075] Automatic packaging submodule, used to obtain configuration files and automatically complete the packaging of gitlab-ci;
[0076] The service package upload submodule is used to upload the service package.
[0077] The service package integration module in this embodiment includes:
[0078] The service package storage submodule is used to receive the deployment package, standardize the version information, upload it to the specified location of the resource center according to the environment, and record the latest version;
[0079] The service package automatic deployment submodule is used to automatically deploy the service package according to the target machine or generate a one-click deployment script.
[0080] The working process of the service package integration module in this embodiment is as follows:
[0081] (1) After gitlab-ci is packaged, it notifies the scheduling system to start uploading the deployment package to the resource center;
[0082] (2) Based on the initial trigger condition, start generating the deployment script of the deployment package, including the update script, the initial deployment script, and the update rollback script;
[0083] (3) The scheduling system will check whether the target machine is automatically deployed:
[0084] If the check passes, the deployment package is automatically pushed to the target environment machine and the automatic deployment script is triggered.
[0085] The working process of the system is as follows:
[0086] (1) In the configuration management module, developers modify configuration files and submit them to operation and maintenance personnel;
[0087] (ii) In the configuration management module, submit the latest configuration file structure;
[0088] (3) In the configuration management module, organize various environment configuration items based on the latest configuration files and store them in encrypted form;
[0089] (IV) The configuration management module sends information to the preprocessing module. In the preprocessing module, submitting the code triggers the preconfiguration packaging; or manually triggering the packaging in the visual interface. After selecting the development, test or formal environment and the target machine, the preprocessing module parses the environment and machine, reads the configuration items in the configuration file, and generates the configuration file.
[0090] (V) The preprocessing module sends the configuration file to the gitlab-ci package file or the devops personnel writes a script for packaging and processing the configuration file, triggers the gitlab-ci pipeline, obtains the configuration file, automatically packages and uploads it;
[0091] (VI) The gitlab-ci packaging module uploads the service package to the service package integration storage module. The service package integration storage module receives the deployment package, standardizes the version information, and uploads it to the specified location of the resource center according to the environment. The scheduling system records the latest version and automatically deploys or generates a one-click deployment script based on the target machine.
[0092] Embodiment 2:
[0093] As attached Figure 2 As shown, the flexible and secure CI / CD service deployment method based on gitlab-ci of the present invention is as follows:
[0094] S1, Initialization phase: Set the system roles and configure role permissions through the super administrator; the default initialization roles of the scheduling system include super administrators, devops personnel, implementation personnel, testers, and developers; based on actual business and security requirements, users can customize system roles and permissions as super administrators. Among them, devops and implementation personnel are both operation and maintenance personnel, and set corresponding permissions. The 5 roles and permissions initialized by the system by default can meet the needs of general scenarios.
[0095] S2, Configuration and environment definition stage: Define the configuration file template and environment template according to actual business needs. The scheduling system will automatically extract encrypted configuration items based on the environment and generate configuration files.
[0096] S3, packaging and deployment phase: Each role triggers the automatic packaging and deployment process based on actual business needs. For developers, CI / CD is automatically triggered after the code is submitted based on the project branch, and deployed in an environment that matches the branch name.
[0097] S4, version maintenance stage: When the project needs to be released, the scheduling system will automatically tag the current project configuration file template and the release branch with the version number, and save the configuration items as new entries based on the version number, so that each version deployment package can be easily retrieved at any time.
[0098] In particular, the scheduling system automatically maintains a copy of the latest released versions of all projects and deployment packages for various environments to facilitate the fastest implementation of new projects.
[0099] The configuration file template in step S2 of this embodiment relies on the communication between the operation and maintenance personnel and the project development management personnel. The developer submits the local configuration file. The operation and maintenance personnel make a universal configuration file template based on this file, which can replace the configuration items. The devops personnel will automate the configuration item replacement process. The configuration file template is managed by the version management tool. In view of the different environment configuration items, the operation and maintenance personnel need to encrypt and maintain them in the database according to each environment.
[0100] The environment template is used to classify and manage various project environments; project environments include development environment, test environment, online single-node environment, and online cluster environment;
[0101] The packaging and deployment phase in step S3 of this embodiment is specifically as follows:
[0102] S301. For all roles, in the scheduling system, fill in the information of whether to deploy, environment, machine, and project branch, and actively trigger the CI / CD process;
[0103] S302, after CI / CD is triggered, gitlab-ci starts the pipeline, reads the scheduling system parameters and the configuration files assembled by the scheduling system, and pushes the task to the gitlab runner (CI / CD execution machine) queue;
[0104] S303. After gitlab-ci is packaged, it notifies the scheduling system to start uploading the deployment package to the resource center;
[0105] S304, starting to generate deployment scripts for the deployment package according to the initial trigger condition, including update scripts, initial deployment scripts, and update rollback scripts;
[0106] S305, the scheduling system will check whether the target machine is automatically deployed:
[0107] If the check passes, the deployment package is automatically pushed to the target environment machine and the automatic deployment script is triggered.
[0108] As attached Figure 3 As shown, the role distribution in step S1 of this embodiment is as follows:
[0109] From the perspective of security and division of labor and cooperation, this system sets up multiple roles to complete different tasks, including 3 roles: developers, testers, and operation and maintenance personnel (devops and implementation personnel).
[0110] Developers write code and use the version management tool GitLab to submit the code, which automatically triggers the packaging of GitLab CI and deploys it to the development environment to verify and fix problems until the testable standards are met.
[0111] After the tester receives the application that the developer can test, the packaging is triggered and the test environment is automatically deployed. After the test environment is deployed, the automated test begins. After passing the test, the manual test begins. If any problems are found, the application is sent back to the developer for modification until the test passes.
[0112] Operation and maintenance personnel are divided into devops personnel and implementation personnel:
[0113] The implementation personnel trigger the packaging of the online environment. The system generates deployment packages of different versions for different services based on the machine, environment, whether it is a cluster, etc., and generates deployment scripts.
[0114] Devops is responsible for the construction and maintenance of the entire gitlab ci automation script, the development of the scheduling system, and the management and maintenance of configuration files and configuration items.
[0115] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A flexible and secure CI / CD service deployment system based on gitlab-ci, characterized in that: The system includes, Configuration management module, used for project management, configuration file structure management and configuration item encryption management; The preprocessing module is used to trigger packaging and parse the environment and machine to generate corresponding configuration files; The gitlab-ci packaging module is used to trigger CI / CD, start the gitlab-ci pipeline, read the scheduling system parameters and the configuration files assembled by the scheduling system, and push the tasks to the gitlab runner queue; Service package integration module, used for service package storage and automatic deployment of service packages; Among them, the configuration management module includes: Project management submodule, used to modify configuration files; Configuration file structure management submodule, used to submit the latest configuration file structure; The configuration item encryption management submodule is used to organize various environment configuration items based on the latest configuration files and store them in encrypted form; The service package integration module includes: The service package storage submodule is used to receive the deployment package, standardize the version information, upload it to the specified location of the resource center according to the environment, and record the latest version; The service package automatic deployment submodule is used to automatically deploy the service package according to the target machine or generate a one-click deployment script; The working process of the service package integration module is as follows: (1) After gitlab-ci is packaged, it notifies the scheduling system to start uploading the deployment package to the resource center; (2) Based on the initial trigger conditions, start generating deployment scripts for the deployment package, including update scripts, initial deployment scripts, and update rollback scripts; (3) The scheduling system will check whether the target machine is automatically deployed: If the check passes, the deployment package is automatically pushed to the target environment machine and the automatic deployment script is triggered.
2. According to claim 1, the flexible and secure CI / CD service deployment system based on gitlab-ci is characterized in that: The pre-processing module comprises: The package trigger submodule is used to trigger pre-configured packaging by submitting code or manually triggering packaging through the visual interface; The environment and machine management submodule is used to parse the environment and machine, read configuration files, and generate configuration files.
3. The flexible and secure CI / CD service deployment system based on gitlab-ci according to claim 1 or 2, characterized in that: The preprocessing module also includes: Select submodule to select development, test or production environment and target machine.
4. According to claim 1, the flexible and secure CI / CD service deployment system based on gitlab-ci is characterized in that: The gitlab-ci packaging module includes: Configuration items are written into submodules, which are used to write packaging and process configuration file scripts; Automatic packaging submodule, used to obtain configuration files and automatically complete the packaging of gitlab-ci; The service package upload submodule is used to upload the service package.
5. A flexible and secure CI / CD service deployment method based on gitlab-ci, characterized in that: The method is as follows: Initialization phase: The super administrator sets the system roles and configures role permissions. The default initialization roles of the scheduling system include super administrators, devops personnel, implementers, testers, and developers. Configuration and environment definition stage: Define configuration file templates and environment templates based on actual business needs. The scheduling system will automatically extract encrypted configuration items based on the environment and generate configuration files. Packaging and deployment phase: Each role triggers the automatic packaging and deployment process based on actual business needs; the details are as follows: For all roles, in the scheduling system, after filling in the information of whether to deploy, environment, machine, and project branch, the CI / CD process is actively triggered; After CI / CD is triggered, gitlab-ci starts the pipeline, reads the scheduling system parameters and the configuration files assembled by the scheduling system, and pushes the tasks to the gitlab runner queue; After gitlab-ci is packaged, it notifies the scheduling system to start uploading the deployment package to the resource center; Based on the initial trigger conditions, start generating deployment scripts for the deployment package, including update scripts, initial deployment scripts, and update rollback scripts; The scheduling system will check if the target machine is automatically deployed: If the check passes, the deployment package is automatically pushed to the target environment machine and the automatic deployment script is triggered; Version maintenance phase: When a project needs to be released, the scheduling system will automatically tag the current project configuration file template and release branch with the version number, and save the configuration items as new entries based on the version number.
6. According to claim 5, the flexible and secure CI / CD service deployment method based on gitlab-ci is characterized in that: The configuration file template is a general template made according to the submitted ontology configuration file, which replaces the configuration file in the configuration item; the configuration file template is managed by the version management tool; The environment template is used to classify and manage various project environments; project environments include development environment, test environment, online single-node environment, and online cluster environment; For developers, CI / CD is automatically triggered after the code is submitted based on the project branch, and deployed in an environment that matches the branch name.
Citation Information
Patent Citations
Continuous integration automatic test method
CN108874650A
Application deployment method and device and computer readable storage medium
CN111090437A
