System deployment method and device
Through the branching functions and continuous integration methods of the code version library, the problem of code component integration is solved, seamless integration is achieved, and development efficiency and system security are improved.
Patent Information
- Application Number
- CN202411560484.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-02-21
AI Technical Summary
The existing technology is difficult to achieve seamless integration of different code components, resulting in extended R&D cycles, human errors and internal security issues.
Continuous integration and merging of code through the branching functions of the code version library (development feature branches and product branches). Specific steps include static code analysis, compilation and construction, unit testing, merging code, and recording merge information.
Improve development efficiency, ensure code quality and system security, avoid dependency compatibility issues, and simplify subsequent maintenance and optimization processes.
Smart Images

Figure CN119493580A_ABST
Abstract
Description
Technical Field
[0001] The present invention generally relates to the field of computer technology and more specifically to a system deployment method and device. Background Art
[0002] At present, the software development process generally includes integration, delivery and deployment. Integration is the process of integrating independently developed functional modules, components or subsystems into a complete system. One way of integration is continuous integration. In a continuous integration environment, developers frequently submit code to a shared code base, and then build and test the integrated code. However, during the integration process, some systems rely on manual methods to control and integrate code versions, which is not only time-consuming, but also prone to human errors and cannot solve the internal security issues of the code base and the development process itself. In addition, in complex projects, due to the numerous dependencies of external libraries and resources, compatibility issues often occur and it is difficult to ensure that all components can be seamlessly integrated, resulting in an extension of the R&D cycle. Summary of the invention
[0003] In order to solve the above-mentioned technical problem that seamless integration of different code components cannot be achieved, the present invention provides solutions in the following aspects.
[0004] In a first aspect, the present invention provides a system deployment method, comprising: in response to receiving code submitted by a user to a code version library, performing a first continuous integration on the code to obtain a development feature branch corresponding to the code, the development feature branch is used to characterize a functional branch of a product, and the first continuous integration includes static code analysis, compilation and construction, and unit testing; in response to the development feature branch satisfying a preset merging condition, merging the development feature branch into a corresponding product branch, the product branch is used to characterize a version branch of the product with complete functions; performing a second continuous integration on the merged product branch to obtain an application deployment package corresponding to the product branch, the second continuous integration includes compilation and construction, unit testing, and application packaging; and deploying according to the application deployment package.
[0005] Furthermore, the code is subjected to a first continuous integration, including: performing static code analysis on the code to obtain code that reaches a preset qualified score; compiling and building the qualified code according to a built-in public dependency library or an external network dependency library; and performing unit testing on the built code.
[0006] Furthermore, static code analysis is performed on the code, including: calculating multi-dimensional metrics for the code according to a plurality of preset rules to obtain a static analysis score for the code, wherein the metrics include naming conventions and semantic errors; in response to the static analysis score being less than the preset score, feeding back the result of the static analysis to the user; in response to the static analysis score being greater than or equal to the preset score, outputting the code.
[0007] Furthermore, multi-dimensional metric calculations are performed on the code according to preset rules, including: presetting multiple rule groups and weights corresponding to each rule group, the rule group including at least one calculation rule; calculating the code according to the multiple rules to obtain multiple scores; determining the score of the rule group according to the scores obtained by each calculation rule in the same rule group; and performing calculations based on the score of each rule group and its corresponding weight.
[0008] Furthermore, unit testing is performed on the constructed code, including: presetting multiple test cases;
[0009] The code is tested according to the test case to obtain multiple test scores; in response to the average of the multiple test scores being less than or equal to a preset standard score, the unit test result is fed back to the user; in response to the average being greater than the reference score, the code is output.
[0010] Furthermore, the merging condition includes: the general switch state is on, and the current characteristic score is greater than a preset merging score threshold, the general switch state is set by the user, and the current characteristic score is obtained according to the unit test.
[0011] Furthermore, the development feature branch is merged into the corresponding product branch, including: when a code conflict occurs during the merging process, in response to adopting a manual resolution strategy, conflict information is fed back to the user, the conflict information including the detailed location of the conflict and related code snippets; in response to adopting an automatic resolution strategy, the code conflict is automatically handled according to a preset conflict resolution strategy.
[0012] Furthermore, the application deployment package includes a name, size and version number; deployment according to the deployment package includes: registering the application deployment package in an application version library, the application version library includes an application deployment package, version information and preset deployment rules, wherein there is a preset mapping relationship between the application deployment package and the version information, and there is a preset mapping relationship between the version information and the deployment rules; if an automatic deployment method is adopted, all application deployment packages in the application version library are traversed, the version information is determined according to the application deployment package, the deployment rules are determined according to the version information, and deployment is performed according to the deployment rules; if a manual deployment method is adopted, the application deployment package is obtained, the version information is determined according to the application deployment package, the deployment rules are determined according to the version information, and deployment is performed according to the deployment rules.
[0013] Furthermore, it also includes: retaining the development feature branch and recording merge information, wherein the merge information includes merge time, development feature branch name and version number.
[0014] In a second aspect, the present invention provides a system deployment device, comprising a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the system deployment method according to any one of the first aspects is implemented.
[0015] The beneficial effects of the present invention are as follows: the present invention enables developers to work independently on different features through the branching function (development special effect branch and product branch) of the code version library, and realizes the seamless integration of the development feature branch into the final product through preset numerical values, thereby improving the efficiency of development. The security of the software system is improved through strict management and quality control of the code, and the standardization of the system deployment process. The compatibility problem of dependency relationships is avoided through the built-in public dependency library. In addition, by recording the merge information, when problems are found later, they can be traced back quickly and accurately, and then corresponding adjustments and optimizations are made, thereby improving the efficiency of maintenance. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0017] Figure 1 is a flowchart schematically illustrating a system deployment method according to an embodiment of the present invention, wherein a process of continuous code integration is illustrated;
[0018] Figure 2is a flowchart schematically illustrating a system deployment method according to an embodiment of the present invention, wherein a deployment process of a deployment package is illustrated;
[0019] Figure 3 It is a structural diagram schematically showing a system deployment device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0020] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0021] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0022] Figure 1 Schematically shows a flow chart of a system deployment method according to an embodiment of the present invention, which shows a process of continuous code integration.
[0023] In a first aspect, the present invention provides a system deployment method, such as Figure 1 As shown, the method of the present invention comprises:
[0024] S101. In response to receiving a code submitted by a user to a code version library, performing a first continuous integration on the code to obtain a development feature branch corresponding to the code.
[0025] Continuous integration is the process of automatically detecting, pulling, building and unit testing after source code changes. Specifically, developers submit the written code to the code version library associated with the system, which stores the basic code resources in the software development process, as well as data such as code change records. The code version library has a branching function. In this embodiment, the branch includes a development feature branch and a product branch. It can be understood that a development feature branch corresponds to a functional module, and each development feature branch is independent of each other. The functional code completed by the developer will be submitted and pushed to the corresponding development feature branch; each product iteration will establish a corresponding product branch, and a product branch corresponds to a version of a product with complete functions. In the product branch, the code submitted by the developer is not accepted, and only the development feature branch is accepted for code merging. Through the code branching function of the code version library, developers can work independently on different features and seamlessly combine them into the final product, thereby improving the efficiency of development.
[0026] In one embodiment, in response to the code version library receiving the code, the code is subjected to a first continuous integration. In this embodiment, the first continuous integration includes pulling code, static code analysis, compiling and building, and unit testing.
[0027] Specifically, when pulling code, the code submitted by the developer and the internal configuration information are actively pulled from the code version library, and then the pulled code is subjected to static code analysis according to preset rules. It can be understood that static code analysis refers to the analysis of code semantics and behavior without actually executing the program.
[0028] In one embodiment, when performing static code analysis on the code, a multi-dimensional metric is calculated for the code according to a plurality of preset rules to obtain a static code analysis score, and then the static code analysis result of the code is obtained according to the relationship between the static code analysis score and the preset qualified score. Specifically, when the static code analysis score is greater than or equal to the qualified score, it indicates that the static code analysis of the code has passed (the quality of the code is qualified); when the static code analysis score is less than the qualified score, it indicates that the static code analysis of the code has failed, and the static code analysis report (including the location and cause of the problem) is fed back to the developer so that he can make corresponding optimizations and improvements. Specifically, the above judgment process can be implemented in the following way:
[0029]
[0030] In the formula, RGS is the static code analysis score, and RSB is the preset qualified score. A pass status of 1 indicates that the static code analysis has passed, and a pass status of 0 indicates that the static code analysis has not passed.
[0031] In this embodiment, the metric indicators include syntax errors, semantic errors, naming conventions, etc. In one embodiment, static code analysis includes defect detection, specification detection, and metric analysis. Among them, defect detection includes syntax error detection, semantic error detection, null pointer detection, cross-bounds detection, data overflow, deadlock, improper exception handling, etc. By performing defect detection on the submitted code, problems that affect system stability and security can be detected, and then corresponding optimizations are performed to ensure that the system can operate normally and reduce the probability of subsequent processing errors.
[0032] Furthermore, when the code is tested for compliance, the code submitted by the developer is tested according to the predefined unified coding rules. In one embodiment, the compliance testing includes naming specifications, code format, resource definition, modularity, annotation rationality, etc.
[0033] In one embodiment, when performing defect detection and specification detection, the code is scored according to a plurality of preset rules to obtain a static code analysis score. Specifically, a plurality of rule groups are preset, each rule group includes at least one calculation rule, and each rule group is provided with a corresponding weight. A plurality of scores are calculated according to each calculation rule, and the score of the rule group is determined according to the scores corresponding to each calculation rule in the same rule group. It should be noted that the rule group corresponds to the content included in the defect detection and specification detection, for example, a syntax error corresponds to a rule group, and a naming specification corresponds to a rule group. In the rule group corresponding to the naming specification, the variable name corresponds to a calculation rule, the macro definition corresponds to a calculation rule, the constant name corresponds to a calculation rule, and so on.
[0034] In this embodiment, the smallest score among the scores obtained by the various calculation rules in the same rule group is used as the score of the rule group. Specifically, the calculation expression of the score of the rule group is as follows:
[0035] SG i =min 1≤j≤m S ij ;
[0036] Where, SG i represents the i-th rule group, S ij represents the score of the jth calculation rule in the ith rule group, and m represents the number of calculation rules included in the ith rule group.
[0037] It should be noted that the smallest score in the rule group is selected to ensure that the problem corresponding to the calculation rule with the lowest score can be taken seriously. When the problem corresponding to the calculation rule with the lowest score reaches the qualified standard, it means that the problems corresponding to other rules can also reach the qualified standard. By selecting the smallest score in the rule group as the score of the entire rule group, developers are prompted to not only pay attention to the implementation of functions, but also control various quality dimensions of the code, thereby comprehensively improving the code quality, thereby avoiding the risks brought by code quality problems, such as memory leaks, and facilitating long-term maintenance of the code.
[0038] Furthermore, according to the score and weight of each rule group, the static code analysis score of the code is determined. Specifically, the calculation expression of the static code analysis score is as follows:
[0039]
[0040] In the formula, RGS represents the static code analysis score, RGW i represents the weight of the i-th rule group, and n represents the number of rule groups.
[0041] In one embodiment, in the rule group corresponding to the naming specification, the score calculation expression of the calculation rule corresponding to the variable naming is as follows:
[0042]
[0043] It can be understood that the above expression means: 100 points are given for matching the calculation rule. If non-standard variable naming is detected once in one thousand lines of code, 20 points will be subtracted from the 100 points.
[0044] It should be noted that in the calculation expression of the score of the calculation rule, those skilled in the art can adjust 100, 1000 and 20 according to actual conditions. In addition, the calculation of the score of the macro definition and constant naming rules is similar to the calculation rule of variable naming.
[0045] Furthermore, the score of the calculation rule in defect detection can be set as follows: as long as there is one irregularity, the score of the calculation rule is set to 0. This is because once a defect occurs, it will cause serious problems such as the system being unable to operate normally or low stability. Therefore, by setting it to 0, developers are forced to strictly control the quality before proceeding to the next step, thereby improving the quality of the code and the stability and security of the system, thereby improving development efficiency.
[0046] By performing static code analysis on the submitted code content, various problems in the code can be discovered in the early stages of the software development process, thereby improving development efficiency and software quality. Specifically, through defect detection, specification detection and metric analysis, it is ensured that the code meets predefined standards, making the code more readable, maintainable and reliable, so that when problems are discovered later, adjustments and optimizations can be made quickly, thereby achieving seamless integration of different code components.
[0047] Furthermore, when compiling and building, the code that passes the static code analysis is compiled and built through the built-in public dependency library or the external network dependency library. In one embodiment, the public dependency library is configured with an internal algorithm. If the dependency already exists in the system, it is directly used. If the dependency does not exist in the system, the location of the network dependency library is found according to the predetermined configuration, and it is automatically cached to the public dependency library for next use. In one embodiment, the public dependency library includes resource data that all software cycles rely on, such as aven warehouses, npm warehouses, docker image warehouses, etc. Through the built-in public dependency library, it is avoided that developers need to find and solve compatibility problems during the compilation and construction process, which improves the efficiency of compilation and construction and further speeds up the development speed.
[0048] Furthermore, when performing unit testing, each logical unit of the code is covered and tested, and the content of the test is predefined by the developer. Specifically, multiple test cases are preset, and the code is tested according to the test cases to obtain multiple test scores, and the score of the unit test of the code is determined according to the multiple test scores. In this embodiment, the calculation expression of the unit test score is:
[0049]
[0050] In the formula, S unit Indicates the unit test score, S testcase_i represents the score of the i-th test case, and N represents the number of test cases.
[0051] Furthermore, it is determined whether the unit test of the code has passed according to the unit test score and the preset standard score. Specifically, when the unit test score is greater than the preset standard score, it means that the unit test has passed, and the next step is carried out; when the unit test score is less than or equal to the preset standard score, it means that the unit test has not passed, and the unit test report is fed back to the developer so that he can make corresponding adjustments and optimizations to achieve seamless integration of different code components.
[0052] In this embodiment, the standard score is 80 points. In other optional embodiments, those skilled in the art can set it according to the specific requirements and quality standards of the project.
[0053] By performing static code analysis and unit testing on the submitted code, only code that reaches the preset score can proceed to the next stage, ensuring the quality of the code and reducing problems that arise during merging, thereby significantly reducing the possibility of errors and defects in the final software product.
[0054] S102: In response to the development feature branch satisfying a preset merging condition, merging the development feature branch into a corresponding product branch.
[0055] In one embodiment, the merging condition includes: the general switch state is on, and the current feature score is greater than the preset merge score threshold. Specifically, when the code passes the unit test, it can be preliminarily determined that the current feature score meets the requirements, and then it can be determined whether the development feature branch needs to be merged into the product branch based on the general switch state. Specifically, when the general switch state is on, and the current feature score reaches the preset merge score threshold (the current feature score is greater than or equal to the preset merge score threshold), the merge is performed, otherwise, the merge is not performed. Among them, the general switch state is set by the developer or tester, and the current feature score is determined according to the score of the unit test. In one embodiment, the general switch state value can be a Boolean value (for example, true means on, flase means off) or an integer (for example, 1 means on, 0 means off). In addition, the unit test of the code passes, indicating that the current feature score reaches the merge score threshold.
[0056] Since different projects have different complexities, for complex projects, manual confirmation is required to avoid errors after merging. Therefore, by having developers or testers set the master switch status, the flexibility of merging, as well as the security and reliability of merging, is improved.
[0057] It is understandable that the product branch represents a relatively stable and verified code baseline, and the development feature branch will be integrated on the corresponding product branch. Specifically, the latest code version is obtained from the feature branch, and then the code is gradually merged into the product branch. In one embodiment, the merge operation can be performed by using the merge command in Git.
[0058] Furthermore, during the merge process, the system will try to automatically match and integrate the modified parts of the code, and automatically detect code conflicts. It can be understood that code conflicts mean that the development feature branch and the product branch have different modifications to the same part of the same file. For example, a function has its parameter list modified in the development feature branch, while the logic inside the function body has been modified in the product branch, which will cause a conflict.
[0059] Specifically, when a code conflict is detected, in response to adopting a manual resolution strategy, conflict information is fed back to the developer. In this embodiment, the conflict information includes the detailed location of the conflict and the relevant code snippets, so that the developer can quickly and efficiently resolve the conflict (select to keep the modification of the development feature branch, keep the modification of the product branch, or combine the two to make new modifications), thereby improving the efficiency of the merge.
[0060] Further, in response to adopting the automatic resolution strategy, the conflict is handled according to a preset conflict resolution strategy. In one embodiment, the conflict resolution strategy includes: giving priority to retaining modifications to the product branch, and if the modifications to the development feature branch are marked as more important or more in line with specific rules, retaining the modifications to the development feature branch. It should be noted that the conflict resolution strategy can quickly handle some simple conflicts, but complex conflicts require manual intervention for further adjustments. For example, when it is determined that the number of differences in the modifications is relatively large, an automatic resolution strategy can be used for modifications with smaller differences, and a manual resolution strategy or a combination of the automatic resolution strategy and the manual resolution strategy can be used for modifications with large differences.
[0061] Furthermore, after the merge is completed, the development feature branch will continue to be retained for subsequent iterations of problem or defect handling. Specifically, if problems are found in the product branch, and these problems are related to the code of a development feature branch, you can quickly trace back to the development feature branch to troubleshoot and fix the problem. In the subsequent iteration process, if problems are found, you can adjust and optimize them on the feature branch, and then re-perform unit testing and other related verifications on the optimized code. When the code of the development feature branch meets the preset merging conditions again, the code of the development feature branch can be merged into the product branch again, so as to continuously improve the function and quality of the product.
[0062] Further, it also includes recording the merge information or adding relevant annotation information in the submission record of the code version library, and the annotation information includes relevant details of each merge. In this embodiment, the merge information includes the date and time of the merge, the version number of the product branch, and the name and version number of the development feature branch. In one embodiment, a log file can be preset to record the merge information, and the log file can be stored in the code version library or other databases.
[0063] By recording the merge information, when problems arise later, the development feature branch and product branch can be quickly determined through the merge information, so that corresponding processing can be carried out. In addition, the time sequence of code integration and the changes of product branches after each merge can be quickly obtained, which shortens the time of finding problems and improves the efficiency of maintenance.
[0064] S103: Perform a second continuous integration on the merged product branch to obtain an application deployment package corresponding to the product branch.
[0065] In one embodiment, after the code of the development feature branch is integrated into the product branch, a compilation and construction activity based on the entire product will be triggered, and the construction process is similar to the compilation and construction in the first continuous integration.
[0066] Furthermore, the entire product is unit tested at the full module coverage level to ensure that the introduced functional features can be adapted to the product. This unit testing method is similar to the unit testing process in the first continuous integration, but the coverage requirement is to basically cover the relevant business of the entire product.
[0067] Furthermore, after passing the product-level unit test, the product-level application is packaged, and after the packaging is completed, an application deployment package is obtained. In response to generating a new application deployment package, the deployment package is automatically registered in the application version library for use by the deployment service.
[0068] In this embodiment, the deployment service is developed with the application version library as the core. The application version library maintains the deployment packages, version information, deployment rules of each stage, etc. of each version of the application. The deployment service can realize automatic or manual deployment based on this information.
[0069] The process of deploying services is as follows Figure 2 As you can see, the deployment package is registered in the application version library, and then the test environment is deployed. The deployment package is deployed to the application server for testing. After the test passes, the grayscale environment is deployed. The test version that passes the test is deployed to the application server for testing. After the test passes, the production environment is deployed. The grayscale version that passes the test is deployed to the application server to serve users. At this point, the deployment of the deployment package is completed. It is understandable that if the test fails, it will be fed back to the developer, and the developer will adjust and optimize according to the problem to make it pass the test.
[0070] Specifically, the application version library stores deployment packages of various versions of the application and the corresponding version information and deployment rules. Each deployment package contains the application code, configuration files, name, size, version number, etc. for deployment operations; each version information can include version description, version number, release time, related change logs, current version stage, etc., to understand and manage different versions of applications; each deployment rule defines the deployment method of the application version at a specific stage, including whether to support automatic deployment, manual deployment conditions, etc.
[0071] In one embodiment, there is a preset mapping relationship between the deployment package and the version information, and there is a preset mapping relationship between the version information and the deployment rule.
[0072] Furthermore, when the deployment package is to be deployed, if the automatic deployment method is adopted, all deployment packages in the application version library are traversed. Furthermore, for each deployment package, the version information of the deployment package is determined according to the mapping relationship between the deployment package and the version information, and the version information includes information such as the version number to which the current deployment package belongs and the stage in which the current version is located. According to the stage in the version information, the deployment rules of the deployment package are determined based on the mapping relationship between the version information and the deployment rules. It is determined whether the deployment rules allow automatic deployment. If automatic deployment is allowed, automatic deployment is performed. In one embodiment, the actual deployment operation can be performed by calling the deployPackage function.
[0073] If manual deployment is adopted, the deployment package to be deployed is obtained, and the version information corresponding to the deployment package is determined according to the mapping relationship between the deployment package and the version information. According to the phase in the version information, the deployment rule of the deployment package is determined based on the mapping relationship between the version information and the deployment rule, and it is determined whether the deployment rule allows manual deployment. If manual deployment is allowed, manual deployment is performed. In one embodiment, the actual deployment operation can be performed by calling the deployPackage function.
[0074] The deployment service of the present invention is centered on the application version library, and realizes automatic and manual deployment through the mapping relationship between deployment packages, version information and deployment rules, thereby improving the flexibility and manageability of deployment and being able to adapt to different application scenarios and requirements.
[0075] Furthermore, the method of the present invention also includes: operation and maintenance services, which are responsible for coordinating and managing various functional modules to ensure the smooth operation of the entire operation and maintenance process, involving the management of system startup, shutdown, upgrade and other operations, as well as the scheduling and execution of various operation and maintenance tasks.
[0076] In one embodiment, Figure 2 As shown, the operation and maintenance services include application management, configuration association, environment status monitoring and log analysis.
[0077] In application management, the main focus is on the entire life cycle management of the application, including application deployment, update, uninstallation and other operations. It also involves the monitoring and optimization of application performance to ensure that the application can provide services stably and efficiently during operation.
[0078] In configuration management, it is mainly responsible for the management of system and application configuration information to ensure that each component can correctly obtain and use configuration parameters in different environments, thereby ensuring the normal operation of the system. Configuration management has the functions of storage, version control, distribution of configuration files, and dynamic update of configuration parameters.
[0079] Environmental status monitoring is the real-time monitoring of the environmental status of the system operation, including monitoring the usage of the server's hardware resources (such as CPU, memory, disk, etc.), as well as monitoring the network connection status, the operating status of system services, etc. By obtaining environmental status information in a timely manner, potential problems can be discovered in advance and appropriate measures can be taken to prevent and repair them.
[0080] In log analysis, the logs generated by the system and applications are collected, analyzed, and processed. It is understandable that logs are important records of the system operation process, containing a large amount of information about system behavior and events. By analyzing the logs, we can understand the system operation status, find abnormal behavior and error information, and provide a basis for system optimization and troubleshooting.
[0081] In summary, the present invention can improve the security of software systems through strict management and quality control of codes and standardization of system deployment processes. Through static code analysis and unit testing, code problems that may lead to security vulnerabilities can be discovered and repaired, while reasonable code management and system deployment processes can prevent the injection and spread of malicious code. In addition, by recording and merging information, when problems are discovered later, they can be traced quickly and accurately, and adjustments and optimizations can be made, thereby improving the efficiency of maintenance.
[0082] Figure 3 FIG. 4 is a block diagram schematically showing a structure of a system deployment device according to this embodiment.
[0083] In a second aspect, the present invention also provides a system deployment device. Figure 3 As shown, the device includes a processor and a memory, the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a system deployment method according to the first aspect of the present invention is implemented.
[0084] The device also includes other components well known to those skilled in the art, such as a communication interface, and the configuration and functions of the components are known in the art, so they will not be described in detail here.
[0085] In the present invention, the aforementioned memory may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus or device. For example, a computer-readable storage medium may be any suitable magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory RRAM (Resistive Random Access Memory), a dynamic random access memory DRAM (Dynamic Random Access Memory), a static random access memory SRAM (Static Random-Access Memory), an enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), a high-bandwidth memory HBM (High-Bandwidth Memory), a hybrid memory cube HMC (Hybrid Memory Cube), etc., or any other medium that may be used to store the required information and may be accessed by an application, a module, or both. Any such computer storage medium may be part of a device or accessible or connectable to a device. Any application or module described in the present invention may be implemented using computer-readable / executable instructions that may be stored or otherwise maintained by such a computer-readable medium.
[0086] In the description of this specification, "plurality" means at least two, for example, two, three or more, etc., unless otherwise clearly defined.
[0087] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.
Claims
1. A system deployment method, characterized in that: include: In response to receiving a code submitted by a user to a code version library, performing a first continuous integration on the code to obtain a development feature branch corresponding to the code, the development feature branch is used to represent a functional branch of a product, and the first continuous integration includes static code analysis, compilation and construction, and unit testing; In response to the development feature branch satisfying a preset merging condition, merging the development feature branch into a corresponding product branch, the product branch being used to represent a version branch of the product with complete functions; Performing a second continuous integration on the merged product branch to obtain an application deployment package corresponding to the product branch, wherein the second continuous integration includes compilation and construction, unit testing, and application packaging; Deployment is performed according to the application deployment package.
2. The system deployment method according to claim 1, characterized in that: Performing a first continuous integration on the code includes: Performing static code analysis on the code to obtain code that reaches a preset qualified score; Compile and build qualified codes according to built-in public dependency libraries or external network dependency libraries; Unit test the built code.
3. The system deployment method according to claim 2, characterized in that: Performing static code analysis on the code, including: Calculating multi-dimensional metrics of the code according to a plurality of preset rules to obtain a static analysis score of the code, wherein the metrics include naming conventions and semantic errors; In response to the static analysis score being less than the preset score, feeding back the result of the static analysis to the user; In response to the static analysis score being greater than or equal to the preset score, the code is output.
4. The system deployment method according to claim 3, characterized in that: The code is calculated based on the preset rules in terms of multi-dimensional metrics, including: Preset multiple rule groups and weights corresponding to each rule group, wherein the rule group includes at least one calculation rule; Calculate the code according to the calculation rule to obtain multiple scores; Determine the score of the rule group according to the scores obtained by each calculation rule in the same rule group; The calculation is performed based on the score of each rule group and its corresponding weight.
5. The system deployment method according to claim 2, characterized in that: Unit test the built code, including: Preset multiple test cases; Testing the code according to the test case to obtain multiple test scores; In response to the average of the plurality of test scores being less than or equal to a preset standard score, feeding back the unit test result to the user; In response to the mean being greater than the standard score, the code is output.
6. The system deployment method according to claim 1, characterized in that: The merging condition includes: the main switch state is on, and the current characteristic score is greater than a preset merging score threshold, the main switch state is set by the user, and the current characteristic score is obtained according to the unit test.
7. The system deployment method according to claim 1, characterized in that: Merge the development feature branch into the corresponding product branch, including: When a code conflict occurs during the merging process, in response to adopting a manual resolution strategy, conflict information is fed back to the user, the conflict information including a detailed location of the conflict and related code snippets; In response to adopting the automatic resolution strategy, the code conflict is automatically processed according to a preset conflict resolution strategy.
8. The system deployment method according to claim 1, characterized in that: The application deployment package includes a name, size and version number; and deploying according to the deployment package includes: Registering the application deployment package in an application version library, wherein the application version library includes an application deployment package, version information, and a preset deployment rule, wherein a preset mapping relationship exists between the application deployment package and the version information, and a preset mapping relationship exists between the version information and the deployment rule; If the automatic deployment method is adopted, all application deployment packages in the application version library are traversed, version information is determined according to the application deployment package, deployment rules are determined according to the version information, and deployment is performed according to the deployment rules; If manual deployment is adopted, an application deployment package is obtained, version information is determined according to the application deployment package, deployment rules are determined according to the version information, and deployment is performed according to the deployment rules.
9. The system deployment method according to claim 1, characterized in that: Also includes: The development feature branch is retained, and merge information is recorded, where the merge information includes merge time, development feature branch name, and version number.
10. A system deployment device, characterized in that: The system comprises a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the system deployment method according to any one of claims 1 to 9 is implemented.