Integrated pipeline establishment method, system, electronic device and readable storage medium

By automatically matching and selecting the target template and environment of the code integration pipeline, it solves the problem of low efficiency in establishing code integration pipelines in the existing technology, realizes efficient code integration pipeline generation and deployment, and meets the rapid needs of digital enterprises.

CN115098069BActive Publication Date: 2024-10-29CHONGQING CHANGAN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210714129.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-22
Publication Date
2024-10-29
Estimated Expiration
2042-06-22

AI Technical Summary

Technical Problem

The establishment efficiency of the existing code integration pipeline is low, complex logic and different parameters make manual configuration difficult, and cannot meet the needs of light and fast digital enterprises.

Method used

By obtaining the target language type, target version type, code template collection and container environment pool, it automatically matches and selects the target integration template and environment, generates code compilation and project deployment tasks, and establishes a code integration pipeline.

Benefits of technology

It realizes the automated establishment of the code integration pipeline, improves the generation efficiency, simplifies the determination of integration templates and deployment environments, reduces manual intervention, and improves the efficiency and consistency of code integration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115098069B_ABST
    Figure CN115098069B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of code integration, and discloses a method, system, electronic device and readable storage medium for establishing an integrated pipeline. The method obtains a target language type, a target version type, a code template set and a container environment pool, determines a code compilation task according to a target integration template obtained by matching the target language type, generates a project deployment task according to a target environment selected by the target version type, and then establishes a code integration pipeline according to pipeline tasks including code compilation tasks and project deployment tasks. Compared with manually establishing an integrated template and a deployment environment, the code compilation task is determined by the target language type, and the project deployment task is determined by software version information, which simplifies the method for determining the integrated template and the deployment environment, thereby realizing automatic establishment of the code integration pipeline and improving the generation efficiency of the code integration pipeline.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of code integration technology, and in particular to an integrated pipeline establishment method, system, electronic equipment and readable storage medium. Background Art

[0002] With the continuous development of the software industry, the scale of software is also increasing, and the complexity of its code is also rising. Therefore, software code writing also requires the participation of more roles, such as software development engineers, software testing engineers, software operation and maintenance engineers, etc. Therefore, software technologies including agile development, CI / CD (Code Commit and Initial Testing / Bakeand Deploy, continuous integration / continuous delivery), DevOps (Development / Operations, processes, methods and systems) have emerged. Their emergence has greatly shortened the time of code integration, increased the rate of software delivery, and made software version updates faster, which helps to discover problems, obtain user feedback, and reduce the cost of modifying software.

[0003] At present, CI / CD needs to integrate the code through the code integration pipeline. The code integration pipeline has complex links, including code warehouse, product library, configuration center, build environment, test center, etc. Due to the complex logic of the code integration pipeline, different parameters will cause differentiated configuration of the code integration pipeline. Different types of participants need to determine the parameters for each step such as code integration and project deployment. Therefore, the efficiency of manually establishing a code integration pipeline is too low, which does not conform to the light and fast digital enterprise concept. Summary of the invention

[0004] In order to provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. The summary is not an extensive review, nor is it intended to identify key / critical components or delineate the scope of protection of these embodiments, but rather serves as a prelude to the detailed description that follows.

[0005] In view of the above-mentioned shortcomings of the prior art, the present invention discloses an integrated pipeline establishment method, system, electronic device and readable storage medium to realize automatic establishment of a code integrated pipeline and improve the generation efficiency of the code integrated pipeline.

[0006] The present invention discloses a method for establishing an integrated pipeline, comprising: obtaining a target language type, a target version type, a code template set and a container environment pool, wherein the code template set includes preset integration templates corresponding to multiple code language types, and the container environment pool includes multiple preset containerized environments; performing data matching from the code template set according to the target language type to obtain a target integration template corresponding to the target language type, determining a code compilation task according to the target integration template, the code compilation task is used to compile source code according to the target integration template to obtain a compilation product, wherein the source code is obtained by pulling code from a preset code repository; performing environment selection from the container environment pool according to the target version type to obtain a target environment corresponding to the target version type, generating a project deployment task according to the target environment, the project deployment task is used to deploy a production project corresponding to the compilation product in the target environment; establishing a code integration pipeline according to pipeline tasks, wherein the pipeline tasks include the code compilation task and the project deployment task.

[0007] Optionally, before establishing a code integration pipeline according to the pipeline task, the method further includes at least one of the following: obtaining the warehouse address of the code warehouse, determining a code pulling task according to the target language type and the warehouse address, and adding the code pulling task to the pipeline task, wherein the code pulling task is used to pull code from a preset code warehouse according to the target language type to obtain source code corresponding to the target language type; performing data matching from a preset scanning rule set according to the target language type to obtain a target scanning rule corresponding to the target language type, determining a code quality scanning task according to the target scanning rule, and adding the code quality scanning task to the pipeline task, wherein the code quality scanning The task is used to perform code quality testing on the compiled product according to the target scanning rules. If the test result meets the preset code quality requirements, the interface test task is executed; an interface test task is generated, and the interface test task is added to the pipeline task, wherein the interface test task includes determining the code interface corresponding to the compiled product, and performing an interface test on the code interface to obtain the interface test result corresponding to the compiled product. If the interface test result meets the preset interface test requirements, the version management task is executed; a version management task is determined according to a preset product library, and the version management task is added to the pipeline task, wherein the version management task includes taking the compiled product as a production project and uploading it to the product library.

[0008] Optionally, an environment is selected from the container environment pool according to the target version type to obtain a target environment corresponding to the target version type, including: the target version type includes a development version and a formal version; if the project version information includes a development version, an environment is selected from a preset container environment pool according to the development version to obtain a test environment corresponding to the development version, and the test environment is determined as the target environment, wherein the test environment is used to simulate the functional development and service operation of the production project; if the project version information includes a formal version, an environment is selected from the container environment pool according to the formal version to obtain a formal environment corresponding to the formal version, and the formal environment is determined as the target environment, wherein the formal environment includes a pre-production environment and / or a production environment, the pre-production environment is used to simulate the actual operation of the production project, and the production environment is used to simulate the version update of the production project.

[0009] Optionally, the interface testing task determines the code interface corresponding to the production project in the following manner: defining the interface of the production project according to a preset interface definition service to obtain the code interface corresponding to the production project; performing interface coverage detection on the production project to obtain the interface coverage corresponding to the production project; if the interface coverage is less than 100%, supplementing the interface of the code interface corresponding to the production project.

[0010] Optionally, a code integration pipeline is established according to the pipeline task, including: obtaining branch matching rules, wherein the branch matching rules are managed by the code repository and pushed through the push service of the code repository; constructing one or more pipeline triggering conditions according to the branch matching rules, and determining the branch tasks corresponding to each pipeline triggering condition from the pipeline tasks, wherein the branch tasks include at least a part of the pipeline tasks; determining the code integration pipeline according to the pipeline triggering conditions and the branch tasks, wherein if any pipeline triggering condition is met, the branch task corresponding to the pipeline triggering condition is run.

[0011] Optionally, the method also includes: obtaining the current client and an identity tag corresponding to the current client, wherein the identity tag includes at least one of a developer tag and a manager tag; if the current client has a developer tag, performing data management on platform data through the current client, wherein the platform data includes at least one of the code repository, the artifact library, the container environment pool, the code template set, the scanning rule set and the target version type; if the current client has a manager tag, obtaining the task running results corresponding to each of the pipeline tasks in the code integration pipeline, generating a display page according to the running results and the platform data, and displaying the display page on the current client.

[0012] Optionally, the method further includes: performing a permission query on the code repository according to the current client to obtain the code repository permissions corresponding to the current client, wherein the code repository permissions include development permissions and management permissions; if the current client has development permissions, it is determined that the current client has permissions to trigger the operation of the code integration pipeline; if the current client has management permissions, it is determined that the current client has permissions to manage the code integration pipeline.

[0013] The present invention discloses an integrated pipeline establishment system, comprising: an acquisition module, used for acquiring a target language type, a target version type, a code template set and a container environment pool, wherein the code template set includes preset integration templates corresponding to multiple code language types, and the container environment pool includes multiple preset containerized environments; a first determination module, used for performing data matching from the code template set according to the target language type, obtaining a target integration template corresponding to the target language type, and determining a code compilation task according to the target integration template, wherein the code compilation task is used for compiling source code according to the target integration template to obtain a compilation product, wherein the source code is obtained by pulling code from a preset code repository; a second determination module, used for performing environment selection from the container environment pool according to the target version type, obtaining a target environment corresponding to the target version type, and generating a project deployment task according to the target environment, wherein the project deployment task is used for deploying a production project corresponding to the compilation product in the target environment; and an establishment module, used for establishing a code integration pipeline according to pipeline tasks, wherein the pipeline tasks include the code compilation task and the project deployment task.

[0014] The present invention discloses an electronic device, comprising: a processor and a memory; the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the electronic device executes the above method.

[0015] The present invention discloses a computer-readable storage medium, on which a computer program is stored: when the computer program is executed by a processor, the above method is implemented.

[0016] Beneficial effects of the present invention:

[0017] By obtaining the target language type, target version type, code template set and container environment pool, the code compilation task is determined according to the target integration template obtained by matching the target language type, the project deployment task is generated according to the target environment selected by the target version type, and then the code integration pipeline is established according to the pipeline tasks including the code compilation task and the project deployment task. In this way, compared with manually establishing the integration template and deployment environment, the code compilation task is determined by the target language type and the project deployment task is determined by the software version information, which simplifies the method of determining the integration template and deployment environment, thereby realizing the automatic establishment of the code integration pipeline and improving the generation efficiency of the code integration pipeline.

[0018] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0020] Figure 1 It is a schematic diagram of the structure of a code integration pipeline in an embodiment of the present invention;

[0021] Figure 2 It is a flowchart of a method for establishing an integrated pipeline in an embodiment of the present invention;

[0022] Figure 3 It is a flowchart of a method for establishing an integrated pipeline in an embodiment of the present invention;

[0023] Figure 4 It is a structural schematic diagram of an integrated pipeline establishment system in an embodiment of the present invention;

[0024] Figure 5 It is a schematic diagram of the structure of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION

[0025] The following describes the embodiments of the present invention through specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and sub-samples in the embodiments can be combined with each other without conflict.

[0026] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0027] In the following description, numerous details are discussed to provide a more thorough explanation of the embodiments of the present invention. However, it is obvious to those skilled in the art that the embodiments of the present invention can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present invention difficult to understand.

[0028] The terms "first", "second", etc. in the specification and claims of the embodiments of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so that the embodiments of the embodiments of the present disclosure described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions.

[0029] Unless otherwise stated, the term "plurality" means two or more.

[0030] In the embodiment of the present disclosure, the character " / " indicates that the preceding and following objects are in an "or" relationship. For example, A / B indicates: A or B.

[0031] The term "and / or" is a description of the association relationship between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or, A and B.

[0032] First of all, it should be noted that the code integration pipeline runs based on the continuous integration automation platform. It adopts the Pipeline Script (comprehensive solution script) format, including continuous integration steps and continuous delivery steps. Each step includes several tasks. If any task fails to execute, the execution of the code integration pipeline will be terminated.

[0033] The continuous integration automation platform includes a configuration center and a pipeline UI page. The pipeline UI page is built based on Jenkins (a continuous integration tool developed based on Java).

[0034] Combination Figure 1 As shown, the embodiment of the present disclosure provides a code integration pipeline, which implements the code integration pipeline in sequence through a code module 101, a continuous integration module 102, a compilation module 103, an environment module 104, an automated testing module 105, and a display module 106, wherein the code module is used to store source code and is managed by developers; the continuous integration module is used to integrate the source code, and the compilation module is used to integrate the integrated source code, and both are managed by code integrators; the environment module is used to establish an environment for deploying code and is managed by environment managers; the automated testing module is used to test the code and is managed by testers; the display module is used to display the code integration pipeline to managers and quality inspectors.

[0035] As a result, each module of the code integration pipeline needs to be managed by different personnel. At the same time, there are multiple code language types, such as Java (an object-oriented programming language), C++, Android (a free and open source operating system), JavaScript (Java script), Python, etc. Different languages ​​correspond to different environments and different personnel, which increases the complexity and difficulty of establishing and implementing the integration pipeline, making the establishment and implementation of the code integration pipeline very inefficient, unable to meet the lightweight and fast concept of digital enterprise software such as DevOps, and has poor compatibility.

[0036] Combination Figure 2 As shown, the embodiment of the present disclosure provides a method for establishing an integrated pipeline, including:

[0037] Step S201, obtaining a target language type, a target version type, a code template set, and a container environment pool;

[0038] The code template set includes preset integrated templates corresponding to multiple code language types;

[0039] Among them, the container environment pool includes multiple preset containerized environments;

[0040] Step S202, performing data matching from a code template set according to the target language type, obtaining a target integration template corresponding to the target language type, and determining a code compilation task according to the target integration template;

[0041] The code compilation task is used to compile the source code according to the target integration template to obtain the compilation product;

[0042] The source code is obtained by pulling the code from the preset code repository;

[0043] Step S203, selecting an environment from the container environment pool according to the target version type, obtaining a target environment corresponding to the target version type, and generating a project deployment task according to the target environment;

[0044] Among them, the project deployment task is used to deploy the production project corresponding to the compiled product in the target environment;

[0045] Step S204, establishing a code integration pipeline according to the pipeline tasks;

[0046] Among them, pipeline tasks include code compilation tasks and project deployment tasks.

[0047] The disclosed embodiment provides a method for establishing an integrated pipeline, which obtains a target language type, a target version type, a code template set, and a container environment pool, determines a code compilation task according to a target integration template obtained by matching the target language type, generates a project deployment task according to a target environment obtained by selecting the target version type, and then establishes a code integration pipeline according to pipeline tasks including code compilation tasks and project deployment tasks. In this way, compared with manually establishing an integrated template and a deployment environment, the code compilation task is determined by the target language type, and the project deployment task is determined by the software version information, which simplifies the method for determining the integrated template and the deployment environment, thereby realizing the automatic establishment of the code integration pipeline and improving the generation efficiency of the code integration pipeline.

[0048] In some embodiments, the code language type includes at least a portion of the code language.

[0049] In some embodiments, a preset integration template is established through a Pipeline Script, and the parameters in the preset integration template are filled in through the warehouse address, source code, and part of the data of the continuous integration automation platform, thereby simplifying the filling of parameters in the preset integration template and reducing repetitive work.

[0050] Optionally, before establishing a code integration pipeline according to the pipeline task, the method further includes at least one of the following: obtaining a repository address of a code repository, determining a code pulling task according to a target language type and the repository address, and adding the code pulling task to the pipeline task, wherein the code pulling task is used to pull code from a preset code repository according to the target language type to obtain source code corresponding to the target language type; performing data matching from a preset scanning rule set according to the target language type to obtain a target scanning rule corresponding to the target language type, determining a code quality scanning task according to the target scanning rule, and adding the code quality scanning task to the pipeline task, wherein the code quality scanning The task is used to perform code quality testing on the compiled product according to the target scanning rules. If the test result meets the preset code quality requirements, the interface test task is executed; an interface test task is generated, and the interface test task is added to the pipeline task, wherein the interface test task includes determining the code interface corresponding to the compiled product, and performing an interface test on the code interface to obtain the interface test result corresponding to the compiled product. If the interface test result meets the preset interface test requirements, the version management task is executed; the version management task is determined according to the preset product library, and the version management task is added to the pipeline task, wherein the version management task includes taking the compiled product as a production project and uploading it to the product library.

[0051] In some embodiments, the code quality scanning task uses a SonarQube (a source code tool for continuous detection) program source code quality measurement tool, and the test result depends on the judgment rule selected from the tool.

[0052] In some embodiments, the code quality scanning task is further used to perform code quality testing on source code according to target scanning rules.

[0053] Optionally, the interface test result includes one or more of interface coverage, interface data pass rate, etc., and the interface test requirement is determined by setting a threshold value corresponding to each interface test result.

[0054] Optionally, the version management task includes deploying the product generated after compiling the code in a target environment.

[0055] Optionally, an environment is selected from a container environment pool according to the target version type to obtain a target environment corresponding to the target version type, including: the target version type includes a development version and a formal version; if the project version information includes a development version, an environment is selected from a preset container environment pool according to the development version to obtain a test environment corresponding to the development version, and the test environment is determined as the target environment, wherein the test environment is used to simulate functional development and service operation of a production project; if the project version information includes a formal version, an environment is selected from a container environment pool according to the formal version to obtain a formal environment corresponding to the formal version, and the formal environment is determined as the target environment, wherein the formal environment includes a pre-production environment and / or a production environment, wherein the pre-production environment is used to simulate the actual operation of a production project, and the production environment is used to simulate version updates of a production project.

[0056] In this way, the target environment corresponding to the target version information is managed through the container environment pool, which reduces the time for establishing the test environment, deployment environment, development environment, and compilation environment, thereby improving the efficiency of establishing the code integration pipeline.

[0057] Optionally, the container environment pool includes containerized environments of multiple environment types, wherein the environment types include at least part of gradle (an open source tool for automated project construction), maven (a project object model), cmake (a cross-platform installation / compilation tool), and Node.js (a JavaScript runtime environment).

[0058] Optionally, the interface testing task determines the code interface corresponding to the production project in the following manner: define the interface of the production project according to the preset interface definition service to obtain the code interface corresponding to the production project; perform interface coverage detection on the production project to obtain the interface coverage corresponding to the production project; if the interface coverage is less than 100%, supplement the interface of the code interface corresponding to the production project.

[0059] In this way, the code interface corresponding to the production project is determined through two code interface determination methods to meet the unit test requirements for the new interface in code integration, simplify the generation of interface test tasks, and improve generation efficiency.

[0060] In some embodiments, the interface of the production project is defined through swagger in python (a computer programming language) to extract all code interfaces corresponding to the production project, where swagger is a standardized and complete framework for generating, describing, calling and visualizing services. Its goal is to define a standard and language-independent interface that allows people and computers to discover and understand services without accessing source code, documents or network traffic monitoring.

[0061] In some embodiments, production projects that do not meet 100% interface coverage are discovered through regular spot checks, and users are reminded to supplement the code interfaces corresponding to the production projects to determine the code interfaces corresponding to the production projects.

[0062] Optionally, a code integration pipeline is established based on the pipeline tasks, including: obtaining branch matching rules, wherein the branch matching rules are managed through the code repository and pushed through the push service of the code repository; constructing one or more pipeline triggering conditions based on the branch matching rules, and determining the branch tasks corresponding to each pipeline triggering condition from the pipeline tasks, wherein the branch tasks include at least a part of the pipeline tasks; determining the code integration pipeline based on the pipeline triggering conditions and the branch tasks, wherein if any pipeline triggering condition is met, the branch task corresponding to the pipeline triggering condition is run.

[0063] In this way, the branch matching rules are pushed through the push service of the code repository. Compared with the management of branch matching rules by dedicated personnel, the branch matching rules in the code integration pipeline can be centrally managed together with the code repository, thereby reducing the complexity of establishing the code integration pipeline, thereby improving the efficiency of establishing the code integration pipeline. At the same time, it can also reduce configuration items and reduce the probability of errors.

[0064] In some embodiments, the branch matching rule is obtained through a webhook push of a code repository, wherein the webhook has a message push capability and pushes specified data to a client through a generated URL (uniform resource locator).

[0065] In some embodiments, the pipeline trigger condition includes a first trigger condition and a second trigger condition, the first trigger condition includes the presence of newly submitted code in the code repository, and the second trigger condition includes deploying a new target version type, executing a continuous integration step, and after the continuous integration step is completed, executing a continuous delivery step.

[0066] Optionally, the method also includes: obtaining the current client and an identity tag corresponding to the current client, wherein the identity tag includes at least one of a developer tag and a manager tag; if the current client has a developer tag, performing data management on the platform data through the current client, wherein the platform data includes at least one of a code repository, an artifact library, a container environment pool, a code template set, a scanning rule set, and a target version type; if the current client has a manager tag, obtaining the task running results corresponding to each pipeline task in the code integration pipeline, generating a display page according to the running results and the platform data, and displaying the display page on the current client.

[0067] Optionally, if the current client has a developer tag, the pipeline can be triggered, the test environment can be deployed, and the execution data can be viewed; if the current client has a manager tag, the platform data is managed through the current client, where the platform data includes at least one of a code repository, an artifact library, a container environment pool, a code template set, a scanning rule set, and a target version type.

[0068] Optionally, if the current client has a project manager tag in the code repository, the project pipeline integration template can be changed; if the current client has a project developer tag in the code repository, only the task running results corresponding to each pipeline task in the code integration pipeline can be obtained, and a display page can be generated based on the running results and platform data, and the display page can be displayed on the current client.

[0069] In this way, the code warehouse, product library, container environment pool, code template set, scanning rule set and target version type are all maintained by the developers of the development team, reducing the number of participants in the code integration pipeline and the complexity of the code integration pipeline. This not only improves the generation efficiency of the code integration pipeline, but also ensures the consistency of the code integration pipeline generation and improves the integration quality of the code. At the same time, the display page is sent to the management personnel for viewing, which is convenient for the management personnel or quality acceptance personnel to understand the code development status, quickly locate the relevant links of the CI / CD pipeline failure, and can count the test status of the interface and code to improve the error correction efficiency.

[0070] In some embodiments, the identity tag includes one or more of a developer tag, an environment deployment personnel tag, a management personnel tag, a quality acceptance personnel tag, a platform personnel tag, and the like.

[0071] In some embodiments, if any task of the code integration pipeline fails, the code integration pipeline will be terminated, and the cause of the failure can be viewed through a display page to improve error correction efficiency.

[0072] Optionally, the method also includes: performing a permission query on the code repository based on the current client to obtain the code repository permissions corresponding to the current client, wherein the code repository permissions include development permissions and management permissions; if the current client has development permissions, it is determined that the current client has permissions to trigger the operation of the code integration pipeline; if the current client has management permissions, it is determined that the current client has permissions to manage the code integration pipeline.

[0073] Optionally, if the current client has development permissions, it is determined that the current client has permissions to trigger the code integration pipeline and to deploy the test environment; if the current client has management permissions, it is determined that the current client has permissions to manage the code integration pipeline and to deploy all environments.

[0074] In this way, the permissions of the code integration pipeline are determined by the code repository permissions, so that the code repository permissions and the pipeline permissions are the same. There is no need to manually set the permissions of the code integration pipeline, which improves the efficiency of establishing the code integration pipeline.

[0075] Combination Figure 3 As shown, the embodiment of the present disclosure provides an integrated pipeline establishment system, including:

[0076] Step S301, obtaining a code repository, a target language type, a product library, and a target version type;

[0077] Among them, the code repository, target language type, artifact library and target version type are all provided by developers;

[0078] Step S302, determining a code pulling task according to the code repository;

[0079] The code pulling task is used to pull code from the preset code repository according to the target language type to obtain the source code corresponding to the target language type;

[0080] Step S303, pulling the pipeline triggering conditions from the code repository;

[0081] Step S304, obtaining a target integration template according to the target language type matching, and determining a code compilation task according to the target integration template;

[0082] The code compilation task is used to compile the source code according to the target integration template to obtain the compilation product;

[0083] Step S305, obtaining a target scanning rule according to the target language type matching, and determining a code quality scanning task according to the target scanning rule;

[0084] Among them, the code quality test is performed on the compiled product according to the target scanning rules. If the test result meets the preset code quality requirements, the interface test task is executed;

[0085] Step S306, generating an interface test task;

[0086] The interface test task includes determining the code interface corresponding to the compiled product, and performing interface test on the code interface to obtain the interface test result corresponding to the compiled product. If the interface test result meets the preset interface test requirements, the version management task is executed.

[0087] Step S307, determining the version management task according to the product library;

[0088] Among them, the version management task includes taking the compiled product as a production project and uploading it to the product library;

[0089] Step S308, selecting a target environment according to the target version type, and generating a project deployment task according to the target environment;

[0090] Among them, the project deployment task is used to deploy the production project corresponding to the compiled product in the target environment;

[0091] Step S309, establishing a code integration pipeline.

[0092] The embodiment of the present disclosure provides a method for establishing an integrated pipeline, which obtains a target language type, a target version type, a code template set, and a container environment pool, determines a code compilation task according to a target integration template obtained by matching the target language type, generates a project deployment task according to a target environment obtained by selecting the target version type, and then establishes a code integration pipeline according to pipeline tasks including code compilation tasks and project deployment tasks, which has the following advantages:

[0093] 1. Compared with manually establishing integration templates and deployment environments, the code compilation task is determined by the target language type, and the project deployment task is determined by the software version information, which simplifies the method of determining the integration template and deployment environment, thereby realizing the automatic establishment of the code integration pipeline and improving the generation efficiency of the code integration pipeline;

[0094] 2. Manage the target environment corresponding to the target version information through the container environment pool, reduce the time to establish the test environment, deployment environment, development environment, and compilation environment, thereby improving the efficiency of establishing the code integration pipeline;

[0095] 3. The code interface corresponding to the production project is determined through two code interface determination methods to meet the unit test requirements for new interfaces in code integration, simplifying the generation of interface test tasks and improving generation efficiency;

[0096] 4. The branch matching rules are pushed through the push service of the code repository. Compared with the management of branch matching rules by specialized personnel, the branch matching rules in the code integration pipeline can be centrally managed together with the code repository, which reduces the complexity of establishing the code integration pipeline, thereby improving the efficiency of establishing the code integration pipeline. At the same time, it can also reduce configuration items and reduce the probability of errors;

[0097] 5. The code repository, artifact library, container environment pool, code template set, scanning rule set and target version type are all maintained by the developers of the development team, which reduces the number of participants in the code integration pipeline and reduces the complexity of the code integration pipeline. This not only improves the generation efficiency of the code integration pipeline, but also ensures the consistency of the code integration pipeline generation and improves the integration quality of the code;

[0098] 7. Send the display page to the management personnel for viewing, so that the management personnel or quality inspection personnel can understand the code development status, quickly locate the relevant links of the CI / CD pipeline failure, and count the test status of the interface and code to improve the error correction efficiency;

[0099] 8. The permissions of the code integration pipeline are determined by the code repository permissions, so that the code repository permissions and pipeline permissions are the same. There is no need to manually set the permissions of the code integration pipeline, which improves the efficiency of establishing the code integration pipeline.

[0100] Combination Figure 4 As shown, the embodiment of the present disclosure provides an integrated pipeline establishment system, including an acquisition module 401, a first determination module 402, a second determination module 403 and an establishment module 404. The acquisition module 401 is used to acquire a target language type, a target version type, a code template set and a container environment pool, wherein the code template set includes preset integration templates corresponding to multiple code language types, and the container environment pool includes multiple preset containerized environments; the first determination module 402 is used to perform data matching from the code template set according to the target language type, obtain a target integration template corresponding to the target language type, determine a code compilation task according to the target integration template, and the code compilation task is used to compile source code according to the target integration template to obtain a compilation product, wherein the source code is obtained by pulling code from a preset code repository; the second determination module 403 is used to select an environment from the container environment pool according to the target version type, obtain a target environment corresponding to the target version type, generate a project deployment task according to the target environment, and the project deployment task is used to deploy a production project corresponding to the compilation product in the target environment; the establishment module 404 is used to establish a code integration pipeline according to the pipeline task, wherein the pipeline task includes a code compilation task and a project deployment task.

[0101] The disclosed embodiment provides an integrated pipeline establishment system, which obtains the target language type, the target version type, the code template set and the container environment pool, determines the code compilation task according to the target integration template obtained by matching the target language type, generates the project deployment task according to the target environment selected by the target version type, and then establishes the code integration pipeline according to the pipeline tasks including the code compilation task and the project deployment task. In this way, compared with manually establishing the integrated template and the deployment environment, the code compilation task is determined by the target language type, and the project deployment task is determined by the software version information, which simplifies the determination method of the integrated template and the deployment environment, thereby realizing the automatic establishment of the code integration pipeline and improving the generation efficiency of the code integration pipeline.

[0102] Figure 5 The structure diagram of the computer system suitable for implementing the electronic device of the embodiment of the present application is shown. It should be noted that: Figure 5The computer system 500 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0103] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 502 or the program loaded from the storage part 508 to the random access memory (RAM) 503, such as executing the method in the above embodiment. In the RAM 503, various programs and data required for system operation are also stored. The CPU 501, the ROM 502 and the RAM 503 are connected to each other through the bus 504. The input / output (I / O) interface 505 is also connected to the bus 504.

[0104] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed so that a computer program read therefrom is installed into the storage section 508 as needed.

[0105] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 509, and / or installed from a removable medium 511. When the computer program is executed by a central processing unit (CPU) 501, various functions defined in the system of the present application are executed.

[0106] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. This propagated data signal can take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. A computer program contained on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0107] The embodiments of the present disclosure further provide a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, any one of the methods in the embodiments is implemented.

[0108] The computer-readable storage medium in the embodiments of the present disclosure can be understood by ordinary technicians in the field: all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to the computer program. The aforementioned computer program can be stored in a computer-readable storage medium. When the program is executed, the execution includes the steps of the above-mentioned method embodiments; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other media that can store program codes.

[0109] The electronic device disclosed in this embodiment includes a processor, a memory, a transceiver and a communication interface. The memory and the communication interface are connected to the processor and the transceiver and complete communication with each other. The memory is used to store computer programs, the communication interface is used to communicate, and the processor and the transceiver are used to run the computer program so that the electronic device executes each step of the above method.

[0110] In this embodiment, the memory may include a random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0111] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a graphics processing unit (GPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0112] The above description and accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent possible changes only. Unless explicitly required, separate components and functions are optional, and the order of operation may vary. Parts and subsamples of some embodiments may be included in or replace parts and subsamples of other embodiments. Moreover, the words used in this application are only used to describe the embodiments and are not used to limit the claims. As used in the description of the embodiments and claims, unless the context clearly indicates, the singular forms of "a", "an" and "the" are intended to include plural forms as well. Similarly, the term "and / or" as used in this application refers to any and all possible combinations of listings containing one or more associated ones. In addition, when used in the present application, the term "comprise" and its variants "comprises" and / or comprising refer to the presence of a stated sub-sample, whole, step, operation, element, and / or component, but do not exclude the presence or addition of one or more other sub-samples, wholes, steps, operations, elements, components and / or groups of these. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the presence of other identical elements in the process, method or device comprising the elements. In this article, each embodiment may focus on the differences from other embodiments, and the same and similar parts between the various embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.

[0113] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software may depend on the specific application and design constraints of the technical solution. Technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present disclosure. Technicians can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0114] In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units can be only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some sub-samples can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit.

[0115] The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and the block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.

Claims

1. A method for establishing an integrated pipeline, characterized in that: include: Obtain a target language type, a target version type, a code template set, and a container environment pool, wherein the code template set includes preset integration templates corresponding to multiple code language types, and the container environment pool includes multiple preset containerized environments; According to the target language type, data matching is performed from the code template set to obtain a target integration template corresponding to the target language type, and a code compilation task is determined according to the target integration template, wherein the code compilation task is used to compile source code according to the target integration template to obtain a compilation product, wherein the source code is obtained by pulling code from a preset code repository; Select an environment from the container environment pool according to the target version type to obtain a target environment corresponding to the target version type, and generate a project deployment task according to the target environment, wherein the project deployment task is used to deploy the production project corresponding to the compilation product in the target environment; A code integration pipeline is established according to the pipeline tasks, wherein the pipeline tasks include the code compilation task and the project deployment task.

2. The method according to claim 1, characterized in that Before establishing the code integration pipeline according to the pipeline task, the method further includes at least one of the following: Obtaining the warehouse address of the code warehouse, determining a code pulling task according to the target language type and the warehouse address, and adding the code pulling task to the pipeline task, wherein the code pulling task is used to pull code from a preset code warehouse according to the target language type to obtain source code corresponding to the target language type; According to the target language type, data is matched from a preset scanning rule set to obtain a target scanning rule corresponding to the target language type, a code quality scanning task is determined according to the target scanning rule, and the code quality scanning task is added to the pipeline task, wherein the code quality scanning task is used to perform a code quality test on the compiled product according to the target scanning rule, and if the test result meets the preset code quality requirement, an interface test task is executed; Generate an interface test task, and add the interface test task to the pipeline task, wherein the interface test task includes determining a code interface corresponding to the compiled product, and performing an interface test on the code interface to obtain an interface test result corresponding to the compiled product, and if the interface test result meets a preset interface test requirement, execute a version management task; A version management task is determined according to a preset artifact library, and the version management task is added to the pipeline task, wherein the version management task includes taking the compilation product as a production project and uploading it to the artifact library.

3. The method according to claim 2, characterized in that Selecting an environment from the container environment pool according to the target version type to obtain a target environment corresponding to the target version type includes: The target version types include development version and official version; If the project version information includes a development version, an environment is selected from a preset container environment pool according to the development version to obtain a test environment corresponding to the development version, and the test environment is determined as a target environment, wherein the test environment is used to simulate the function development and service operation of the production project; If the project version information includes a formal version, an environment is selected from the container environment pool according to the formal version to obtain the formal environment corresponding to the formal version, and the formal environment is determined as the target environment, wherein the formal environment includes a pre-production environment and / or a production environment, the pre-production environment is used to simulate the actual operation of the production project, and the production environment is used to simulate the version update of the production project.

4. The method according to claim 2, characterized in that: The interface test task determines the code interface corresponding to the production project in the following ways: Performing interface definition on the production project according to a preset interface definition service to obtain a code interface corresponding to the production project; An interface coverage rate detection is performed on the production project to obtain the interface coverage rate corresponding to the production project. If the interface coverage rate is less than 100%, the code interface corresponding to the production project is supplemented.

5. The method according to claim 2, characterized in that: Establish a code integration pipeline based on pipeline tasks, including: Acquire a branch matching rule, wherein the branch matching rule is managed by the code repository and pushed by a push service of the code repository; Constructing one or more pipeline triggering conditions according to the branch matching rule, and determining branch tasks corresponding to each pipeline triggering condition from the pipeline tasks, wherein the branch tasks include at least a part of the pipeline tasks; A code integration pipeline is determined according to the pipeline triggering condition and the branch task, wherein if any pipeline triggering condition is met, the branch task corresponding to the pipeline triggering condition is executed.

6. The method according to any one of claims 2 to 5, characterized in that: The method further comprises: Acquire a current client and an identity tag corresponding to the current client, wherein the identity tag includes at least one of a developer tag and an administrator tag; If the current client has a developer tag, data management is performed on the platform data through the current client, wherein the platform data includes at least one of the code repository, the artifact library, the container environment pool, the code template set, the scanning rule set, and the target version type; If the current client has an administrator tag, the task running results corresponding to each pipeline task in the code integration pipeline are obtained, a display page is generated according to the running results and the platform data, and the display page is displayed on the current client.

7. The method according to claim 6, characterized in that The method further comprises: Performing a permission query on the code repository according to the current client to obtain the code repository permission corresponding to the current client, wherein the code repository permission includes development permission and management permission; If the current client has development authority, determining that the current client has authority to trigger the code integration pipeline to run; If the current client has management authority, it is determined that the current client has authority to manage the code integration pipeline.

8. An integrated pipeline establishment system, characterized in that: include: An acquisition module, used to acquire a target language type, a target version type, a code template set, and a container environment pool, wherein the code template set includes preset integration templates corresponding to multiple code language types, and the container environment pool includes multiple preset containerized environments; A first determination module is used to perform data matching from the code template set according to the target language type to obtain a target integration template corresponding to the target language type, and determine a code compilation task according to the target integration template, wherein the code compilation task is used to compile source code according to the target integration template to obtain a compilation product, wherein the source code is obtained by pulling code from a preset code repository; A second determination module is used to select an environment from the container environment pool according to the target version type, obtain a target environment corresponding to the target version type, and generate a project deployment task according to the target environment, wherein the project deployment task is used to deploy a production project corresponding to the compilation product in the target environment; An establishment module is used to establish a code integration pipeline according to pipeline tasks, wherein the pipeline tasks include the code compilation task and the project deployment task.

9. An electronic device, characterized in that: include: Processor and memory; The memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the electronic device executes the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Continuous integration pipeline system based on automated operation and maintenance and method thereof

    CN107621944A

  • A method and system for intelligent continuous integration and continuous deployment of a pipeline

    CN108958721A