Code integration method, device and system and electronic equipment
By setting up three branches in C/S architecture applications and using code branch management, compilation and packaging deployment modules, code integration is automated, which solves the problem of low code integration efficiency and accuracy, and improves R&D efficiency and product quality.
Patent Information
- Application Number
- CN202411134135.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-19
- Publication Date
- 2024-12-03
AI Technical Summary
In C/S architecture applications, the existing technology leads to low accuracy and efficiency in code integration, which affects the speed of product updates and iterations, especially because the development managers of Server and Client programs need to manually collect and compile and package them, resulting in Inefficient research and development and difficult to standardize code management.
By setting up three branches (debug branch, develop branch and master branch), the corresponding code integration task will be automatically triggered when the code is merged. Integrate in the test environment first, and then merge it to the production environment after the test results to ensure the consistency of the code. and accuracy, using code branch management, construction and dependency management modules, and compilation and packaging deployment modules to achieve automated compilation and packaging deployment.
It improves the efficiency of code integration and the speed of product update and iteration, ensures the accuracy and quality of code integration, reduces the testing workload, reduces the labor cost of R&D and integration testing, and improves project collaboration and consistency.
Smart Images

Figure CN119065675A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and specifically to a code integration method, device, system and electronic device. Background Art
[0002] C / S architecture applications are generally divided into server-side programs and client-side programs. When developing C / S architecture applications, developers usually collaborate to develop codes and then integrate the codes. Code integration of C / S architecture applications refers to the compilation, packaging and deployment of codes.
[0003] Due to the distinction between server-side programs and client-side programs, in some methods, the development managers of server-side programs and client-side programs collect codes from all R&D personnel, and then manually compile, package and deploy them. This results in low accuracy and efficiency during code integration, affecting the speed of product updates and iterations. Summary of the invention
[0004] In view of the above problems, embodiments of the present application provide a code integration method, device, system and electronic device for efficient code integration.
[0005] According to one aspect of an embodiment of the present application, a code integration method is provided, including: in response to code merged into a first branch, performing a first code integration task on the code in the first branch, and obtaining a first result of the first code integration task; in response to the first branch being merged into the code in a second branch, recording a test result of the first result; after the test result characterizes a pass, in response to the second branch being merged into the code in a third branch, performing a second code integration task on the code in the third branch, and obtaining a second result of the second code integration task, and the second result is applied to a production environment.
[0006] In an optional manner, the first code integration task includes a first compilation and packaging task and a first deployment task; performing the first code integration task on the code in the first branch to obtain a first result of the first code integration task further includes: performing the first compilation and packaging task on the code in the first branch to obtain a first packaging result; based on the test environment configured by the client program, deploying the first packaging result to a test server to complete the first deployment task and obtain the first result.
[0007] In an optional manner, performing a first code integration task on the code in the first branch to obtain a first result of the first code integration task further includes: determining a first target task device for a type of a first code project corresponding to the code in the first branch, different types of code projects correspond to different task devices; performing a first code integration task on the code in the first branch based on the first target task device to obtain a first result of the first code integration task.
[0008] In an optional manner, the type of the first code project includes a microservice type; the first code integration task is performed on the code in the first branch based on the first target task device to obtain a first result of the first code integration task, further including: determining the first command parameter and the first address parameter required for the first code integration task in a preset table according to the name of the first code project and the first branch, the preset table including command parameters and address parameters corresponding to different code projects and different branches; splicing the first command parameters to obtain a first packaging result, and deploying the first packaging result to the address corresponding to the first address parameter to obtain the first result at the address corresponding to the first address parameter.
[0009] In an optional manner, in response to the code in the second branch being merged into the third branch, performing a second code integration task on the code in the third branch to obtain a second result of the second code integration task further includes: determining a second target task device for a type of a second code item corresponding to the code in the third branch; and performing a second code integration task on the code in the third branch based on the second target task device to obtain a second result of the second code integration task.
[0010] In an optional manner, the type of the second code project includes a microservice type; the second code integration task is performed on the code in the third branch based on the second target task device to obtain a second result of the second code integration task, further including: determining the second command parameters and second address parameters required for the third code integration task in a preset table according to the name of the second code project and the third branch; splicing the second command parameters to obtain a second packaging result, and deploying the second packaging result to the address corresponding to the second address parameter to obtain the second result at the address corresponding to the second address parameter.
[0011] In an optional manner, the second code integration task includes a second compilation and packaging task and a second deployment task; performing the second code integration task on the code in the third branch to obtain a second result of the second code integration task further includes: performing the second compilation and packaging task on the code in the third branch to obtain a second packaging result; based on the production environment configured by the client program, deploying the second packaging result to the production server to complete the second deployment task and obtain the second result.
[0012] According to another aspect of an embodiment of the present application, a code integration device is provided, including: a first branch processing module, used to perform a first code integration task on the code in the first branch in response to the code merged into the first branch, and obtain a first result of the first code integration task; a second branch processing module, used to record a test result of the first result in response to the code merged into the second branch by the first branch; a third branch processing module, used to perform a second code integration task on the code in the third branch in response to the code merged into the third branch by the second branch after the test result characterization passes, and obtain a second result of the second code integration task, and the second result is applied to a production environment.
[0013] According to one aspect of an embodiment of the present application, a code integration system is also provided, including: a code branch management module, the code branch management module is provided with a first branch, a second branch and a third branch; a code construction and dependency management module, connected to the code branch management module, the code construction and dependency management module having code project mutual dependencies; a compilation, packaging and deployment module, connected to the code construction and dependency management module; wherein the first branch of the code branch management module is used to receive code, and is used to call the code project mutual dependencies in the code construction and dependency management module, and the first code integration task is performed on the code in the first branch through the compilation, packaging and deployment module to obtain a first result of the first code integration task; the second branch of the code branch management module is used to merge the code of the first branch, and is used to call the test results recorded in the code construction and dependency management module for testing the first result; the third branch of the code branch management module is used to merge the code of the second branch, and is used to call the code project mutual dependencies in the code construction and dependency management module, and the second code integration task is performed on the code in the third branch through the compilation, packaging and deployment module to obtain a second result of the second code integration task, and the second result is applied to the production environment.
[0014] According to one aspect of an embodiment of the present application, an electronic device is provided, including: a controller; and a memory for storing one or more programs, which, when the one or more programs are executed by the controller, execute the above-mentioned code integration method.
[0015] According to one aspect of an embodiment of the present application, a computer-readable storage medium is further provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer executes the above-mentioned code integration method.
[0016] According to one aspect of the embodiments of the present application, a computer program product or a computer program is also provided, the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the above-mentioned code integration method.
[0017] The embodiment of the present application sets three branches. When there is a code merge in the first branch, the first code integration task is triggered to obtain a first result for testing. When the code is merged in the second branch, the code integration is not triggered, and the test result is recorded. When the code is merged in the third branch, the second code integration task is triggered to obtain a second result, and the second result is used in the production environment. In this way, the integration of codes in the test environment and the production environment is automatically realized through three branches, so as to ensure the efficiency of code integration and the speed of product update iteration. Moreover, the consistency of codes in the first branch and the third branch is ensured through the sequential merging order of the three branches, so as to improve the quality of code integration products and ensure the accuracy of code integration products.
[0018] The above description is only an overview of the technical solution of the embodiment of the present application. In order to more clearly understand the technical means of the embodiment of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiment of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0020] Figure 1 It is a flowchart of a code integration method shown in an exemplary embodiment of the present application.
[0021] Figure 2 It is a structural diagram of a code integration system shown in an exemplary embodiment of the present application.
[0022] Figure 3 It is a flowchart of a code integration method shown in another exemplary embodiment of the present application.
[0023] Figure 4 It is a structural diagram of a code integration device shown in an exemplary embodiment of the present application.
[0024] Figure 5 It is a structural diagram of a computer system of an electronic device shown in an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0025] Here, exemplary embodiments will be described in detail, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.
[0026] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0027] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0028] The term "multiple" as used in this application refers to two or more than two. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the related objects are in an "or" relationship.
[0029] C / S architecture applications are generally divided into server-side programs and client-side programs. When developing C / S architecture applications, many developers often work together to develop code and then integrate the code. Server-side programs are divided into test environments and production environments, and client-side programs are divided into configuration test environments and configuration production environments. In addition, server-side programs are generally microservice architectures, so server-side programs are split into at least dozens of code projects. Therefore, code integration of C / S architecture applications, that is, code compilation, packaging and deployment, has many pain points. The standardization, accuracy and efficiency of code integration will deeply affect the quality of code integration, thereby affecting the testing workload and the final quality of the product, as well as the speed of product updates and iterations.
[0030] In some C / S architecture application development methods, the development managers of the server-side program and the client-side program usually collect the code from all R&D personnel, and then manually compile, package and deploy it.
[0031] This approach not only reduces R&D efficiency, but also makes it difficult to standardize code management and R&D process management. It is easy to introduce new defective codes during code integration.
[0032] Based on this, a code integration method is proposed in this embodiment. The code integration method can be applied in a C / S architecture to improve the efficiency of code integration.
[0033] Please refer to Figure 1 , Figure 1 1 is a flowchart of a code integration method shown in an exemplary embodiment of the present application. It at least includes S110 to S130, which are described in detail as follows:
[0034] S110: In response to the code merged into the first branch, a first code integration task is performed on the code in the first branch to obtain a first achievement of the first code integration task.
[0035] In this embodiment, for each code project, a first branch, a second branch and a third branch are created, wherein the first branch is a debug branch (representing the test version of the code project), the second branch is a develop branch (representing the subsequent version of the next version), and the third branch is a master branch (representing the production version of the code project).
[0036] It can be understood that the code integration method can be applied to a code integration system, which is divided into three modules, namely, a code branch management module, a code building and dependency management module, and a compilation, packaging and deployment module. In the code branch management module, a first branch, a second branch and a third branch are created for each code project.
[0037] The code integration system can be used in a C / S architecture to realize code integration in the C / S architecture.
[0038] like Figure 2 This is a structural diagram of a code integration system proposed in an embodiment. The system includes a code branch management module, a code construction and dependency management module, and a compilation, packaging and deployment module that are connected in sequence. The code construction and dependency management module has code project interdependencies, and the compilation, packaging and deployment module has compilation, packaging and deployment programs for each code project.
[0039] By inputting the source code of each end of the code project into the code branch management module, the code building and dependency management modules are called through the three branches in the code branch management module, and deployed on the client and server ends through the compilation, packaging and deployment module.
[0040] It should be noted that the C / S architecture may include a production environment and a test environment, so that it can be deployed on the client and server sides. It can be deployed on the test environment server on the server side and the production environment server. It can also configure the corresponding installation package on the test environment on the client side and the corresponding installation package on the production environment server to complete the testing of the code project and production after the testing is completed.
[0041] The following is a detailed description of the code integration method implemented on the code integration system.
[0042] In step S110, the codes developed by different developers in each code project can be merged into the first branch through personal branches. The first branch can receive the code submitted by different developers in a code project at any time. When the first branch code is updated, the first code integration task of the corresponding code project will be triggered, that is, the compilation, packaging and deployment tasks of the code project will be automatically triggered, and the compilation, packaging and deployment tasks of all code projects that depend on the code project will be automatically triggered.
[0043] The compilation, packaging and deployment module will execute the compilation, packaging and deployment tasks in sequence. The server-side program is deployed to the test environment server, and the client-side program is configured on the test environment server. After the compilation, packaging and deployment are completed, the R&D personnel test the overall integration results of the project.
[0044] In this embodiment, the first achievement of the first code integration task corresponding to the first branch is an achievement deployed in the test environment.
[0045] It can be understood that the first code integration task may include a first compilation and packaging task and a first deployment task. The first compilation and packaging task is performed on the code in the first branch to obtain a first packaging result; the first packaging result not only includes the code in the first branch, but also includes the results obtained by other codes that depend on the code in the first branch. The dependency relationship is pre-written into the code building and dependency management module.
[0046] The first packaged result is a deployable script, and the first result is obtained by deploying the first packaged result in a test server.
[0047] In this embodiment, when the code in the first branch is updated, the dependency relationship between the first code project and the updated code will be obtained in the code construction and dependency modules, and then the first code integration task will be executed on all code projects that have dependencies on the first code project, rather than just executing the first code integration task on the updated code.
[0048] That is, when executing step S110 to perform the first code integration task on the code in the first branch and obtain the first result of the first code integration task, the first code project corresponding to the code in the first branch should be obtained first, and then the first dependent code project corresponding to the first code project should be determined according to the preset dependency relationship, and then the first code integration task is performed on the first code project and the first dependent code project to obtain the first result.
[0049] In this embodiment, based on the test environment configured by the client program, the first packaged result is deployed to the test server to complete the first deployment task and obtain the first result. That is, after obtaining the first packaged result, the client program configures the test environment Server end, and the first packaged result is deployed to the test environment server corresponding to the test environment Server end to obtain the first result that can be tested.
[0050] In this embodiment, the first packaging result is achieved through Jenkins software (an open source software), and the subsequent first deployment task can determine different deployment task devices according to the type of code project to complete the first deployment task. The deployment task device can be software, system, etc. used to implement deployment, and no specific restrictions are made here.
[0051] In some embodiments, a first target task device is determined based on the type of the first code project corresponding to the code in the first branch, and different types of code projects correspond to different task devices; based on the first target task device, a first code integration task is performed on the code in the first branch to obtain a first result of the first code integration task.
[0052] The implementation of the first code integration task is completed in the compilation, packaging and deployment module. In the compilation, packaging and deployment module, different task devices for executing compilation, packaging and deployment tasks are developed according to different code project types. For example, if the code project type is Android, the corresponding task device is Jenkins+Android packaging plug-in, and the IOS (an operating system) type code project uses Jenkins+IOS packaging plug-in. It can be understood that Jenkins is a compilation and packaging task device. For different code project types, the compilation and packaging task devices can be the same, but the deployment task devices are different. For example, the Android type corresponds to the Android packaging plug-in, and the IOS type corresponds to the IOS packaging plug-in.
[0053] In this way, when the code in the first branch is updated, the type of the corresponding first code project is obtained to determine the first target task device. Different types of code projects correspond to different task devices. Then, the first code integration task is performed on the code in the first branch through the first target task device. It can also be understood that when performing the first code integration task, the corresponding dependency relationship will be obtained in the code construction and dependency management module, so that the first code integration task is performed on all code projects with corresponding dependencies, thereby obtaining the corresponding first results.
[0054] In some embodiments, the type of the first code project includes a microservice type. At this time, the first command parameter and the first address parameter required for the first code integration task are determined in a preset table according to the name of the first code project and the first branch. The preset table includes command parameters and address parameters corresponding to different code projects and different branches; the first command parameters are spliced to obtain a first packaged result, and the first packaged result is deployed to the address corresponding to the first address parameter to obtain the first result at the address corresponding to the first address parameter.
[0055] In this embodiment, for microservice types, the corresponding first target task device is Jenkins+linuxshell (a script)+python (a programming language software)+excel (table), which pre-fills the command parameters and address parameters of hundreds of microservice type code projects into the preset table, and the command parameters include the compilation, packaging, and deployment commands for the corresponding code projects, and the address parameters include the compilation server address, the test environment server address, and the production environment server address. Each code project is a row of the preset table. Then configure hundreds of tasks in Jenkins, each task is a compilation, packaging, and deployment task for a code project, and the task name is the name of the code project + the name of the branch, and the name of the branch is the first branch and the third branch. Then write a python program, configure the Jenkins task to execute the python program, and configure the code pull address of each code project in the Jenkins task.
[0056] When the first branch needs to be integrated, in the corresponding task of Jenkins, click Start Build, and then the Jenkins task will execute the Python program written in the previous step. The Python program first reads the Jenkins software variable to obtain the task name, and then parses the task name to obtain the name of the first code project + the first branch. Then, according to the name of the first code project and the first branch, find the corresponding row of the preset table 1 to obtain the first command parameter and the first address parameter. The first address parameter is the corresponding address of the test environment server, and then the compilation, packaging, and deployment command parameters corresponding to the first command parameter are spliced to automatically generate a complete Linux shell script for the compilation, packaging and deployment of the project, that is, the first packaging result. Then, according to the first address parameter, a connection is established with the corresponding test server, and each script is pushed to the test environment server and the script is run, thereby completing the one-click automatic compilation, packaging and deployment of the code project.
[0057] It can be understood that, when it is the first branch, the address parameter obtained in the preset table is the test server address, and when it is the second branch, the address parameter obtained in the preset table is the production server address.
[0058] S120: In response to the code of the first branch being merged into the second branch, recording a test result of the first achievement.
[0059] In this embodiment, before the code project is ready for transfer testing, all code projects are merged from the first branch into the second branch. The code update of the second branch does not trigger the compilation, packaging and deployment tasks, but only serves as a record of the transfer testing version. The tester tests the overall test results of the transfer testing version of the project. Before the test is completed, the first branch will no longer be updated. Developers can submit new code to their personal branches, but not to the first branch.
[0060] S130: After the test result characterization passes, in response to the code in the second branch being merged into the third branch, a second code integration task is performed on the code in the third branch to obtain a second achievement of the second code integration task, and the second achievement is applied to the production environment.
[0061] After the test results are completed and the test result characterization is passed, the code in the second branch is merged into the third branch, the code in the third branch performs the second code integration task, and the second achievement of the second code integration task is obtained, and the second achievement is applied to the production environment.
[0062] It can be understood that, similar to the first branch, when executing step S130 to perform the second code integration task on the code in the second branch and obtain the second result of the second code integration task, the second code project corresponding to the code in the third branch should be obtained first, and then the second dependent code project corresponding to the second code project should be determined according to the preset dependency relationship, and then the second code integration task is performed on the second code project and the second dependent code project to obtain the second result.
[0063] The second code integration task triggered by the third branch is similar to the process of the first code integration task, except that the second result is the result deployed in the production environment. The second code integration task includes a second compilation and packaging task and a second deployment task. The second compilation and packaging task is performed on the code in the third branch to obtain a second packaging result. The second packaging result is to run the script, and deploy the second packaging result to the production server based on the production environment configured by the client program to complete the second deployment task and obtain the second result.
[0064] In some embodiments, the type of the second code project in the third branch can also determine the second target task device, so that the second code integration task is performed on the code in the third branch based on the second target task device to obtain the second result of the second code integration task.
[0065] When the type of the second code project is a microservice type, the second command parameter and the second address parameter required for the third code integration task are determined in a preset table according to the name of the second code project and the third branch; the second command parameters are spliced to obtain a second packaged result, and the second packaged result is deployed to the address corresponding to the second address parameter to obtain the second result at the address corresponding to the second address parameter.
[0066] The second address parameter is the corresponding address of the production environment server.
[0067] It can be understood that the specific execution process of the second code integration task can refer to the first code integration task, which will not be repeated here.
[0068] In this embodiment, for Figure 2 The code integration system in Figure 1 In the code integration method in the present embodiment, a process of specifically executing the code integration method based on each module in the code integration system is proposed, referring to Figure 3 , Figure 3 It is a flowchart of a code integration method shown in another exemplary embodiment of the present application.
[0069] In the code branch management module, first, a first branch, a second branch and a third branch are created for each code project. When the developer of each code project submits code in a personal branch, the submitted code is merged into the first branch at any time, thereby triggering the compilation, packaging and deployment task of the first code project of the submitted code in the code construction and dependency management module, and at the same time triggering the compilation, packaging and deployment task of the first dependent code project that depends on the first code project. The compilation, packaging and deployment task for the first code project and the first dependent code project is to execute the first code integration task. It can be understood that the code construction and dependency management module pre-creates the dependency relationship between the code projects. When the first code integration task is triggered, in the compilation, packaging and deployment module, the compilation, packaging and deployment tasks of the first code project and the first dependent code project are executed in sequence, the server-side program is deployed to the test environment server, the client-side program configures the test environment server, and the first result is obtained. The tester tests the first result. The compilation, packaging and deployment module is pre-set with the compilation, packaging and deployment program of each code project, so that the first code integration task can be executed.
[0070] In the code branch management module, before switching to testing, the code project is merged from the first branch into the second branch. At this time, in the code building and dependency management module, the compilation, packaging and deployment tasks are not triggered, and only the switching version records are made. Correspondingly, in the compilation, packaging and deployment module, the tester tests the first achievement and obtains the test results. Before the test is completed, the first branch is no longer updated.
[0071] In the code branch management module, the overall test of the code project is completed, and all code projects are merged from the second branch into the third branch. The compilation, packaging and deployment task of the second code project of the merged code is triggered in the code construction and dependency management module, and the compilation, packaging and deployment task of the second dependent code project that depends on the second code project is triggered at the same time. The compilation, packaging and deployment task for the second code project and the second dependent code project is to execute the second code integration task. In the compilation, packaging and deployment module, the compilation, packaging and deployment tasks of the second code project and the second dependent code project are executed in sequence, the server-side program is deployed to the production environment server, and the client-side program configures the production environment server to obtain the second result.
[0072] In this embodiment, a code integration method is proposed, which automatically realizes code integration in the test environment and the production environment through three branches, thereby improving the efficiency of code integration. At the same time, by using code branch management + code dependency management + continuous integration technology, the entire R&D process of the C / S architecture application is standardized, highly efficient integration and high-speed development and test iteration are achieved, which can effectively ensure the quality of code integration, reduce the testing workload, ensure product quality, greatly improve the efficiency of R&D, integration, and testing, and greatly save the manpower cost of R&D, integration, and testing. Moreover, this process is realized by incorporating the codes in the three branches, thereby improving the collaboration, traceability, and consistency of project R&D.
[0073] At the same time, merging the codes in the first branch, the second branch, and the third branch in sequence can effectively ensure the consistency of the codes of the first branch and the third branch and the consistency of the compilation, packaging, and deployment operations, that is, ensuring the consistency of the test environment and the production environment, thereby effectively ensuring the quality of the product; and the corresponding code integration system maintenance workload is extremely small. After it is built, only one maintenance personnel needs to spend a little time to maintain a small amount of content. For microservice-type code projects, if the microservice needs to connect to a new code project and add a server, it only needs to maintain a small amount of information in the preset table.
[0074] This application provides a code integration system, such as Figure 2 As shown, it includes: a code branch management module, a code building and dependency management module, and a compilation, packaging and deployment module which are connected in sequence.
[0075] The code branch management module is provided with a first branch, a second branch and a third branch. The first branch is used to receive codes at each end of the code project, the second branch is used to receive codes of the first branch, and the third branch is used to receive codes of the second branch.
[0076] The code building and dependency management module is connected with the code branch management module, and the code building and dependency management module has code project mutual dependency relationship.
[0077] The compilation, packaging and deployment module is connected to the code building and dependency management modules to perform compilation, packaging and deployment tasks.
[0078] In some embodiments, the first branch of the code branch management module is used to receive code, and to call the code construction and dependency management module to determine the interdependencies between code projects. The first code integration task is performed on the code in the first branch by compiling, packaging and deploying the module to obtain a first result of the first code integration task.
[0079] It can be understood that the first branch is used to receive code, and to call the code construction and dependency management module to determine the interdependencies between code projects, so as to obtain other codes that have dependencies on the code written into the first branch. Then, through the dependency, the code received in the first branch and other codes that have dependencies are compiled, packaged and deployed to perform the first code integration task, thereby obtaining the first result of the first code integration task.
[0080] The second branch of the code branch management module is used to merge the code of the first branch, and to call the code building and dependency management module to record the test results of the test for the first achievement.
[0081] The third branch of the code branch management module is used to merge the code of the second branch, and to call the code construction and dependency management module. The code in the third branch is subjected to the second code integration task by compiling, packaging and deploying the module to obtain the second result of the second code integration task, and the second result is applied to the production environment.
[0082] Similar to the processing process of the code in the first branch, in some embodiments, the third branch of the code branch management module is used to receive code, and to call the code project interdependencies in the code building and dependency management module, and to perform a second code integration task on the code in the third branch by compiling, packaging and deploying the module, to obtain a second result of the second code integration task. The code integration system can implement the above-mentioned code integration method. The process and principle of specifically implementing the code integration method in the code integration system can refer to the code integration method provided in the above-mentioned embodiment and will not be repeated here.
[0083] Another aspect of the present application also provides a code integration device, such as Figure 4 As shown, Figure 4 4 is a schematic diagram of a code integration device according to an exemplary embodiment of the present application. The code integration device 400 includes:
[0084] The first branch processing module 410 is used to perform a first code integration task on the code in the first branch in response to the code merged into the first branch, and obtain a first result of the first code integration task.
[0085] The second branch processing module 430 is used to record the test result of the first achievement in response to the code of the first branch being merged into the second branch.
[0086] The third branch processing module 450 is used to, after the test result characterization is passed, respond to the code in the second branch being merged into the third branch, perform a second code integration task on the code in the third branch, obtain a second result of the second code integration task, and apply the second result to the production environment.
[0087] In an optional manner, the first code integration task includes a first compilation and packaging task and a first deployment task, and the first branch processing module further includes:
[0088] The first compiling and packaging unit is used to perform a first compiling and packaging task on the code in the first branch to obtain a first packaging result.
[0089] The first deployment unit is used to deploy the first packaging result to the test server based on the test environment configured by the client program to complete the first deployment task and obtain the first result.
[0090] In an optional manner, the first branch processing module further includes:
[0091] The first task device determining unit is used to determine the first target task device according to the type of the first code item corresponding to the code in the first branch, and different task devices correspond to different types of code items.
[0092] The first branch processing unit is used to perform a first code integration task on the code in the first branch based on the first target task device to obtain a first result of the first code integration task.
[0093] In an optional manner, the type of the first code project includes a microservice type, and the first branch processing unit further includes:
[0094] The first parameter acquisition section is used to determine the first command parameter and the first address parameter required for the first code integration task in a preset table according to the name of the first code project and the first branch. The preset table includes command parameters and address parameters corresponding to different code projects and different branches.
[0095] The first result acquisition section is used to splice the first command parameter to obtain the first packaged result, and deploy the first packaged result to the address corresponding to the first address parameter to obtain the first result at the address corresponding to the first address parameter.
[0096] In an optional manner, the third branch processing module further includes:
[0097] The second task device determining unit is used to determine the second target task device according to the type of the second code item corresponding to the code in the third branch.
[0098] The third branch processing unit is used to perform a second code integration task on the code in the third branch based on the second target task device to obtain a second result of the second code integration task.
[0099] In an optional manner, the type of the second code project includes a microservice type, and the third branch processing unit further includes:
[0100] The second parameter acquisition section is used to determine the second command parameter and the second address parameter required for the third code integration task in a preset table according to the name of the second code project and the third branch.
[0101] The second result acquisition section is used to splice the second command parameters to obtain the second packaged result, and deploy the second packaged result to the address corresponding to the second address parameter to obtain the second result at the address corresponding to the second address parameter.
[0102] In an optional manner, the second code integration task includes a second compilation and packaging task and a second deployment task, and the third branch processing module further includes:
[0103] The second compiling and packaging unit is used to perform a second compiling and packaging task on the code in the third branch to obtain a second packaging result.
[0104] The second deployment unit is used to deploy the second packaging result to the production server based on the production environment configured by the client program to complete the second deployment task and obtain the second result.
[0105] The code integration device of the present application automatically realizes code integration in a test environment and a production environment through three branches, thereby improving the efficiency of code integration.
[0106] It should be noted that the code integration device provided in the above embodiment and the code integration method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs operations has been described in detail in the method embodiment and will not be repeated here.
[0107] Another aspect of the present application provides an electronic device, comprising: a controller and a memory for storing one or more programs, and when the one or more programs are executed by the controller, the above-mentioned code integration method is executed.
[0108] See also Figure 5 , Figure 5 1 is a schematic diagram of the structure of a computer system of an electronic device shown in an exemplary embodiment of the present application, which shows a schematic diagram of the structure of a computer system of an electronic device suitable for implementing an embodiment of the present application.
[0109] It should be noted that Figure 5 The 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.
[0110] like Figure 5As 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, ROM 502 and RAM 503 are connected to each other through a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0111] 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, etc.; 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.
[0112] 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.
[0113] 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 storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium can include a data signal propagated in a baseband or as a part of a carrier wave, wherein a computer-readable computer program is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The computer program contained on the 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.
[0114] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0115] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0116] Another aspect of the present application further provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the vehicle light control method as described above is implemented. The computer-readable storage medium may be included in the electronic device described in the above embodiment, or may exist independently without being assembled into the electronic device.
[0117] Another aspect of the present application also provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the vehicle light control method provided in each of the above embodiments.
[0118] According to one aspect of an embodiment of the present application, a computer system is also provided, including a central processing unit (CPU), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) or a program loaded from a storage portion into a random access memory (RAM), such as executing the method in the above embodiment. In RAM, various programs and data required for system operation are also stored. CPU, ROM and RAM are connected to each other via a bus. An input / output (I / O) interface is also connected to the bus.
[0119] The following components are connected to the I / O interface: an input part including a keyboard, a mouse, etc.; an output part including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage part including a hard disk, etc.; and a communication part including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication part performs communication processing via a network such as the Internet. A drive is also connected to the I / O interface as needed. Removable media, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., are installed on the drive as needed so that the computer program read therefrom is installed into the storage part as needed.
[0120] The above content is only a preferred exemplary embodiment of the present application and is not intended to limit the implementation scheme of the present application. A person skilled in the art can easily make corresponding changes or modifications based on the main concept and spirit of the present application. Therefore, the scope of protection of the present application shall be based on the scope of protection required by the claims.
Claims
1. A code integration method, characterized in that: include: In response to the code merged into the first branch, performing a first code integration task on the code in the first branch to obtain a first achievement of the first code integration task; In response to the first branch being merged into the code in the second branch, recording a test result of testing the first achievement; After the test result characterization passes, in response to the second branch being merged into the code in the third branch, a second code integration task is performed on the code in the third branch to obtain a second result of the second code integration task, and the second result is applied to the production environment.
2. The method according to claim 1, characterized in that The first code integration task includes a first compile and package task and a first deployment task; performing the first code integration task on the code in the first branch to obtain a first result of the first code integration task further includes: Performing the first compiling and packaging task on the code in the first branch to obtain a first packaging result; Based on the test environment configured by the client program, the first packaging result is deployed to the test server to complete the first deployment task and obtain the first result.
3. The method according to claim 1, characterized in that The performing a first code integration task on the code in the first branch to obtain a first result of the first code integration task further includes: Determine a first target task device according to the type of the first code item corresponding to the code in the first branch, where different types of code items correspond to different task devices; Based on the first target task, the device performs a first code integration task on the code in the first branch to obtain a first result of the first code integration task.
4. The method according to claim 3, characterized in that The type of the first code project includes a microservice type; the device based on the first target task performs a first code integration task on the code in the first branch to obtain a first result of the first code integration task, further including: Determining, according to the name of the first code project and the first branch, a first command parameter and a first address parameter required for the first code integration task in a preset table, wherein the preset table includes command parameters and address parameters corresponding to different code projects and different branches; The first command parameters are concatenated to obtain a first packaging result, and the first packaging result is deployed to the address corresponding to the first address parameter to obtain the first result at the address corresponding to the first address parameter.
5. The method according to claim 1, characterized in that In response to the code in the second branch being merged into the third branch, performing a second code integration task on the code in the third branch to obtain a second result of the second code integration task further includes: Determine a second target task device according to the type of the second code item corresponding to the code in the third branch; Based on the second target task, the device performs a second code integration task on the code in the third branch to obtain a second achievement of the second code integration task.
6. The method according to claim 5, characterized in that The type of the second code project includes a microservice type; the device based on the second target task performs a second code integration task on the code in the third branch to obtain a second result of the second code integration task, further including: Determining, in a preset table according to the name of the second code project and the third branch, a second command parameter and a second address parameter required for the third code integration task; The second command parameters are concatenated to obtain a second packaging result, and the second packaging result is deployed to the address corresponding to the second address parameter to obtain the second result at the address corresponding to the second address parameter.
7. The method according to claim 1, characterized in that The second code integration task includes a second compile and package task and a second deployment task; performing the second code integration task on the code in the third branch to obtain a second result of the second code integration task further includes: Performing the second compiling and packaging task on the code in the third branch to obtain a second packaging result; Based on the production environment configured by the client program, the second packaging result is deployed to the production server to complete the second deployment task and obtain the second result.
8. A code integration device, characterized in that: include: A first branch processing module, configured to, in response to the code merged into the first branch, perform a first code integration task on the code in the first branch to obtain a first result of the first code integration task; A second branch processing module, configured to record a test result of testing the first achievement in response to the code of the first branch being merged into the second branch; The third branch processing module is used to, after the test result characterization is passed, respond to the code in the second branch being merged into the third branch, perform a second code integration task on the code in the third branch, obtain a second result of the second code integration task, and apply the second result to the production environment.
9. A code integration system, characterized in that: include: A code branch management module, wherein the code branch management module is provided with a first branch, a second branch and a third branch; A code building and dependency management module, connected to the code branch management module, wherein the code building and dependency management module has a code project mutual dependency relationship; Compile, package and deploy modules, connected to the code building and dependency management modules; The first branch of the code branch management module is used to receive code and to call the code project interdependencies in the code building and dependency management module, and to perform a first code integration task on the code in the first branch through the compile, package and deploy module to obtain a first result of the first code integration task; The second branch of the code branch management module is used to merge the code of the first branch, and to call the test result recorded in the code building and dependency management module for testing the first achievement; The third branch of the code branch management module is used to merge the code of the second branch, and to call the code project interdependencies in the code building and dependency management module. The second code integration task is performed on the code in the third branch through the compilation, packaging and deployment module to obtain a second result of the second code integration task, and the second result is applied to the production environment.
10. An electronic device, characterized in that: include: Controller; A memory for storing one or more programs, which, when executed by a controller, enables the controller to implement the method according to any one of claims 1 to 7.
