Continuous integration-based development branch synchronization method and related device

By using asynchronous method to verify and merge verification before development branch synchronization on the development side equipment, the problem of low synchronization efficiency and easy blockage in traditional technology is solved, parallel synchronization is achieved, code integration time cost and master branch is ensured high availability.

WO2024255193A1PCT designated stage expired Publication Date: 2024-12-19ZTE CORP
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2023/141292
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-06-15
Filing Date
2023-12-22
Publication Date
2024-12-19

AI Technical Summary

Technical Problem

The traditional continuous integration development branch synchronization pattern is inefficient and prone to blocking, resulting in code value stream blocking, especially in the case of multiple development branches.

Method used

By using asynchronous methods to perform pre-synchronization verification, automatic merge verification, automatic integration verification and automatic testing of development branches on development side devices (such as development terminals, local servers, and cloud servers), until the development branch is merged into the main branch and synchronized to the first A three-party code hosting platform, thereby achieving parallel synchronization and reducing the time cost of code integration.

Benefits of technology

Improve the synchronization efficiency of development branches, reduce the time cost of code integration, avoid synchronization queue blocking, and ensure high availability of the main branch and parallel synchronization of different development branches.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023141292_19122024_PF_FP_ABST
    Figure CN2023141292_19122024_PF_FP_ABST
Patent Text Reader

Abstract

The present disclosure provides a continuous integration-based development branch synchronization method, a computer device, and a computer readable storage medium, relating to the technical field of computers. A synchronization request of a development branch is received, and a development branch is acquired according to the synchronization request; a first main branch is loaded from a third-party code hosting platform, to obtain a first local main branch; on the basis of the first local main branch, pre-synchronization verification is performed on the development branch; if the development branch passes pre-synchronization verification, a target main branch of a merged development branch is synchronized 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 to be a main branch hosted by the third-party code hosting platform.
Need to check novelty before this filing date? Find Prior Art

Description

Development branch synchronization method and related equipment based on continuous integration

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This disclosure is based on and claims the priority of Chinese patent application No. 202310717194.6 filed on June 15, 2023, and all the disclosed contents are incorporated into this disclosure by reference. Technical Field

[0003] The present disclosure 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

[0004] Continuous Integration (CI) is a software development practice that simply means frequently integrating new code into the mainline version. Large-scale software projects typically deploy multi-level CI for layered quality assurance, accelerating the overall integration of software systems. R&D teams perform iterative development in multiple development branches, then synchronize these branches with the main branch.

[0005] Traditionally, different development branches are synchronized with the main branch through serial queuing. A version is then compiled and packaged to verify integration reliability, ensuring that conflicts and code production failures arising from the development code synchronization process are promptly discovered and addressed. This synchronization mode, where development branches are synchronized to the main branch, requires time for code synchronization and version production verification, with queue waiting time increasing with the number of branches. Furthermore, if a code production failure is introduced after a synchronization of a development branch, the main branch availability cannot be restored until the fault is located, fixed, and verified. During this time, the synchronization queue is blocked, the main branch version output is also blocked, and the code value flow is blocked. Therefore, this synchronization mode is inefficient and prone to blocking.

[0006] Summary of the Invention

[0007] The present disclosure 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.

[0008] In a first aspect, the present disclosure provides a development branch synchronization method based on continuous integration, including: 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; performing pre-synchronization verification on the development branch based on the first local main branch; if the pre-synchronization verification of the development branch passes, synchronizing the target main branch that has merged 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 to be hosted by the third-party code hosting platform.

[0009] In a second aspect, the present disclosure also provides a computer device, which 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, it implements the steps of any one of the continuous integration-based development branch synchronization methods provided in the present disclosure.

[0010] In a third aspect, the present disclosure also 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 present disclosure specification. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0012] FIG1 is a flow chart of a method for synchronizing development branches based on continuous integration according to an embodiment of the present disclosure;

[0013] FIG2 is a schematic diagram of a specific process of synchronizing different development branches in parallel using a development branch synchronization method based on continuous integration according to an embodiment of the present disclosure;

[0014] FIG3 is a schematic diagram of a first sub-flow of a development branch synchronization method based on continuous integration provided by an embodiment of the present disclosure;

[0015] FIG4 is a schematic diagram of a second sub-flow of the development branch synchronization method based on continuous integration provided by an embodiment of the present disclosure;

[0016] FIG5 is a schematic diagram of a third sub-flow of the development branch synchronization method based on continuous integration provided by an embodiment of the present disclosure;

[0017] FIG6 is a schematic diagram of a fourth sub-flow of the development branch synchronization method based on continuous integration provided by an embodiment of the present disclosure;

[0018] FIG7 is a schematic diagram of the fifth sub-flow of the development branch synchronization method based on continuous integration provided by an embodiment of the present disclosure;

[0019] FIG8 is a schematic block diagram of the structure of a computer device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0020] The following will clearly and completely describe the technical solutions in the embodiments of the present disclosure in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present disclosure without making any creative efforts shall fall within the scope of protection of the present disclosure.

[0021] The flowcharts shown in the accompanying drawings are for illustrative purposes only and do not necessarily include all 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 vary depending on the actual situation.

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

[0023] The disclosed embodiments provide 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, and cloud platforms, to enable iterative software development in application scenarios such as branch management and version management.

[0024] In the face of the problem of low efficiency of development branch synchronization based on continuous integration in traditional technology, the inventor proposes a development branch synchronization method based on continuous integration of the embodiment of the present disclosure. The core idea of ​​the embodiment of the present disclosure is: to move the process of synchronizing the development branch to the main branch 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. 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.

[0025] The following embodiments of the present disclosure are described in detail with reference to the accompanying drawings. In the absence of conflict, the following embodiments and features therein may be combined with each other.

[0026] Please refer to Figures 1 and 2. Figure 1 is a flow chart of a method for synchronizing development branches based on continuous integration according to an embodiment of the present disclosure. Figure 2 is a flow chart of a specific method for synchronizing different development branches based on continuous integration according to an embodiment of the present disclosure. As shown in Figure 1, in this embodiment, the method includes but is not limited to the following steps S11-S15:

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

[0028] Explanatoryally, 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.

[0029] 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, based on the synchronization request, loads the development branch from the local memory. 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 serve as the device that performs the development branch synchronization, receive the synchronization request for the development branch, and, based on the synchronization request, obtain the development branch from the memory. 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.

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

[0031] 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 role of the main branch is to integrate different development branches together to realize 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.

[0032] In the case of including but not limited to a development branch initiating a synchronization application, the development branch is synchronized to the main branch, including but not limited to a development terminal, a local server, a cloud platform and other computer devices on the development side that perform the development branch synchronization, obtaining the development branch from but not limited to the development terminal, and loading 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 the first main branch loaded locally is called 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 can be the initial main branch of the development, the initial main branch is the original main branch of the development, and it can also be the main branch of the development branch synchronized with the initial main branch after iterative development.

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

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

[0035] 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 including but not limited to development terminals, local servers, cloud platforms, etc. that perform development branch synchronization, and terminating the current synchronization of the development branch in case of pre-synchronization verification failures such as failure of automatic merge verification of the first merged main branch or failure of integration reliability verification. It is possible to discover problems that arise in the synchronization of development branches to the main branch as early as possible without affecting the synchronization of other development branches. After the integration reliability verification of the first merged main branch is passed, subsequent synchronization processing of the development branch is performed. Compared with the traditional technology in which the development branch is pushed to the third-party code hosting platform and then the merge verification or integration reliability verification of the development branch is performed on the main branch before synchronization, the embodiment of the present disclosure moves the verification of the development branch, including but not limited to the 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.

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

[0037] 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 different development branches can be independently verified before synchronization on the development device side 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, solve the problems of low efficiency and easy blocking of serial queuing synchronization of development branches, and reduce the synchronization time cost of development branches.

[0038] S14. If the verification before synchronization of the development branch passes, synchronize the target main branch that has been merged with the development branch to the third-party code hosting platform.

[0039] Explanatoryally, if the verification before the development branch synchronization is passed, 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 current main branch 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.

[0040] 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.

[0041] 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. 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 as to synchronize the development branches in an asynchronous manner, 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.

[0042] In an embodiment of the present disclosure, a synchronization request of a development branch is received, and according to the synchronization request, a 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. Then, based on the first local main branch, the development branch is pre-synchronized and verified, and if the pre-synchronization verification of the development branch passes, the target main branch that has been merged with 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.

[0043] In one embodiment, please refer to Figure 3, which is a schematic diagram of the first sub-process of the development branch synchronization method based on continuous integration provided by the embodiment of the present disclosure. As shown in Figure 3, in this embodiment, if the verification before the development branch synchronization passes, synchronizing the target main branch that has merged the development branch to the third-party code hosting platform includes:

[0044] 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;

[0045] 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.

[0046] Explanatoryally, if the verification is passed before the development branch is synchronized, the second main branch is loaded from the third-party code hosting platform to obtain the second local main branch, where 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 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.

[0047] Merge the development branch into the second local main branch to obtain the target main branch, and synchronize the target main branch to the third-party code hosting platform to initially host the iterated main branch of the software development project on the third-party code hosting platform.

[0048] In the embodiment of the present disclosure, 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. 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, completing the synchronization of the development branch to the main branch, and realizing the merging of the development branch and the main branch. 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 minimizing the conflict between the development branch and the main branch, but also eliminate the 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 problems of serial queuing caused by the sequential synchronization of development branches. It is only necessary to load the second main branch from the third-party code hosting platform during automatic synchronization, thereby making full use of the corresponding performance and resources of the development-side equipment.

[0049] In one embodiment, please refer to Figure 4, which is a schematic diagram of the second sub-process of the development branch synchronization method based on continuous integration provided by the embodiment of the present disclosure. As shown in Figure 4, in this embodiment, the target main branch is subjected to a preset verification test, including:

[0050] S41. Determine whether the target main branch is successfully synchronized to the third-party code hosting platform;

[0051] 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;

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

[0053] 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.

[0054] 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 based on 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) during the program runtime 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 synchronization of 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.

[0055] 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 based on the main branch code snapshot, and the code is compiled, packaged, and other version integration scripts are executed to achieve asynchronous version building 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 testing.

[0056] 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 verified before synchronization in the automatic verification stage, 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 target main branch is synchronized to the development branch corresponding to the third-party code hosting platform. The automatic synchronization is generally faster. If the automatic synchronization of M development branches can be processed within a time unit, asynchronous version building and smoke testing processing can be performed. It 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 is adopted, 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 a 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.

[0057] The embodiment of the present disclosure 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 the version 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 reduces the synchronization time cost of the development branch, and improves the efficiency of the development branch synchronization of the development side device.

[0058] In one embodiment, please refer to Figure 5, which is a schematic diagram of the third sub-process of the development branch synchronization method based on continuous integration provided by the embodiment of the present disclosure. As shown in Figure 5, in this embodiment, based on the first local main branch, the development branch is verified before synchronization, including:

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

[0060] S52: If the pre-merge of the development branch and the first local main branch is successful, integrate the pre-merged code;

[0061] S53. If the pre-merged code is successfully integrated, determine that the pre-synchronization verification of the development branch has passed;

[0062] S54: If the pre-merge of the development branch with the first local main branch is unsuccessful, or if the code after the pre-merge is not successfully integrated, determine that the pre-synchronization verification of the development branch has failed.

[0063] Explanatory note: 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 are code conflicts 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 fact that there are no code conflicts 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. Furthermore, in the case where the pre-merge of the development branch and the first local main branch is unsuccessful, it mainly refers to the fact that there are code conflicts 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 through compilation or packaging, that is, when there are code conflicts or version production failures in the pre-merged code, it is determined that the pre-synchronization verification of the development branch has failed. 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.

[0064] In an embodiment of the present disclosure, 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 failed. By pre-merging the development branch with the first local main branch and automatically verifying the synchronization of the development branch, it is possible to identify in advance possible 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 the synchronization of different development branches, and different development branches will not block each other. Under 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.

[0065] In one embodiment, please refer to Figure 6, which is a schematic diagram of the fourth sub-flow of the development branch synchronization method based on continuous integration provided by the embodiment of the present disclosure. As shown in Figure 6, in this embodiment, the method further includes:

[0066] S61: If the target main branch fails the preset verification test, load a third main branch corresponding to the target main branch from the third-party code hosting platform to obtain a third local main branch;

[0067] 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.

[0068] 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. 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.

[0069] In an embodiment of the present disclosure, when the target main branch fails 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 the 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. In the case that there is a problem with the synchronization of the development branches, the rollback processing of the development branches can be automatically performed on the development device side. In particular, when there are problems with different development branches, parallel rollback processing 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.

[0070] In one embodiment, please refer to Figure 7, which is a schematic diagram of the fifth sub-flow of the development branch synchronization method based on continuous integration provided by the embodiment of the present disclosure. As shown in Figure 7, in this embodiment, the method further includes:

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

[0072] S72. When the current main branch is successfully synchronized to the current development branch, obtain the current target development branch;

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

[0074] 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 iteratively 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.

[0075] Since the development branch is also continuously updated, the current development branch, i.e., the current development branch, is obtained and the current master branch is synchronized with the current development branch. If the current master branch is successfully synchronized with 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 master branch. The current target development branch is pushed to a third-party code hosting platform as a hosted development branch. If the current development branch is not successfully synchronized with the current master branch (code conflict), the R&D personnel modify the current development branch until the current master branch is successfully synchronized with the current development branch, thereby achieving reverse synchronization of the master 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 master branch of the third-party code hosting platform. Compared with synchronization in the general sense, pushing the master 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.

[0076] In an embodiment of the present disclosure, when a target main branch passes a preset verification test, the current main branch including the target main branch is obtained from a third-party code hosting platform at a preset time node. 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 periodically loaded from the third-party code hosting platform to a development-side device. When the current main development branch is successfully synchronized with 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. Subsequent iterative updates of the development branch are performed based on the development branch hosted by the third-party code hosting platform. This not only ensures that subsequent synchronization conflicts between the development branch and the main branch are minimized, thereby further improving the effectiveness of synchronizing the development branch to the main branch, but also ensures that the current development branch is the latest development branch after continuous development based on the aforementioned development branch. Compared with directly using the target main branch as the corresponding hosted development branch, the integrity of the development branch is ensured without losing content developed in subsequent iterations of the development branch.

[0077] Please refer to Figure 8, which is a schematic block diagram of the structure of a computer device provided in an embodiment of the present disclosure. As shown in Figure 8, the computer device 300 includes a processor 301 and a memory 302, which are connected via a bus 303, such as an I2C (Inter-Integrated Circuit) bus.

[0078] 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 gate 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.

[0079] 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.

[0080] Those skilled in the art will understand that the structure shown in FIG8 is merely a block diagram of a portion of the structure related to the embodiment of the present disclosure, and does not constitute a limitation on the computer device to which the embodiment of the present disclosure is applied. A specific server may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

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

[0082] It should be noted that, those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the computer device described above can refer to the corresponding process in the aforementioned embodiment of the development branch synchronization method based on continuous integration, and will not be repeated here.

[0083] An embodiment of the present disclosure 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 disclosure.

[0084] The storage medium may be an internal storage unit of the computer device described in the aforementioned 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 media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device.

[0085] 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 is well 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 tape, 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 skilled in the art that communication media generally embodies 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.

[0086] It should be understood that the term "and / or" used in this disclosure 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 variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system that includes a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements that are 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 that includes the element.

[0087] The serial numbers of the embodiments of the present disclosure are for description only and do not represent the advantages or disadvantages of the embodiments. The above description is only a specific embodiment of the present disclosure, but the scope of protection of the present disclosure 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 in the present disclosure, and these modifications or replacements should be included in the scope of protection of the present disclosure. Therefore, the scope of protection of the present disclosure should be based on the scope of protection of the claims.

Claims

1. A development branch synchronization method based on continuous integration, 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. According to the development branch synchronization method based on continuous integration according to claim 1, in, 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. According to the development branch synchronization method based on continuous integration according to claim 2, in, 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, in, 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, in, 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, in, 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, in, 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, in, Verify the development branch before synchronization, including: Verify different development branches in parallel before synchronization.

9. The development branch synchronization method based on continuous integration according to claim 1, in, 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, 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 the development branch synchronization method based on continuous integration as described in any one of claims 1 to 9 are realized.

11. 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 the steps of the method for development branch synchronization based on continuous integration as described in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Code warehouse management method and device, electronic equipment and storage medium

    CN115904933A

  • Software integration and deployment method and software development management system

    CN115904959A

  • Method and system for continuous integration and continuous deployment of applications

    US20220300265A1