Development branch synchronization method based on continuous integration and related equipment

Through automatic verification and testing of asynchronous methods on the development side devices, the development branch is synchronized to the main branch, which solves the problems of low synchronization efficiency and easy blockage in traditional technology, realizes parallel synchronization, and reduces the time cost of code integration and Ensure high availability of the master branch.

CN119149094APending Publication Date: 2024-12-17ZTE CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310717194.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-15
Publication Date
2024-12-17

AI Technical Summary

Technical Problem

The traditional continuous integration development branch synchronization model is inefficient and prone to blocking, resulting in code value stream blocking and unable to effectively handle conflicts and failures between development branches.

Method used

By performing asynchronous merge verification, automatic integration verification and automatic testing on the development side devices, the development branch is synchronized to the main branch, changing the synchronous execution body and process, moving the synchronization process forward from the third-party code hosting platform, and achieving parallel synchronization .

Benefits of technology

Improves the synchronization efficiency of development branches, reduces the time cost of code integration, avoids synchronization queue blocking, and ensures high availability of the master branch.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119149094A_ABST
    Figure CN119149094A_ABST
Patent Text Reader

Abstract

The invention provides a development branch synchronization method based on continuous integration, computer equipment and a computer readable storage medium, and belongs to the technical field of computers. In order to solve the problem of low development branch synchronization efficiency based on continuous integration in the prior art, the method comprises the steps of receiving a synchronization request of a development branch, obtaining the development branch according to the synchronization request, loading a first main branch from a third-party code hosting platform to obtain a first local main branch, and synchronizing the development branch based on the first local main branch. Performing pre-synchronization verification on the development branches, synchronizing the target main branch combined with the development branches to a third-party code hosting platform under the condition that the pre-synchronization verification of the development branches is passed, then performing preset verification test on the target main branch, and synchronizing the target main branch combined with the development branches to the third-party code hosting platform under the condition that the target main branch passes the preset verification test. And determining the target main branch as the main branch hosted by the third-party code hosting platform, so that parallel synchronization of different development branches can be realized, and the time cost of development branch code integration is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a development branch synchronization method based on continuous integration, a computer device and a computer-readable storage medium. Background Art

[0002] Continuous Integration (CI) is a software development practice. Simply put, it is to frequently integrate new code into the main version. Large software projects generally deploy multi-level CI for layered quality protection to accelerate the overall integration of software systems. The R&D team performs iterative development in multiple development branches, and then synchronizes the development branches to the main branch.

[0003] In traditional technology, different development branches are generally synchronized to the main branch in a serial queue manner, and then a version is produced and compiled and packaged to verify the integration reliability, so as to ensure that conflicts and code production failures generated during the development code synchronization process are discovered and handled in a timely manner. In the above synchronization mode of synchronizing the development branch to the main branch, on the one hand, code synchronization and version production verification take a certain amount of time, and the waiting time in the queue increases with the number of branches. On the other hand, once a code production failure is introduced after a synchronization of the development branch, it is necessary to wait for the fault to be located, repaired, and verified before the main branch availability can be restored. During this period, the synchronization queue is blocked, the main branch version output is also blocked, and the code value flow is blocked. Therefore, the above synchronization mode is inefficient and prone to blocking. Summary of the invention

[0004] The present invention provides a development branch synchronization method based on continuous integration, a computer device and a computer-readable storage medium, which can improve the synchronization efficiency of development branches based on continuous integration.

[0005] In a first aspect, the present invention provides a development branch synchronization method based on continuous integration, comprising: receiving a synchronization request for a development branch, and obtaining the development branch according to the synchronization request; loading a first main branch from a third-party code hosting platform to obtain a first local main branch; based on the first local main branch, performing pre-synchronization verification on the development branch; if the pre-synchronization verification of the development branch passes, synchronizing a target main branch that has been merged with the development branch to the third-party code hosting platform; performing a preset verification test on the target main branch, and if the target main branch passes the preset verification test, determining the target main branch as the main branch hosted by the third-party code hosting platform.

[0006] In a second aspect, the present invention further provides a computer device, comprising a processor, a memory, a computer program stored in the memory and executable by the processor, and a data bus for realizing connection and communication between the processor and the memory, wherein when the computer program is executed by the processor, the steps of any one of the development branch synchronization methods based on continuous integration provided in the specification of the present invention are realized.

[0007] In a third aspect, the present invention further provides a storage medium for computer-readable storage, characterized in that the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of any method for development branch synchronization based on continuous integration provided in the specification of the present invention.

[0008] The present invention provides a development branch synchronization method based on continuous integration, a computer device and a storage medium. The method receives a synchronization request of a development branch, obtains the development branch according to the synchronization request, and loads a first main branch from a third-party code hosting platform to obtain a first local main branch, then performs a pre-synchronization verification on the development branch based on the first local main branch, and if the pre-synchronization verification of the development branch passes, synchronizes the target main branch that has merged the development branch to the third-party code hosting platform, then performs a preset verification test on the target main branch, and if the target main branch passes the preset verification test, determines the target main branch as the main branch hosted by the third-party code hosting platform, thereby removing the processing of synchronizing the development branch to the main branch from the third-party code hosting platform. The platform is moved to the development side device. Based on the development side device, an asynchronous method is used to perform automatic merging verification, automatic integration verification and automatic testing of the development branches involved in the synchronization process of the development branches, until the development branch is synchronized to the main branch on the third-party code hosting platform and hosted. The synchronization of the development branch to the main branch of the third-party code hosting platform is completed, and the execution subject and process of synchronization are changed by changing the development branch. Under the premise of effectively ensuring the high availability of the main branch of the third-party code hosting platform, parallel synchronization of different development branches can be achieved, which solves the problems of low efficiency and easy blocking of serial queuing synchronization of development branches, and reduces the time cost of development branch code integration. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0010] Figure 1A schematic diagram of a process flow of a development branch synchronization method based on continuous integration provided by an embodiment of the present invention;

[0011] Figure 2 A schematic diagram of a specific process of synchronizing different development branches in parallel in a development branch synchronization method based on continuous integration provided by an embodiment of the present invention;

[0012] Figure 3 A schematic diagram of a first sub-process of a development branch synchronization method based on continuous integration provided in an embodiment of the present invention;

[0013] Figure 4 A second sub-flow diagram of the development branch synchronization method based on continuous integration provided in an embodiment of the present invention;

[0014] Figure 5 A schematic diagram of a third sub-process of a development branch synchronization method based on continuous integration provided in an embodiment of the present invention;

[0015] Figure 6 A fourth sub-flow diagram of the development branch synchronization method based on continuous integration provided in an embodiment of the present invention;

[0016] Figure 7 A fifth sub-process diagram of the development branch synchronization method based on continuous integration provided in an embodiment of the present invention;

[0017] Figure 8 A schematic block diagram of the structure of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0018] 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 ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0019] The flowcharts shown in the accompanying drawings are only examples 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 may be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.

[0020] It should be understood that the terms used in the present specification are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the present specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0021] The embodiment of the present invention provides a development branch synchronization method based on continuous integration, a computer device and a storage medium. The development branch synchronization method based on continuous integration can be applied to computer devices including but not limited to development terminals, servers, cloud platforms, etc., to implement iterative development of software in application scenarios such as branch management and version management.

[0022] In the face of the problem of low efficiency of development branch synchronization based on continuous integration in traditional technologies, the inventors propose a development branch synchronization method based on continuous integration in an embodiment of the present invention. The core idea of ​​the embodiment of the present invention is: the process of synchronizing the development branch to the main branch is moved from the third-party code hosting platform to development side devices including but not limited to development terminals, local servers, cloud servers, etc. on the development side. Based on the development side devices, an asynchronous method is used to perform automatic merging verification, automatic integration verification and automatic testing of the development branches involved in the synchronization process of the development branches, until the development branch is merged into the main branch and synchronized to the third-party code hosting platform, completing the synchronization of the development branch to the main branch of the third-party code hosting platform. Therefore, by changing the execution subject and process of synchronization of the development branch, it is possible to achieve parallel synchronization of different development branches under the premise of effectively ensuring the high availability of the main branch of the third-party code hosting platform, thereby solving the problems of low efficiency and easy blocking of serial queuing synchronization of development branches, and reducing the time cost of code integration of development branches.

[0023] Some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0024] See also Figure 1 and Figure 2 , Figure 1 A flow chart of a development branch synchronization method based on continuous integration provided by an embodiment of the present invention, Figure 2 A schematic diagram of a specific process of synchronizing different development branches in parallel based on a continuous integration development branch synchronization method provided by an embodiment of the present invention. Figure 1 As shown, in this embodiment, the method includes but is not limited to the following steps S11-S15:

[0025] S11. Receive a synchronization request for a development branch, and obtain the development branch according to the synchronization request.

[0026] Explanatoryly, the device that performs the development branch synchronization action is the device on the development side corresponding to the development branch. Relative to the third-party code hosting platform, the device on the development side can be simply referred to as the development side device. The device that performs the development branch synchronization action can be but is not limited to the development terminal, the local server on the development side, or the cloud server. The device that performs the development branch synchronization action receives the synchronization request of the development branch and loads the development branch according to the synchronization request.

[0027] In one example, the device that performs the development branch synchronization action may be a development terminal. When the development branch needs to be synchronized to a third-party code hosting platform, a synchronization request for the development branch may be initiated at the development terminal to which the development branch belongs, and the synchronization request is processed locally at the development terminal. Thus, the development terminal receives the synchronization request for the development branch, and loads the development branch from the local memory according to the synchronization request. In another example, the device that performs the development branch synchronization action may be a local server or a cloud server. When the development branch needs to be synchronized to the main branch of a third-party code hosting platform, a synchronization request for the development branch may be initiated by a development terminal to which the development branch belongs, and a server such as a local server or a cloud server may be used as a device that performs the development branch synchronization, receives the synchronization request for the development branch, and obtains the development branch from the memory according to the synchronization request. The memory may be the memory of the development terminal, the local storage of a server such as a local server or a cloud server, or the memory for storing development branches on a third-party code hosting platform.

[0028] S12. Load the first main branch from the third-party code hosting platform to obtain a first local main branch.

[0029] Explanatory, including but not limited to third-party code hosting platforms such as Gitlab and Gerrit as commonly used code hosting platforms in code development, the code development team will send the developed code to the third-party code hosting platform for hosting. Based on continuous integration software development projects, the code development team will send the developed code to the third-party code hosting platform for hosting. Software development projects based on continuous integration generally include main branches and development branches. The main branch can be understood as the code trunk or code framework of the software development project. The development branch is an independent development unit corresponding to the corresponding functions involved in the software development project. The main branch plays a major role in integrating different development branches together to achieve the development of the software development project. The development process of the main branch and the development branch are iterative development processes. Among them, common multi-level CI branch models include Git-Flow mode, Github-Flow mode and Gitlab-Flow mode.

[0030] In the case of including but not limited to the development branch initiating a synchronization application, start synchronizing the development branch to the main branch, including but not limited to the development terminal, local server, cloud platform and other computer devices on the development side that perform the development branch synchronization, obtain the development branch from but not limited to the development terminal, and load the first main branch from the third-party code hosting platform to the local computer device corresponding to the device that performs the development branch synchronization action, and refer to the first main branch loaded locally as the first local main branch, wherein the first main branch is the main branch of the software development project hosted on the third-party code hosting platform at that time, and the first main branch may be the initial main branch of the development, which is the original main branch of the development, or may be the main branch of the development branch synchronized with the initial main branch after iterative development.

[0031] It should be noted that the terms such as first and second involved in the embodiments of the present invention are used to distinguish objects involved in different steps of the technical solution for facilitating understanding and are not used to limit the objects.

[0032] S13. Based on the first local main branch, perform pre-synchronization verification on the development branch.

[0033] Explanatory, pre-synchronization verification includes but is not limited to automatic merge verification corresponding to pre-merging the development branch into the main branch, and automatic integration verification corresponding to integrating the development branch into the main branch. Specifically, pre-synchronization verification includes pre-merging the development branch into the first local main branch, obtaining the first merged main branch when the development branch is successfully pre-merged into the first local main branch, and compiling and packaging the first merged main branch to verify the integration reliability of the development branch into the first local main branch, thereby verifying the synchronization reliability of the development branch to the third-party code hosting platform, and automatically verifying the synchronization reliability of the development branch to the main branch on development-side devices that perform development branch synchronization, including but not limited to development terminals, local servers, cloud platforms, etc., and in the event of pre-synchronization verification failures such as failure of automatic merge verification of the first merged main branch or failure of integration reliability verification, the current synchronization of the development branch is terminated. The problem that occurs when the development branch is synchronized to the main branch can be discovered as early as possible without affecting the synchronization of other development branches. When the integration reliability verification of the first merged main branch is passed, the subsequent synchronization processing of the development branch is performed. Compared with the traditional technology that performs pre-synchronization verification such as merge verification or integration reliability verification of the development branch on the main branch after the development branch is pushed to the third-party code hosting platform, the embodiment of the present invention moves the verification of the development branch, including but not limited to merge verification or integration reliability, to a development-side device that is different from the third-party code hosting platform, and can realize parallel synchronization of different development branches, thereby solving the problems of low efficiency and easy blocking of serial queuing synchronization of development branches and reducing the time cost of development branch code integration.

[0034] Furthermore, the development branches are verified before synchronization, specifically: different development branches are verified before synchronization in parallel.

[0035] Explanatory, for different development branches, parallel processing is performed, that is, for each development branch, the corresponding device that executes the development branch synchronization action obtains the development branch, and loads the first main branch from the third-party code hosting platform to obtain the first local main branch, and then based on the first local main branch, the development branch is verified before synchronization, so that on the development device side, different development branches can be independently verified before synchronization at the same time, and different development branches can be verified before synchronization in parallel, which can realize parallel synchronization of different development branches and further realize non-blocking synchronization between different development branches, solves the problems of low efficiency and easy blocking of serial queuing synchronization of development branches, and reduces the synchronization time cost of development branches.

[0036] S14. If the verification before synchronization of the development branch is passed, the target main branch that has been merged with the development branch is synchronized to the third-party code hosting platform.

[0037] Explanatoryly, if the verification before synchronization of the development branch passes, the target main branch of the merged development branch will be synchronized to the third-party code hosting platform. The target main branch of the merged development branch can be the first merged main branch mentioned above, or it can be a merged main branch obtained by reloading the main branch at that time from the third-party code hosting platform and merging the development branch in an asynchronous manner, thereby preliminarily synchronizing the development branch to the third-party code hosting platform.

[0038] S15. Perform a preset verification test on the target main branch, and if the target main branch passes the preset verification test, determine the target main branch as the main branch to be hosted by the third-party code hosting platform.

[0039] Explanatory, the target main branch is subjected to preset verification tests including but not limited to smoke tests. The preset verification test can be a version verification test to verify the reliability of the version corresponding to the target main branch, and when the target main branch passes the preset verification test, the target main branch is determined as the main branch to be hosted by the third-party code hosting platform, that is, the corresponding storage of the target main branch on the third-party code hosting platform is used as the hosted main branch. Since the preset verification test generally takes a relatively long time, the target main branch is first pushed to the third-party code hosting platform, and then the target main branch is subjected to the preset verification test, so that the synchronization of development branches is performed asynchronously, which can not affect the synchronization of different development branches to the latest main branch hosted by the third-party code hosting platform, thereby effectively ensuring the high availability of the main branch and improving the effectiveness of synchronization of different development branches to the main branch.

[0040] In an embodiment of the present invention, a synchronization request of a development branch is received, and according to the synchronization request, the development branch is obtained, and a first main branch is loaded from a third-party code hosting platform to obtain a first local main branch, and then based on the first local main branch, a pre-synchronization verification is performed on the development branch, and if the pre-synchronization verification of the development branch passes, the target main branch that has merged the development branch is synchronized to the third-party code hosting platform, and then a preset verification test is performed on the target main branch, and if the target main branch passes the preset verification test, the target main branch is determined as the main branch to be hosted by the third-party code hosting platform, thereby removing the processing of synchronizing the development branch to the main branch from the third-party code hosting platform. The platform is moved forward to the development side device. Based on the development side device, an asynchronous method is used to perform automatic merging verification, automatic integration verification and automatic testing of the development branches involved in the synchronization process of the development branches, until the development branch is synchronized to the main branch on the third-party code hosting platform and hosted. The synchronization of the development branch to the main branch of the third-party code hosting platform is completed, and the execution subject and process of synchronization are changed by changing the development branch. Under the premise of effectively ensuring the high availability of the main branch of the third-party code hosting platform, parallel synchronization of different development branches can be achieved, which solves the problems of low efficiency and easy blocking of serial queuing synchronization of development branches, and reduces the time cost of development branch code integration.

[0041] In one embodiment, see Figure 3 , Figure 3 The first sub-flow diagram of the development branch synchronization method based on continuous integration provided by the embodiment of the present invention. Figure 3 As shown, in this embodiment, if the verification before synchronization of the development branch passes, synchronizing the target main branch that has merged the development branch to the third-party code hosting platform includes:

[0042] S31. If the verification before synchronization of the development branch passes, load the second main branch from the third-party code hosting platform to obtain a second local main branch;

[0043] S32: Merge the development branch into the second local main branch to obtain a target main branch, and synchronize the target main branch to the third-party code hosting platform.

[0044] Explanatoryly, when the verification before synchronization of the development branch passes, the second main branch is loaded from the third-party code hosting platform to obtain the second local main branch, wherein the second main branch is the main branch hosted on the third-party code hosting platform at the time of loading, which is the latest main branch hosted by the third-party code hosting platform. The second main branch may be the same as the first main branch or may be different, which is mainly determined according to the development iteration progress corresponding to the software development project hosted by the third-party code hosting platform.

[0045] The development branch is merged into the second local main branch to obtain the target main branch, and the target main branch is synchronized to the third-party code hosting platform to initially host the iterated main branch on the third-party code hosting platform as a software development project.

[0046] In the embodiment of the present invention, when the verification before the development branch synchronization is passed, the second main branch is loaded from the third-party code hosting platform to obtain the second local main branch, and the development branch is merged into the second local main branch to obtain the target main branch, and then the target main branch is synchronized to the third-party code hosting platform. Therefore, in the process of synchronizing the development branch to the main branch, through the interaction between the development-side device and the third-party code hosting platform, the corresponding merge results are synchronized to the third-party code hosting platform in a timely manner at different stages of the synchronization, until the development branch is finally synchronized to the main branch and hosted on the third-party code hosting platform, the synchronization of the development branch to the main branch is completed, and the development branch merged into the main branch is realized. The target main branch of the branch is synchronized to the third-party code hosting platform, which can realize asynchronous processing of pre-synchronization verification and automatic synchronization. It can not only ensure that the second main branch loaded from the third-party code hosting platform is the newest main branch as possible, thereby achieving as few conflicts as possible between the development branch and the main branch, but also there is no need to retain the above-mentioned first merged main branch locally. On the one hand, it can save local storage resources and processor resources, and on the other hand, it can avoid the low efficiency and easy blocking of serial queuing caused by the sequential synchronization of the development branch. It is only necessary to load the second main branch from the third-party code hosting platform when performing automatic synchronization, so as to make full use of the corresponding performance and resources of the development side device.

[0047] In one embodiment, see Figure 4 , Figure 4 The second sub-flow diagram of the development branch synchronization method based on continuous integration provided by the embodiment of the present invention. Figure 4 As shown, in this embodiment, a preset verification test is performed on the target main branch, including:

[0048] S41, determining whether the target main branch is successfully synchronized to the third-party code hosting platform;

[0049] S42: When the target main branch is successfully synchronized to the third-party code hosting platform, generate a main branch code snapshot according to the target main branch;

[0050] S43. When performing a preset verification test on the target main branch, according to the main branch code snapshot, load the code corresponding to the target main branch from the third-party code hosting platform, and perform a preset verification test on the code;

[0051] S44: If the target main branch is not successfully synchronized to the third-party code hosting platform, roll back the development branch from the target main branch and end the synchronization of the development branch.

[0052] Explanatory, when the target main branch is successfully synchronized to the third-party code hosting platform, a main branch code snapshot corresponding to the target main branch is generated according to the target main branch. The main branch code snapshot represents the code snapshot (Code Snapshot) of the main branch corresponding to the target main branch. The code snapshot represents the internal state of the program when it is running, including the stack (the method in progress and its local variables) and heap (the currently existing objects) when the program is running, and other relevant information of the target main branch. Furthermore, when the target main branch is not successfully synchronized to the third-party code hosting platform, the code corresponding to the development branch can be rolled back from the target main branch, and the process of synchronizing the development branch to the main branch can be ended, so that the development branch that has been verified before synchronization can be automatically synchronized directly to the third-party code hosting platform, and the target main branch can be automatically rolled back when a code conflict occurs during the synchronization of the development branch, that is, the main branch on the third-party code hosting platform is rolled back to the nearest available node to ensure the continuous high availability of the main branch on the third-party code hosting platform.

[0053] When performing preset verification tests on the target main branch, the code corresponding to the target main branch is loaded from the third-party code hosting platform according to the main branch code snapshot, and the code is compiled and packaged to execute version integration scripts, thereby realizing asynchronous building of versions based on the main branch code snapshot. When the code is successfully integrated, the code is subjected to preset verification tests including but not limited to smoke tests.

[0054] In the process of synchronizing the development branch to the main branch of the third-party code hosting platform, since the development side device involves different processing stages of synchronization, for example, the development branch is subjected to the automatic verification stage of pre-synchronization verification, the target main branch is pushed to the corresponding automatic synchronization stage of the third-party code hosting platform, and the target main branch is subjected to the automatic testing stage corresponding to the preset verification test. In the case where different division of labor modules use the corresponding processor and memory resources to perform corresponding processing, since different division of labor modules process the corresponding synchronization processing stages in different time-consuming and efficient ways, for example, different development branches are merged into the corresponding second local main branch to obtain the target main branch, and the automatic synchronization of the target main branch to the corresponding development branch of the third-party code hosting platform is generally processed faster. If the automatic synchronization of M development branches can be processed within one time unit, asynchronous version building and smoke testing processing can be performed. is slower, and can only process the preset verification tests of N development branches in the same time unit, where M>N, M and N are integers. If the version asynchronous build based on the main branch code snapshot is not adopted, the preset verification tests of the remaining (MN) development branches will cause the synchronization queue on the development device side to be blocked, occupying more processor resources and memory resources of the development side device. The version asynchronous build based on the main branch code snapshot, especially when the development device side processes multiple development branches synchronously at the same time, although it increases the interaction between the development side device and the third-party code hosting platform, it does not retain the target main branch in the pending state locally on the development side device, thereby reducing the occupancy rate of the processor and memory resources of the development side device. At the same time, the development device side does not block the synchronization queues of multiple development branches, which can solve the problems of low serial processing efficiency and easy blocking of different development branches on the development side device.

[0055] The embodiment of the present invention generates a main branch code snapshot corresponding to the target main branch when the target main branch is successfully synchronized to the third-party code hosting platform, and when performing a preset verification test on the target main branch, loads the code corresponding to the target main branch from the third-party code hosting platform according to the main branch code snapshot, and then performs a preset verification test on the code, thereby realizing asynchronous construction of versions based on the main branch code snapshot, thereby dividing the development branch synchronization based on continuous integration performed on the development side device into different processing stages, and asynchronously processing different processing stages by different division of labor modules, which can reduce the occupancy rate of the processor and memory resources of the development side device, and at the same time does not block the synchronization queues of multiple development branches, can solve the problems of low serial processing efficiency and easy blocking of different development branches of the development side device, further reduce the synchronization time cost of the development branch, and improve the efficiency of the development branch synchronization of the development side device.

[0056] In one embodiment, see Figure 5 , Figure 5The third sub-flow diagram of the development branch synchronization method based on continuous integration provided by the embodiment of the present invention. Figure 5 As shown, in this embodiment, based on the first local main branch, the development branch is verified before synchronization, including:

[0057] S51, pre-merging the development branch with the first local main branch;

[0058] S52: In the case where the pre-merge of the development branch and the first local main branch is successful, integrating the pre-merged code;

[0059] S53, when the pre-merged code is successfully integrated, determining that the pre-synchronization verification of the development branch has passed;

[0060] S54: When the pre-merge of the development branch with the first local main branch fails, or when the pre-merged code fails to be integrated, determine that the pre-synchronization verification of the development branch fails.

[0061] Explanatory, the development branch is pre-merged with the first local main branch. The pre-merge refers to an informal merge of a testing nature. The pre-merge is used to verify whether the development branch and the first local main branch can be successfully merged, and mainly to verify whether there is a code conflict problem between the development branch and the first local main branch during the merging process. In the case where the pre-merge of the development branch and the first local main branch is successful, it mainly refers to the problem that there is no code conflict between the development branch and the first local main branch during the merging process. The pre-merged code is integrated including but not limited to compilation and packaging. In the case where the pre-merged code is successfully integrated, it is determined that the pre-synchronization verification of the development branch has passed, that is, the verification of the synchronization of the development branch to the corresponding main branch has passed. Further, in the case where the pre-merge of the development branch and the first local main branch is unsuccessful, it mainly refers to the problem that there is a code conflict between the development branch and the first local main branch during the merging process, or, in the case where the pre-merged code is not successfully integrated by compiling or packaging, that is, in the case where there is a code conflict or version production failure in the pre-merged code, it is determined that the pre-synchronization verification of the development branch has not passed. Furthermore, when the development branch initiates a synchronization application and it is determined that the pre-synchronization verification of the development branch has not passed, the synchronization application of the development branch is rejected so that the corresponding R&D personnel can modify the development branch.

[0062] In an embodiment of the present invention, a development branch is pre-merged with a first local main branch. When the pre-merge of the development branch and the first local main branch is successful, the pre-merged code is integrated including but not limited to compilation and packaging. When the pre-merged code is successfully integrated, it is determined that the pre-synchronization verification of the development branch has passed. When the pre-merge of the development branch and the first local main branch is unsuccessful, or when the pre-merged code is not successfully integrated, it is determined that the pre-synchronization verification of the development branch has not passed. By pre-merging the development branch with the first local main branch and automatically verifying the integration of the synchronization of the development branch, it is possible to identify in advance the code conflicts or version production failures that may exist when the development branch is synchronized to the main branch, thereby avoiding the problem of the main branch being unavailable after the problematic development branch is merged into the main branch. At the same time, by using the development side device to automatically perform synchronization verification locally, it is possible to achieve parallel verification of synchronization of different development branches, and different development branches will not block each other. On the premise of effectively ensuring the high availability of the main branch, it is possible to further solve the problems of low efficiency and easy blocking of serial queuing verification of development branches, and further reduce the synchronization time cost of development branches.

[0063] In one embodiment, see Figure 6 , Figure 6 The fourth sub-flow diagram of the development branch synchronization method based on continuous integration provided by the embodiment of the present invention. Figure 6 As shown, in this embodiment, the method further includes:

[0064] S61. If the target main branch fails the preset verification test, a third main branch corresponding to the target main branch is loaded from the third-party code hosting platform to obtain a third local main branch.

[0065] S62: Roll back the development branch from the third local main branch, and synchronize the rolled back main branch to the third-party code hosting platform.

[0066] Explanatoryly, when the target main branch fails the preset verification test performed on the development side device, for example, when the target main branch fails the smoke test performed on the server side of the development side, a third main branch is loaded from the third-party code hosting platform, and the third main branch has the same content as the target main branch, to obtain a third local main branch, and based on rollback operations including but not limited to Git commands, according to the node when the development branch is merged into the main branch, the third local main branch is rolled back to the node before the development branch is merged, that is, the development branch contained in the third local main branch is removed or removed, and the rolled back main branch is pushed to the third-party code hosting platform.

[0067] According to an embodiment of the present invention, when the target main branch fails to pass a preset verification test, a third main branch corresponding to the target main branch is loaded from a third-party code hosting platform to obtain a third local main branch, and a development branch is rolled back from the third local main branch, and the rolled back main branch is synchronized to the third-party code hosting platform. When there is a problem with the synchronization of the development branch, the development branch can be automatically rolled back on the development device side. In particular, when there are problems with different development branches, parallel rollback of different development branches can be achieved without affecting the availability of the main branch on the third-party code hosting platform and the synchronization of other development branches. Therefore, under the premise of effectively ensuring the high availability of the main branch, the problems of low serial processing efficiency and easy blocking of different development branches are solved, and the synchronization time cost of the development branches is reduced.

[0068] In one embodiment, see Figure 7 , Figure 7 The fifth sub-flow diagram of the development branch synchronization method based on continuous integration provided by the embodiment of the present invention. Figure 7 As shown, in this embodiment, the method further includes:

[0069] S71. If the target main branch passes the preset verification test, according to the preset time node, load the current main branch at the time corresponding to the preset time node from the third-party code hosting platform;

[0070] S72. When the current main branch is successfully synchronized to the current development branch, a current target development branch is obtained;

[0071] S73: Push the current target development branch to the third-party code hosting platform as a hosted development branch.

[0072] Explanatoryly, when the target main branch passes the preset verification test, the current main branch corresponding to the preset time node is loaded from the third-party code hosting platform according to the preset time node. Since the main branch hosted by the third-party code hosting platform is continuously iterated and updated in the case of continuous integration, the current main branch is not necessarily consistent with the target main branch, but the current main branch contains the target main branch.

[0073] Since the development branch is also continuously updated, the current development branch, that is, the current development branch, is obtained, and the current main branch is synchronized to the current development branch. When the current main branch is successfully synchronized to the current development branch, the current target development branch is obtained. The current target development branch includes but is not limited to the current development branch. The current target development branch can include the current main branch, and the current target development branch is pushed to the third-party code hosting platform as a hosted development branch. When the current development branch is not successfully synchronized to the current main branch (code conflict), the R&D personnel modify the current development branch until the current main branch is successfully synchronized to the current development branch, thereby realizing the reverse synchronization of the main branch code node that has passed the preset verification test to the development branch of the third-party code hosting platform. On this basis, it is convenient for the development terminal corresponding to the development branch to perform subsequent iterative development of the development branch. Among them, in general, synchronization refers to the development branch being pushed from the development side device to the main branch of the third-party code hosting platform. Compared with synchronization in the general sense, pushing the main branch code node that has passed the preset verification test to the development branch of the third-party code hosting platform can be called reverse synchronization.

[0074] In an embodiment of the present invention, when the target main branch passes a preset verification test, the current main branch including the target main branch is obtained from the third-party code hosting platform according to a preset time node, and when the current target development branch is obtained, the current target development branch is pushed to the third-party code hosting platform as a hosted development branch, that is, the current main branch including the target main branch is loaded from the third-party code hosting platform to the development side device at a regular time, and when the current main development branch is successfully synchronized to the current development branch to obtain the current target development branch, the current target development branch is pushed to the third-party code hosting platform as a hosted development branch, and subsequent iterative updates of the development branch are performed based on the development branch hosted by the third-party code hosting platform. This can not only ensure that the conflicts between the subsequent synchronization of the development branch and the main branch are as few as possible, thereby further improving the effectiveness of synchronizing the development branch to the main branch, but also ensure that the current development branch is the latest development branch after continuous development based on the above-mentioned development branch. Compared with directly using the target main branch as the corresponding development branch for hosting, the integrity of the development branch can be ensured without losing the content of the subsequent iterative development of the development branch.

[0075] See also Figure 8 , Figure 8 A schematic block diagram of the structure of a computer device provided by an embodiment of the present invention. Figure 8 As shown, the computer device 300 includes a processor 301 and a memory 302 , and the processor 301 and the memory 302 are connected via a bus 303 , such as an I2C (Inter-integrated Circuit) bus.

[0076] Specifically, the processor 301 is used to provide computing and control capabilities to support the operation of the entire computer device. The processor 301 can be a central processing unit (CPU), and the processor 301 can also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.

[0077] Specifically, the memory 302 may be a Flash chip, a read-only memory (ROM) disk, an optical disk, a USB flash drive, or a mobile hard disk.

[0078] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the embodiment of the present invention, and does not constitute a limitation on the computer device to which the embodiment of the present invention is applied. The specific server may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0079] The processor is used to run a computer program stored in the memory, and implement any one of the continuous integration-based development branch synchronization methods provided by the embodiments of the present invention when executing the computer program.

[0080] It should be noted that technicians in the relevant field can clearly understand that for the convenience and simplicity of description, the specific working process of the computer device described above can refer to the corresponding process in the aforementioned development branch synchronization method based on continuous integration, and will not be repeated here.

[0081] An embodiment of the present invention also provides a storage medium for computer-readable storage, wherein the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement any step of the development branch synchronization method based on continuous integration provided in the description of the embodiment of the present invention.

[0082] The storage medium may be an internal storage unit of the computer device described in the above embodiment, such as the memory of the computer device. The storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device.

[0083] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In a hardware embodiment, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0084] It should be understood that the term "and / or" used in the present specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations. It should be noted that, in this article, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "including a..." does not exclude the presence of other identical elements in the process, method, article or system including the element.

[0085] The serial numbers of the embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments. The above description is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A development branch synchronization method based on continuous integration, characterized in that: include: Receiving a synchronization request for a development branch, and acquiring the development branch according to the synchronization request; Load the first main branch from the third-party code hosting platform to obtain the first local main branch; Based on the first local main branch, perform pre-synchronization verification on the development branch; If the verification before synchronization of the development branch passes, synchronizing the target main branch that has merged the development branch to the third-party code hosting platform; A preset verification test is performed on the target main branch, and if the target main branch passes the preset verification test, the target main branch is determined as the main branch to be hosted by the third-party code hosting platform.

2. The development branch synchronization method based on continuous integration according to claim 1, characterized in that: If the verification before synchronization of the development branch passes, synchronizing the target main branch that has merged the development branch to the third-party code hosting platform includes: If the verification before synchronization of the development branch passes, loading the second main branch from the third-party code hosting platform to obtain a second local main branch; The development branch is merged into the second local main branch to obtain a target main branch, and the target main branch is synchronized to the third-party code hosting platform.

3. The development branch synchronization method based on continuous integration according to claim 2 is characterized in that: The method further comprises: In the case that the target main branch is not successfully synchronized to the third-party code hosting platform, the development branch is rolled back from the target main branch, and the synchronization of the development branch is ended.

4. The development branch synchronization method based on continuous integration according to any one of claims 1 to 3, characterized in that: Performing a preset verification test on the target main branch includes: When the target main branch is successfully synchronized to the third-party code hosting platform, a main branch code snapshot is generated according to the target main branch; When performing a preset verification test on the target main branch, the code corresponding to the target main branch is loaded from the third-party code hosting platform according to the main branch code snapshot, and a preset verification test is performed on the code.

5. The development branch synchronization method based on continuous integration according to claim 1, characterized in that: Based on the first local main branch, the development branch is verified before synchronization, including: Pre-merge the development branch with the first local main branch; When the pre-merge of the development branch and the first local main branch is successful, performing integration reliability verification on the pre-merged code; When the pre-merged code is successfully integrated, it is determined that the pre-synchronization verification of the development branch has passed.

6. The development branch synchronization method based on continuous integration according to claim 5, characterized in that: The method further comprises: When the pre-merge of the development branch with the first local main branch fails, or when the pre-merged code fails to be integrated, it is determined that the pre-synchronization verification of the development branch fails.

7. The development branch synchronization method based on continuous integration according to claim 1, characterized in that: The method further comprises: If the target main branch fails the preset verification test, loading a third main branch corresponding to the target main branch from the third-party code hosting platform to obtain a third local main branch; Roll back the development branch from the third local main branch, and synchronize the rolled back main branch to the third-party code hosting platform.

8. The development branch synchronization method based on continuous integration according to claim 1, characterized in that: Verify the development branch before synchronization, including: Verify different development branches in parallel before synchronization.

9. The method for synchronizing development branches based on continuous integration according to claim 1, characterized in that: The method further comprises: If the target main branch passes the preset verification test, according to the preset time node, loading the current main branch at the time corresponding to the preset time node from the third-party code hosting platform; When the current main branch is successfully synchronized to the current development branch, the current target development branch is obtained; The current target development branch is pushed to the third-party code hosting platform and used as a hosted development branch.

10. A computer device, characterized in that: The computer device includes a processor, a memory, a computer program stored in the memory and executable by the processor, and a data bus for realizing connection and communication between the processor and the memory, wherein when the computer program is executed by the processor, the steps of the development branch synchronization method based on continuous integration are realized as described in any one of claims 1 to 9.

11. A storage medium for computer-readable storage, characterized in that: The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the method for synchronizing development branches based on continuous integration according to any one of claims 1 to 9.