Code submission processing method and device and nonvolatile storage medium

By detecting code verification conditions and executing continuous integration and continuous delivery pipelines, the problems of poor code merging quality and low efficiency are solved, and higher quality and efficient code merging is achieved.

CN118626128APending Publication Date: 2024-09-10CHINA TELECOM BESTPAY CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410863785.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-29
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

During the code merging process, existing technologies do not consider comprehensive factors, resulting in poor code merging quality and low efficiency.

Method used

By obtaining the target code, detecting whether it meets the predetermined verification conditions, and executing the continuous integration and continuous delivery pipeline when the conditions are met, it is determined whether to merge the code into the target branch to ensure the quality and efficiency of code merging.

Benefits of technology

It improves the quality and efficiency of code merging, and ensures the accuracy and stability of code merging by detecting code verification conditions and pipeline results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118626128A
    Figure CN118626128A
Patent Text Reader

Abstract

The invention discloses a code submission processing method and device and a nonvolatile storage medium. Relates to the technical field of computers, and comprises the following steps: obtaining a target code for a target software development project submitted based on a target account, the code corresponding to the target software development project comprising N code branches; detecting whether the target code meets a predetermined verification condition or not; under the condition that the target code meets a preset verification condition, an assembly line result obtained by executing continuous integration and continuous assembly line delivery for the target code is determined, and the assembly line result is used for indicating whether the target code executes continuous integration and continuous assembly line delivery successfully or not and whether a task associated with the target code is solved or not; and determining whether to merge the target code to a target branch in the N code branches based on the pipeline result. According to the method and the device, the technical problems of poor code merging quality and low efficiency caused by incomplete consideration factors during code merging in related technologies are solved.
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 code submission processing method, device and non-volatile storage medium. Background Art

[0002] For the widely used code management platforms in related technologies (such as GitLab code management platform), standardized code submission is an indispensable part of the software development process. Standardized code submission methods can improve the traceability, stability, readability, simplicity, and code quality of the code base, and are also an effective way for teams or individuals to improve software development efficiency. The current code development statistics have the following problems: the user information when submitting the code is not standardized, and it does not correspond to the company's personnel system information. It is impossible to quickly locate individuals when tracing the code, and the traceability of the code base is low; the permission management when submitting the code is not detailed enough, submission errors are prone to occur, and the stability of the code base is low; the submission comments when submitting the code are not standardized, the submission comments are poorly readable, and the readability of the project is low; there is no branch and lack of unified management, the code branches are messy, the projects are complicated, and the simplicity of the code base is low; the code merge stage is directly merged without verification, and the quality of the merged code is low; the code merge review stage only supports single-person review, the probability of misjudgment is high, and it is easy to cause low quality of the merged code.

[0003] Currently, no effective solution has been proposed to address the problem that in the above-mentioned related technologies, incomplete considerations are made when performing code merging, resulting in poor quality and low efficiency of code merging. Summary of the invention

[0004] The embodiments of the present invention provide a code submission processing method, device and non-volatile storage medium to at least solve the technical problem in the related art that incomplete consideration of factors during code merging leads to poor quality and low efficiency of code merging.

[0005] According to one aspect of an embodiment of the present invention, a code submission processing method is provided, comprising: obtaining a target code for a target software development project submitted based on a target account, wherein the code corresponding to the target software development project includes N code branches, and N is an integer greater than or equal to 1; detecting whether the target code satisfies a predetermined verification condition; if the target code satisfies the predetermined verification condition, determining a pipeline result obtained by executing a continuous integration and continuous delivery pipeline for the target code, wherein the pipeline result is used to indicate whether the target code executes the continuous integration and continuous delivery pipeline successfully, and whether the task associated with the target code is resolved; based on the pipeline result, determining whether to merge the target code into a target branch among the N code branches.

[0006] According to another aspect of an embodiment of the present invention, a code submission processing device is also provided, including: an acquisition module, used to acquire target code for a target software development project submitted based on a target account, wherein the code corresponding to the target software development project includes N code branches, and N is an integer greater than or equal to 1; a detection module, used to detect whether the target code satisfies a predetermined verification condition; a first determination module, used to determine a pipeline result obtained by executing a continuous integration and continuous delivery pipeline on the target code when the target code satisfies the predetermined verification condition, wherein the pipeline result is used to indicate whether the target code executes the continuous integration and continuous delivery pipeline successfully, and whether the task associated with the target code is resolved; a second determination module, used to determine whether to merge the target code into a target branch among the N code branches based on the pipeline result.

[0007] According to another aspect of an embodiment of the present invention, a non-volatile storage medium is provided, wherein the non-volatile storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded by a processor and executed by any one of the code submission processing methods.

[0008] According to another aspect of an embodiment of the present invention, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the steps of any one of the code submission processing methods are implemented.

[0009] In an embodiment of the present invention, by obtaining the target code for the target software development project submitted based on the target account, wherein the code corresponding to the target software development project includes N code branches, N is an integer greater than or equal to 1; detecting whether the target code meets the predetermined verification condition; if the target code meets the predetermined verification condition, determining the pipeline result obtained by executing the continuous integration and continuous delivery pipeline for the target code, wherein the pipeline result is used to indicate whether the target code successfully executes the continuous integration and continuous delivery pipeline, and whether the task associated with the target code is resolved; based on the pipeline result, determining whether to merge the target code into the target branch of the N code branches, the purpose of comprehensively determining whether to merge the code by detecting whether the target code meets the predetermined verification condition and the pipeline execution result of the target code is achieved, thereby achieving the technical effect of improving the efficiency and quality of code merging, and further solving the technical problem of poor quality and low efficiency of code merging caused by incomplete consideration of factors when performing code merging in the related art. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0011] Figure 1 is a flowchart of a code submission processing method according to an embodiment of the present invention;

[0012] Figure 2 is a flowchart of an optional code submission processing method according to an embodiment of the present invention;

[0013] Figure 3 is a flowchart of another optional code submission processing method according to an embodiment of the present invention;

[0014] Figure 4 is a schematic diagram of a code submission processing device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0015] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only 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 should fall within the scope of protection of the present invention.

[0016] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0017] First, to facilitate understanding of the embodiments of the present invention, some terms or nouns involved in the present invention are explained below:

[0018] The continuous integration and continuous delivery pipeline, referred to as the "CI / CD pipeline", is an automated system that can build a set of progressive test suites in a targeted manner to achieve automation and efficiency in software development. At each stage of the pipeline, if the build fails to pass the key test, an alert will be sent to the team; otherwise, it will enter the next test and automatically enter the next stage after continuously passing the test.

[0019] GitLab is an open source project for warehouse management systems. It uses Git as a code management tool and builds a Web service on this basis. Gitlab is a widely used open source code management platform built on a Web application framework. It mainly manages the code and documents generated during the software development process. Gitlab mainly manages code and documents in two dimensions: group and project. A group can manage multiple projects, which can be understood as a group with multiple software development tasks, and a project may contain multiple code branches, which means that there are multiple code branches in each project. Each code branch is independent of each other and different branches can be merged.

[0020] According to an embodiment of the present invention, a method embodiment of code submission processing is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0021] Figure 1 is a flowchart of a code submission processing method according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:

[0022] Step S102: obtaining target code for a target software development project submitted based on a target account, wherein the code corresponding to the target software development project includes N code branches, where N is an integer greater than or equal to 1.

[0023] Optionally, the target code can be understood as a source code branch (ie, source branch) that needs to be merged, that is, the target code needs to be merged into a target branch among N code branches.

[0024] Optionally, the N branches may include, but are not limited to, a master branch and other branches, wherein the other branches include at least one of the following: a feature branch, a functional branch, a fix branch, a development branch, and a release branch, wherein: the master branch (master or main) refers to the main development path or core function of a project or code base, represents the core idea and main goal of the entire project or software, and is the benchmark that all branch developments ultimately need to regress and integrate. Feature branches are used to develop new features or functions. When developers start implementing a new feature, they usually create a new feature branch from the master branch and develop on that branch. Once the feature development is complete and tested, the branch is merged back to the master branch. Bugfix branches are used to fix errors or defects in the code. When a problem is found, developers may create a fix branch from the master branch or the most recent stable version and then fix the problem on this branch. After the fix is ​​completed, the branch is also merged back to the master branch. For development branches, in some development processes, development branches are used to integrate all upcoming features. Developers merge their feature branches into development branches instead of directly into the master branch. This allows for more comprehensive testing before release. Release branches are used to prepare for the release of new versions. Before release, some additional testing, documentation updates, or version annotations may be required. These tasks can be performed on release branches to ensure that the main branch and other branches are not interfered with. In addition to the common branch types mentioned above, there can also be other temporary branches for experimental development, performance optimization, refactoring, and other tasks. These branches are usually deleted after the task is completed.

[0025] Step S104, detecting whether the target code meets a predetermined verification condition.

[0026] In an optional embodiment, the predetermined verification condition includes at least one of the following: whether the target account matches the submission account information pre-stored in the code management platform; whether the code management platform stores the target account's access rights to the target branch; whether the code comments in the target code meet the preset comment rules; whether the target code meets the branch specification corresponding to the target branch.

[0027] Optionally, before merging the target code into the corresponding branch, it is necessary to perform an initial verification on the target code to determine whether the target code meets the predetermined verification conditions, thereby ensuring the quality of code merging. Specifically, if the account information when submitting the code is not standardized, for example, it does not correspond to the enterprise personnel system information, the individual cannot be quickly located during code tracing, and the traceability of the code base is low. Therefore, before the code is merged, it is necessary to detect whether the account information of the target account matches the submitted account information pre-stored in the code management platform, thereby improving the traceability of the code base; if the permission management when submitting the code is not detailed enough, submission errors are prone to occur, and the stability of the code base is low. Therefore, before the code is merged, it is necessary to detect whether the target account's access rights for the target branch are stored in the code management platform, thereby avoiding submission errors and improving the stability of the code base; if the submission comments when submitting the code are not standardized, the readability of the submission comments is poor, and the readability of the project is low. Therefore, before merging the codes, it is necessary to check whether the code comments in the target code meet the preset comment rules, so as to ensure the readability of the comments and improve the readability of the project. If there is a lack of unified management of branches, it will lead to messy code branches, redundant projects and low simplicity of the code base. Therefore, before merging the codes, it is necessary to check whether the target code meets the branch specifications corresponding to the target branch, so as to achieve standardized branch management.

[0028] Optionally, the branch specifications may include, but are not limited to: branch naming specifications, branch creation time, branch merging time and merging conditions, branch usage and life cycle, etc.

[0029] Optionally, when there are multiple predetermined verification conditions, the target code needs to satisfy multiple predetermined verification conditions before the pipeline result of the target branch can be further determined.

[0030] In an optional embodiment, detecting whether the target code satisfies a predetermined verification condition includes: detecting whether the account information of the target account matches the submission account information pre-stored in the code management platform; detecting whether the target account's access rights for the target branch are stored in the code management platform; detecting whether the code comments in the target code satisfy preset comment rules; detecting whether the target code satisfies the branch specification corresponding to the target branch; determining that the target code satisfies the predetermined verification condition when the account information of the target account matches the submission account information pre-stored in the code management platform, and the target account's access rights for the target branch are stored in the code management platform, and the code comments in the target code satisfy the preset comment rules, and the target code satisfies the branch specification corresponding to the target branch; determining that the target code does not satisfy the predetermined verification condition when the account information of the target account does not match the submission account information pre-stored in the code management platform, or the target account's access rights for the target branch are not stored in the code management platform, or the code comments in the target code do not satisfy the preset comment rules, or the target code does not satisfy the branch specification corresponding to the target branch.

[0031] Optionally, during the code submission phase, the code submission account, i.e., the target account's account information, is checked for compliance to improve the traceability of the code base. Specifically, the target account's account information is checked to see if it matches the pre-stored submission account information in the code management platform. If the account information verification fails, i.e., the target account's account information does not match the pre-stored account information to be submitted, the target account's code submission is rejected, and the rectification method (correct account name and email address) is given by configuring the rectification command; if the verification passes, i.e., the target account's account information matches the pre-stored account information to be submitted, the next step of verification is performed. The code submitter, i.e., the target account's branch permission verification is performed to improve the stability of the code base. Specifically, the branch permissions in the code management platform are obtained to determine whether the target account matches the branch permissions; if the permission verification fails, i.e., the target account does not match the branch permissions, the code submission is rejected, and permission guidance is given; if the verification passes, i.e., the target account matches the branch permissions, the next step of verification is performed. Further conduct a compliance check on the code comments corresponding to the target code to improve the readability of the project. Specifically, obtain the submission comment specifications in the code management platform to determine whether the code comments corresponding to the target code meet the specifications; if the code comments do not meet the specifications, reject the submission of the target code; if the verification passes, that is, the code comments of the target code meet the specifications, then proceed to the next step of verification. Further conduct a compliance check on the submitted branch to improve the simplicity of the project. Specifically, obtain the branch specifications in the code management platform to determine whether the submitted target code meets the specifications; if the submitted target code does not meet the specifications, reject the code submission; if the verification passes, that is, the submitted target code meets the specifications, then proceed to the next step of verification. Further use the target code as the source branch to verify the pipeline results of the source branch, verify the problem solving of the source branch, and improve the quality of the merged code.

[0032] Step S106, when the target code meets the predetermined verification conditions, determine the pipeline result obtained by executing the continuous integration and continuous delivery pipeline for the target code, wherein the pipeline result is used to indicate whether the target code executes the continuous integration and continuous delivery pipeline successfully, and whether the task associated with the target code is resolved.

[0033] Optionally, the continuous integration and continuous delivery pipeline is a series of automated steps for building, testing, and deploying applications or software systems. These steps include code compilation, unit testing, integration testing, static code analysis, packaging, deployment, etc., which are designed to ensure the quality of the code and deliver the code to users quickly and reliably. The pipeline result is the result obtained by executing the continuous integration and continuous delivery pipeline on the target code. The pipeline result may also include whether the compilation is successful, whether the test passes, code coverage, static code analysis results, whether the built deployment package is available, etc. Based on the pipeline result, the quality and stability of the target code can be evaluated to determine whether it can be safely merged into the target branch.

[0034] Step S108, based on the pipeline result, determine whether to merge the target code into the target branch among the N code branches.

[0035] Optionally, based on the pipeline results, the quality and stability of the target code can be evaluated to determine whether it can be safely merged into the target branch, thereby improving the quality of code merging.

[0036] In an optional embodiment, based on the pipeline results, determining whether to merge the target code into the target branch includes: when the pipeline results indicate that the continuous integration and continuous delivery pipelines are executed successfully and the tasks associated with the target code are resolved, merging the target code into the target branch; when the pipeline results indicate that the continuous integration and continuous delivery pipelines are executed unsuccessfully, or the tasks associated with the target code are not resolved, or the tasks associated with the target code are resolved but new problems are introduced, prohibiting the target code from being merged into the target branch.

[0037] Optionally, verify the pipeline results of the source branch, verify the problem resolution of the source branch, and improve the quality of the merged code. Specifically, verify the pipeline results of the source branch, and verify the problem resolution of the source branch; if the pipeline verification of the source branch fails or there are unresolved issues, for example, the pipeline verification of the source branch succeeds and there are unresolved issues, the pipeline verification of the source branch fails, etc., then refuse to merge the code; if the verification passes, that is, the pipeline verification of the source branch succeeds and there are no unresolved issues, then proceed to the next step of verification. Based on the above method, the target code quality and stability can be effectively evaluated to determine whether it can be safely merged into the target branch, thereby improving the quality of code merging.

[0038] In an optional embodiment, when the pipeline results indicate that the continuous integration and continuous delivery pipelines are executed successfully and the tasks associated with the target code are resolved, the target code is merged into the target branch, including: when the pipeline results indicate that the continuous integration and continuous delivery pipelines are executed successfully and the tasks associated with the target code are resolved, sending review requests to multiple accounts respectively; receiving review results returned by the multiple accounts in response to the review requests respectively, wherein the review results are used to indicate whether the corresponding accounts agree to merge the target code into the target branch; when it is determined that the review result is that the number of accounts that agree to merge is greater than a preset threshold, merging the target code into the target branch.

[0039] Optionally, when the pipeline results are verified, that is, the continuous integration and continuous delivery pipelines are successfully executed, and the tasks associated with the target code are resolved, further review requests are sent to multiple accounts to request multiple accounts to review the target code separately and decide whether to agree to merge the target code into the target branch; after receiving the review results returned by multiple accounts, it is determined whether to merge the target code into the target branch based on the review results returned by multiple accounts. Specifically, if the number of accounts that agree to merge the target code into the target branch is large and greater than the preset threshold, the target code is merged into the target branch, otherwise the target code is not merged into the target branch. This avoids the problem that the review stage of code merging only supports single-person review, the probability of misjudgment is high, and it is easy to cause the problem of low quality of the merged code. In the above way, the quality of the merged code is improved by using a code merging method with multi-account review and separate review and merging.

[0040] In an optional embodiment, when it is determined that the number of accounts that agree to merge as a result of the review is greater than a preset threshold, the target code is merged into the target branch, including: when the number of accounts that agree to merge as a result of the review is greater than a preset threshold, obtaining the code merging methods proposed by the accounts that agree to merge as a result of the review; determining the target code merging method based on the code merging methods proposed by the accounts that agree to merge as a result of the review; and merging the target code into the target branch according to the target code merging method.

[0041] Optionally, when multiple accounts provide the review results for the target code, they will also provide a code merging method for merging the target code into the target branch. Based on the code merging methods proposed by the accounts that agree to merge, the target code merging method is comprehensively determined. Specifically, the target code merging method can be determined according to the "voting principle", that is, the code merging method that corresponds to the most selected accounts will be used as the target code merging method. In the above way, the target code merging method is determined through multi-party evaluation to avoid the occurrence of problems such as a high probability of misjudgment and low quality of merged code due to a single review as much as possible.

[0042] Optionally, the code merging methods may include but are not limited to: manual merging, fast forward merging, three-way merging, and rebase merging, wherein manual merging means manually resolving conflicts and merging code line by line; Fast forward merging means when the target branch is the direct successor of the target code, the code management platform (such as Gitlab) will perform a fast-forward merge and directly point the target branch to the commit of the source branch without generating a new merge commit; three-way merging means when the target branch is not the direct successor of the target code, the code management platform will perform a three-way merge and create a new merge commit to merge the changes of the two branches together; Rebase merging means using the Rebase command to put the commit of the target code after the latest commit of the target branch, which is equivalent to "moving" the commit of the target code branch to the back of the target branch, so as to keep the commit history tidy.

[0043] In an optional embodiment, the method further includes: when the review result is that the number of accounts that agree to merge is less than or equal to a preset threshold, prohibiting the target code from being merged into the target branch.

[0044] Optionally, when the number of accounts that agree to merge is less than or equal to a preset threshold, that is, when the majority of accounts disagree to merge the target code into the target branch, merging the target code into the target branch is prohibited.

[0045] The execution subject of the above steps S102 to S108 is the code management platform. Through the above steps S102 to S108, the purpose of comprehensively determining whether to merge the code can be achieved by detecting whether the target code meets the predetermined verification conditions and the pipeline execution result of the target code, thereby achieving the technical effect of improving the efficiency and quality of code merging, and further solving the technical problem of poor quality and low efficiency of code merging caused by incomplete consideration of factors when performing code merging in related technologies.

[0046] Based on the above embodiments and optional embodiments, the present invention proposes an optional implementation mode: Figure 2is a flowchart of an optional code submission processing method according to an embodiment of the present invention. Figure 3 is a flowchart of an optional code submission processing method according to an embodiment of the present invention. Figure 2 and Figure 3 As shown, the method includes:

[0047] S1, during the code submission phase, the account information of the code submission account, i.e. the target account, is checked for compliance to improve the traceability of the code base:

[0048] S11, obtain employee information from the company's human resources system, including account name and email address. Determine whether the account information of the target account for code submission based on the code management platform (such as Gitlab) matches the account information to be submitted pre-stored in the human resources system;

[0049] S12, if the account information verification fails, that is, the account information of the target account does not match the pre-stored account information to be submitted, the code submission of the target account is rejected, and the rectification method (correct account name and email address) is given by configuring the rectification command, and the account information of the target account is detected to have a user name (i.e., account name), email address, etc. that does not conform to the specification;

[0050] S13, if the verification is passed, that is, the account information of the target account matches the pre-stored account information to be submitted, the next step of verification is performed.

[0051] S2, verify the branch permissions of the code submitter, that is, the target account, to improve the stability of the code base:

[0052] S21, obtaining branch permissions in the code management platform and determining whether the target account matches the branch permissions;

[0053] S22, if the permission check fails, that is, the target account does not match the branch permission, the code submission is rejected and permission guidance is given. When the permission check fails, a prompt message will be displayed on the display interface corresponding to the target account to prompt that the target account does not have branch submission permission, and the actual submission permission account corresponding to the branch will be given; when the permission check fails, the target account can also be prompted with branch permission information through the display interface, including the person in charge of each branch and the authorized object of each branch merger;

[0054] S23, if the verification passes, that is, the target account matches the branch authority, the next step of verification is performed.

[0055] S3, perform standard verification of the target code corresponding to the code comments to improve the readability of the project:

[0056] S31, obtain the submission comment specification in the code management platform, and determine whether the code comment corresponding to the target code meets the specification. The specific code submission specification is as follows:

[0057] -Git commit–m “commit type + requirement / vulnerability / correction work order number + code summary”;

[0058] The types of code comments submitted may include but are not limited to:

[0059] feat: modify / add new functions;

[0060] fix: fix the vulnerability / function code change;

[0061] docs: Documentation related changes;

[0062] style: changes that do not affect the meaning of the code (whitespace / formatting / missing symbols, etc.);

[0063] perf: Changes to improve performance;

[0064] test: add / modify existing tests;

[0065] chore: Changes to Build / .gitignore / auxiliary tools / library (document generation), etc.

[0066] An example of code that complies with the specification is shown below:

[0067] fix: BUG-3241: Fix the error queue problem in BUG-3241.

[0068] S32, if the code comment does not conform to the specification, the submission of the target code is rejected. When the code comment does not conform to the specification, the submission of the target code is rejected and a prompt message is provided to the target account;

[0069] S33, if the verification is passed, that is, the code comments of the target code meet the specifications, the next step of verification is performed.

[0070] S4, perform compliance check on submitted branches to improve the simplicity of the project:

[0071] S41, obtaining branch specifications in the code management platform, and determining whether the submitted target code complies with the specifications;

[0072] S42, if the submitted target code does not meet the specification, the code submission is rejected and a prompt message is provided to the target account;

[0073] S43, if the verification is passed, that is, the submitted target code meets the specification, the next step of verification is performed.

[0074] S5, using the target code as the source branch, verifies the pipeline results of the source branch, verifies the problem solving status of the source branch, and improves the quality of the merged code:

[0075] S51, verify the pipeline result of the source branch and the problem solving status of the source branch;

[0076] S52, if the pipeline verification of the source branch fails or there are unresolved issues, the code merge is rejected. When the pipeline verification of the source branch succeeds and there are unresolved issues, prompt messages are sent to the target accounts in sequence;

[0077] S53, if the verification passes, that is, the pipeline verification of the source branch is successful and there are no unresolved issues, then the next step of verification is performed.

[0078] S6, using multi-account review, review and merge separation code merging method to improve the quality of merged code:

[0079] S61, code detection is performed, and multiple review accounts merge the codes for code review. In the code review stage, the display interface corresponding to the target account can observe the review results and review progress given by each review account, and the review progress and review results can be displayed on the display interface, wherein the display interface corresponding to the target account can be but is not limited to: the display interface of the code management platform (such as Gitlab) when the target account logs in;

[0080] S62, the code merging account decides whether to merge the codes according to the review results provided by the multiple review accounts;

[0081] S63. After the merge is successful, delete the source branch.

[0082] In the embodiment of the present invention, by performing a normative check on the user information of the code submitter, the code submission is rejected and rectification is required, so that individuals can be quickly located during code tracing, thereby improving the traceability of the code base; by refining the authority of code submission to individuals for important branches such as production branches, submission errors are eliminated, and problems with production codes are strictly prevented, thereby improving the stability of the code base; by forming the company's submission system specifications and performing a normative check on the submission comments, the readability of the project is improved; by forming the company's branch management specifications and performing a normative check on the submission branches, the source branches are automatically deleted after the branches are merged, thereby improving the simplicity of the project; by verifying the pipeline results of the source branch when merging the code and verifying the problem solving of the source branch, the quality of the merged code is improved; by supporting multi-person review when merging the code and subdividing the responsibilities of the code reviewer and the code merger person, the quality of the merged code is improved.

[0083] It should be noted that the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. For example, an interface is set up between this system and the relevant user or organization. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain relevant information after receiving the consent information fed back by the aforementioned user or organization.

[0084] In this embodiment, a code submission processing device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the terms "module" and "device" can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0085] According to an embodiment of the present invention, there is also provided an apparatus embodiment for implementing the above code submission processing method. Figure 4 is a schematic diagram of the structure of a code submission processing device according to an embodiment of the present invention. Figure 4 As shown, the above-mentioned code submission processing device includes: an acquisition module 1600, a detection module 1602, a first determination module 1604, and a second determination module 1606, wherein:

[0086] An acquisition module 1600 is used to acquire target code for a target software development project submitted based on a target account, wherein the code corresponding to the target software development project includes N code branches, where N is an integer greater than or equal to 1;

[0087] The detection module 1602 is connected to the acquisition module 1600 and is used to detect whether the target code meets the predetermined verification condition;

[0088] A first determination module 1604, connected to the detection module 1602, is used to determine a pipeline result obtained by executing the continuous integration and continuous delivery pipeline on the target code when the target code meets a predetermined verification condition, wherein the pipeline result is used to indicate whether the target code executes the continuous integration and continuous delivery pipeline successfully and whether the task associated with the target code is resolved;

[0089] The second determination module 1606 is connected to the first determination module 1604 and is used to determine whether to merge the target code into the target branch among the N code branches based on the pipeline result.

[0090] In an embodiment of the present invention, an acquisition module 1600 is set to acquire the target code for the target software development project submitted based on the target account, wherein the code corresponding to the target software development project includes N code branches, and N is an integer greater than or equal to 1; a detection module 1602 is connected to the acquisition module 1600 and is used to detect whether the target code meets the predetermined verification condition; a first determination module 1604 is connected to the detection module 1602 and is used to determine the pipeline result obtained by executing the continuous integration and continuous delivery pipeline for the target code when the target code meets the predetermined verification condition, wherein the pipeline result is used to indicate the execution of the target code. The continuous integration and continuous delivery pipeline is successfully executed, and the tasks associated with the target code are resolved; the second determination module 1606 is connected to the first determination module 1604, and is used to determine whether to merge the target code into the target branch of the N code branches based on the pipeline result, thereby achieving the purpose of comprehensively determining whether to merge the code by detecting whether the target code meets the predetermined verification conditions and the pipeline execution result of the target code, thereby achieving the technical effect of improving the efficiency and quality of code merging, and further solving the technical problem in the related art that the factors considered when merging the code are not comprehensive, resulting in poor quality and low efficiency of code merging.

[0091] It should be noted that the above modules can be implemented by software or hardware. For example, for the latter, it can be implemented in the following ways: the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.

[0092] It should be noted that the acquisition module 1600, the detection module 1602, the first determination module 1604, and the second determination module 1606 correspond to steps S102 to S108 in the embodiment, and the examples and application scenarios implemented by the modules and the corresponding steps are the same, but are not limited to the contents disclosed in the above embodiment. It should be noted that the modules as part of the device can be run in a computer terminal.

[0093] It should be noted that the optional or preferred implementation of this embodiment can refer to the relevant description in the embodiment, which will not be repeated here.

[0094] The above-mentioned code submission processing device may also include a processor and a memory. The above-mentioned acquisition module 1600, detection module 1602, first determination module 1604, second determination module 1606, etc. are all stored in the memory as program modules, and the processor executes the above-mentioned program modules stored in the memory to realize corresponding functions.

[0095] The processor includes a kernel, which retrieves the corresponding program module from the memory. The kernel may be one or more. The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. The memory includes at least one memory chip.

[0096] According to an embodiment of the present application, an embodiment of a non-volatile storage medium is also provided. Optionally, in this embodiment, the non-volatile storage medium includes a stored program, wherein when the program is running, the device where the non-volatile storage medium is located is controlled to execute any of the above code submission processing methods.

[0097] Optionally, in this embodiment, the non-volatile storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group, and the non-volatile storage medium includes a stored program.

[0098] Optionally, when the program is running, the device where the non-volatile storage medium is located is controlled to perform the following functions: obtain the target code for the target software development project submitted based on the target account, wherein the code corresponding to the target software development project includes N code branches, and N is an integer greater than or equal to 1; detect whether the target code satisfies a predetermined verification condition; if the target code satisfies the predetermined verification condition, determine the pipeline result obtained by executing the continuous integration and continuous delivery pipeline for the target code, wherein the pipeline result is used to indicate whether the target code executes the continuous integration and continuous delivery pipeline successfully, and whether the task associated with the target code is resolved; based on the pipeline result, determine whether to merge the target code into the target branch among the N code branches.

[0099] According to an embodiment of the present application, an embodiment of a processor is also provided. Optionally, in this embodiment, the processor is used to run a program, wherein any one of the code submission processing methods is executed when the program is run.

[0100] According to an embodiment of the present application, an embodiment of a computer program product is also provided. Optionally, in this embodiment, the computer program product includes a computer program, and when the computer program is executed by a processor, the computer program implements any of the steps of the code submission processing method.

[0101] Optionally, the above-mentioned computer program product, when executed on a data processing device, is suitable for executing a program initialized with the following method steps: obtaining the target code for the target software development project submitted based on the target account, wherein the code corresponding to the target software development project includes N code branches, and N is an integer greater than or equal to 1; detecting whether the target code satisfies a predetermined verification condition; when the target code satisfies the predetermined verification condition, determining the pipeline result obtained by executing the continuous integration and continuous delivery pipeline for the target code, wherein the pipeline result is used to indicate whether the target code executes the continuous integration and continuous delivery pipeline successfully, and whether the task associated with the target code is resolved; based on the pipeline result, determining whether to merge the target code into the target branch among the N code branches.

[0102] An embodiment of the present invention provides an electronic device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, the following steps are implemented: obtaining a target code for a target software development project submitted based on a target account, wherein the code corresponding to the target software development project includes N code branches, and N is an integer greater than or equal to 1; detecting whether the target code satisfies a predetermined verification condition; when the target code satisfies the predetermined verification condition, determining a pipeline result obtained by executing a continuous integration and continuous delivery pipeline on the target code, wherein the pipeline result is used to indicate whether the target code executes the continuous integration and continuous delivery pipeline successfully, and whether the task associated with the target code is resolved; based on the pipeline result, determining whether to merge the target code into the target branch among the N code branches.

[0103] The above sequence of the embodiments of the present invention is for description only and does not represent the superiority or inferiority of the embodiments.

[0104] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0105] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the above modules can be a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, modules or indirect coupling or communication connection of modules, which can be electrical or other forms.

[0106] The modules described above as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.

[0107] In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of software functional modules.

[0108] If the above-mentioned integrated module is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable non-volatile storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a non-volatile storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the various embodiments of the present invention. The aforementioned non-volatile storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.

[0109] The above are only preferred embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A code submission processing method, characterized in that: include: Obtaining target code for a target software development project submitted based on a target account, wherein the code corresponding to the target software development project includes N code branches, where N is an integer greater than or equal to 1; Detecting whether the target code meets a predetermined verification condition; In the case where the target code satisfies the predetermined verification condition, determining a pipeline result obtained by executing the continuous integration and continuous delivery pipeline for the target code, wherein the pipeline result is used to indicate whether the target code executes the continuous integration and continuous delivery pipeline successfully, and whether the task associated with the target code is resolved; Based on the pipeline result, it is determined whether to merge the target code into a target branch among the N code branches.

2. The method according to claim 1, characterized in that The determining whether to merge the target code into the target branch based on the pipeline result includes: When the pipeline result indicates that the continuous integration and continuous delivery pipeline is successfully executed and the task associated with the target code is resolved, merging the target code into the target branch; In the case where the pipeline result indicates that the continuous integration and continuous delivery pipeline execution was unsuccessful, or the task associated with the target code was not resolved, or the task associated with the target code was resolved but introduced new problems, merging the target code into the target branch is prohibited.

3. The method according to claim 2, characterized in that When the pipeline result indicates that the continuous integration and continuous delivery pipeline is successfully executed and the task associated with the target code is resolved, merging the target code into the target branch includes: When the pipeline result indicates that the continuous integration and continuous delivery pipeline is successfully executed and the task associated with the target code is resolved, sending review requests to multiple accounts respectively; Receiving review results returned by the multiple accounts respectively in response to the review request, wherein the review results are used to indicate whether the corresponding accounts agree to merge the target code into the target branch; When it is determined that the number of accounts that agree to be merged as a result of the review is greater than a preset threshold, the target code is merged into the target branch.

4. The method according to claim 3, characterized in that When it is determined that the number of accounts that agree to merge as a result of the review is greater than a preset threshold, merging the target code into the target branch includes: When the number of accounts that agree to be merged according to the review result is greater than the preset threshold, obtaining the code merging methods respectively proposed by the accounts that agree to be merged according to the review result; Determine the target code merging method based on the code merging methods respectively proposed by the accounts that agree to merge according to the review results; The target code is merged into the target branch according to the target code merging method.

5. The method according to claim 3, characterized in that: The method further comprises: When the review result is that the number of accounts that agree to merge is less than or equal to the preset threshold, merging the target code into the target branch is prohibited.

6. The method according to any one of claims 1 to 5, characterized in that The predetermined verification condition includes at least one of the following: Whether the target account matches the submitted account information pre-stored in the code management platform; Whether the code management platform stores the access rights of the target account to the target branch; Whether the code comments in the target code meet the preset comment rules; Whether the target code satisfies the branch specification corresponding to the target branch.

7. The method according to claim 6, characterized in that The detecting whether the target code satisfies a predetermined verification condition comprises: Detecting whether the account information of the target account matches the submitted account information pre-stored in the code management platform; Detecting whether the code management platform stores access rights of the target account for the target branch; Detecting whether the code comments in the target code meet the preset comment rules; Detecting whether the target code satisfies a branch specification corresponding to the target branch; In the case where the account information of the target account matches the submission account information pre-stored in the code management platform, and the code management platform stores the access rights of the target account for the target branch, and the code comments in the target code meet the preset comment rules, and the target code meets the branch specification corresponding to the target branch, it is determined that the target code meets the predetermined verification condition; When the account information of the target account does not match the submission account information pre-stored in the code management platform, or the code management platform does not store the access rights of the target account for the target branch, or the code comments in the target code do not meet the preset comment rules, or the target code does not meet the branch specification corresponding to the target branch, it is determined that the target code does not meet the predetermined verification condition.

8. A code submission processing device, characterized in that: include: An acquisition module, used to acquire target code for a target software development project submitted based on a target account, wherein the code corresponding to the target software development project includes N code branches, where N is an integer greater than or equal to 1; A detection module, used to detect whether the target code meets a predetermined verification condition; A first determination module is used to determine a pipeline result obtained by executing the continuous integration and continuous delivery pipeline for the target code when the target code satisfies the predetermined verification condition, wherein the pipeline result is used to indicate whether the target code executes the continuous integration and continuous delivery pipeline successfully and whether the task associated with the target code is resolved; The second determination module is used to determine whether to merge the target code into a target branch among the N code branches based on the pipeline result.

9. A non-volatile storage medium, characterized in that: The non-volatile storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the code submission processing method described in any one of claims 1 to 7.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the code submission processing method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Method and apparatus for managing code data, device, and medium

    WO2026188421A1