CN115904933A - Code warehouse management method and device, electronic equipment and storage medium - Google Patents

Code warehouse management method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115904933A
CN115904933A CN202211142530.0A CN202211142530A CN115904933A CN 115904933 A CN115904933 A CN 115904933A CN 202211142530 A CN202211142530 A CN 202211142530A CN 115904933 A CN115904933 A CN 115904933A
Authority
CN
China
Prior art keywords
code
branch
branches
development
target code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211142530.0A
Other languages
Chinese (zh)
Inventor
皮智鑫
梁中华
张靖波
陈飞
谢隆飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Construction Bank Corp
CCB Finetech Co Ltd
Original Assignee
China Construction Bank Corp
CCB Finetech Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Construction Bank Corp, CCB Finetech Co Ltd filed Critical China Construction Bank Corp
Priority to CN202211142530.0A priority Critical patent/CN115904933A/en
Publication of CN115904933A publication Critical patent/CN115904933A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

The application relates to the technical field of software development, and provides a code warehouse management method, a device, electronic equipment and a storage medium, wherein a code warehouse is composed of a plurality of code branches, and the method comprises the following steps: creating a code branch corresponding to the code warehouse based on software development requirements, and distributing the code branch to at least one development end for code development; responding to the code development operation of at least one development end, acquiring a target code corresponding to each code development operation, and copying the target code to a corresponding code branch to obtain a target code branch; responding to a merging request of the target code branch, and determining whether the target code branch to be merged has a dependency relationship; if so, merging the target code branches with the dependency relationship, and performing code test on the target code branches to test whether codes in the merged target code branches run normally, so that when the codes are changed, the corresponding code branches are directly modified, the development efficiency is improved, and the cost is saved.

Description

Code warehouse management method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of software development technologies, and in particular, to a method and an apparatus for managing a code repository, an electronic device, and a storage medium.
Background
A code repository is a storage mechanism for software, such as application code, for code versioning and code change tracking. In large-scale software project management, in order to meet the requirement of stage management of a project, a concept of code branching is introduced, a code warehouse is managed and controlled by establishing different code branches, work can be separated from a development main line by using the code branches, and the influence on the development main line is reduced.
In the prior art, when a software development project is performed, a plan is used for driving, that is, project requirements are determined, planning is performed according to the project requirements, developers required by the development project are evaluated, further, the project requirements are split into requirement items to schedule, each developer performs respective code development according to the schedule, after the developers complete respective code development, configuration managers combine developed codes of all the developers together and release the codes to a test environment for testing, and then the software development project is completed.
However, in the above software development method, each developer develops codes in turn according to their own schedule, and it takes a lot of time for the configuration manager to communicate with all developers, and further, the codes of all developers are merged together, which not only results in low development efficiency, but also requires a lot of communication cost and labor cost.
Disclosure of Invention
The application provides a code warehouse management method, a code warehouse management device, an electronic device and a storage medium, codes can be intelligently combined, the possibility of errors is reduced, when the codes need to be changed, corresponding code branches are directly called to be modified, the whole running codes do not need to be modified, the development efficiency is improved, and the communication cost and the labor cost are saved.
In a first aspect, the present application provides a method for managing a code repository, the code repository being formed from a plurality of code branches, the method comprising:
creating a code branch corresponding to the code warehouse based on software development requirements, and distributing the code branch to at least one development end for code development;
responding to code development operation of at least one development end, acquiring a target code corresponding to each code development operation, and copying the target code to a corresponding code branch to obtain a target code branch;
responding to a merging request of the target code branch, and determining whether the target code branch to be merged has a dependency relationship;
if yes, merging the target code branches with the dependency relationship, and performing code testing on the merged target code branches to test whether codes in the merged target code branches run normally.
Optionally, obtaining a target code corresponding to each code development operation, and copying the target code to a corresponding code branch includes:
acquiring a module branch created by each code development operation, wherein the module branch is used for recording a functional code written by a development end;
performing function test on the function codes in the module branches to obtain target codes; the target code is a code which is qualified in the test;
and uploading the target code to a corresponding code branch, and copying the target code.
Optionally, the method further includes:
responding to the change operation of a development end in a module branch, and acquiring a function code corresponding to the change operation;
and re-performing function test on the function code corresponding to the change operation, and obtaining a target code qualified in the test.
Optionally, the code testing is performed on the merged target code branch, and includes:
acquiring a plurality of target code branches which are merged within preset time, and respectively performing code testing on the plurality of target code branches to verify whether codes in the plurality of target code branches run normally or not;
and after the codes in the target code branches are determined to run normally, performing code test on the combined target code branches.
Optionally, the method further includes:
acquiring the merged target code branches and timestamps corresponding to the merged target code branches every other preset period, and compiling codes in the merged target code branches to obtain issuing branches;
processing each issuing branch based on a data mirroring method and determining whether an updated timestamp and/or an updated code exists in the issuing branch;
and if so, acquiring the updated timestamp and/or the release branch corresponding to the updated code, and releasing the release branch.
Optionally, the issuing branch includes:
acquiring an operating environment corresponding to the release branch, and generating a configuration file corresponding to the release branch based on the operating environment configuration;
and generating a software package based on the configuration file and the release branch, and releasing the software package.
Optionally, the method further includes:
when the codes in the merged target code branches are determined to be abnormal in operation, prompt information is generated and sent to a development end, so that the development end can develop the codes again based on the prompt information, wherein the prompt information comprises the codes abnormal in operation and operation problems.
In a second aspect, the present application provides a code repository management apparatus, the code repository being formed of a plurality of code branches, the apparatus comprising:
the creating module is used for creating a code branch corresponding to the code warehouse based on software development requirements and distributing the code branch to at least one development end for code development;
the response module is used for responding to the code development operation of at least one development end, acquiring a target code corresponding to each code development operation, and copying the target code to a corresponding code branch to obtain a target code branch;
the determining module is used for responding to the merging request of the target code branch and determining whether the target code branch to be merged has a dependency relationship;
and the merging module is used for merging the target code branches with the dependency relationship when the target code branches to be merged have the dependency relationship, and performing code test on the merged target code branches to test whether codes in the merged target code branches run normally.
In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor executes computer-executable instructions stored by the memory to implement the method of any of the first aspects.
In a fourth aspect, the present application provides a computer-readable storage medium having stored thereon computer-executable instructions for implementing the method according to any one of the first aspect when executed by a processor.
In a fifth aspect, the present application provides a computer program product comprising program code for performing the method according to any one of the first aspect when the computer program is run by a computer.
To sum up, the present application provides a method, an apparatus, an electronic device, and a storage medium for managing a code repository, where the code repository is composed of a plurality of code branches, and specifically, a code branch corresponding to the code repository may be created based on a software development requirement, and the code branch is allocated to at least one development end to perform code development; further, responding to the code development operation of at least one development end, acquiring a target code corresponding to each code development operation, and copying the target code to a corresponding code branch to obtain a target code branch; further, responding to the merging request of the target code branch, and determining whether the target code branch to be merged has a dependency relationship; if yes, merging the target code branches with the dependency relationship, and performing code testing on the merged target code branches to test whether codes in the merged target code branches operate normally, so that code development can be performed on the code branches defined in advance based on software development requirements, and for a plurality of code branches with the dependency relationship, intelligent merging can be performed, the possibility of errors is reduced, the accuracy of the code branches is improved, when the codes need to be changed, the corresponding code branches are directly called to be modified, the codes in the whole code warehouse do not need to be modified, the development efficiency is improved, and the cost is saved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
Fig. 1 is a schematic view of an application scenario provided in an embodiment of the present application;
fig. 2 is a schematic flowchart of a code warehouse management method according to an embodiment of the present application;
fig. 3 is a schematic flowchart of a specific code warehouse management method according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a code warehouse management apparatus according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
With the above figures, there are shown specific embodiments of the present application, which will be described in more detail below. These drawings and written description are not intended to limit the scope of the inventive concepts in any manner, but rather to illustrate the inventive concepts to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
In the embodiments of the present application, terms such as "first" and "second" are used to distinguish the same or similar items having substantially the same function and action. For example, the first device and the second device are only used for distinguishing different devices, and the sequence order thereof is not limited. Those skilled in the art will appreciate that the terms "first," "second," etc. do not denote any order or quantity, nor do the terms "first," "second," etc. denote any order or importance.
It is noted that, in the present application, words such as "exemplary" or "for example" are used to mean exemplary, illustrative, or descriptive. Any embodiment or design described herein as "exemplary" or "such as" is not necessarily to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the word "exemplary" or "such as" is intended to present concepts related in a concrete fashion.
In the present application, "at least one" means one or more, "a plurality" means two or more. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone, wherein A and B can be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" or similar expressions refer to any combination of these items, including any combination of the singular or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, a-b, a-c, b-c, or a-b-c, wherein a, b, c may be single or multiple.
The following first explains the terminology related to the application:
integration: the method can refer to a process of compiling, publishing and testing by combining codes submitted by all developers in a software development project developed by multiple persons.
Continuous integration: the method can refer to a process that developers frequently submit codes to the main branches, can quickly find errors, quickly locate and solve defects, and is used for reducing the condition of merging conflicts caused by overlarge differences between local codes and main branch codes developed by a plurality of developers.
Delivering: may refer to a process in which a configuration manager delivers the integrated code to a quality control team or a version check team for review.
Deployment: can refer to the process by which project managers deploy code that has completed a review to the production environment, making it user-oriented.
And (3) continuous deployment: the method can refer to a process that codes can be deployed to a production environment at any time after being reviewed by a quality control team or a version check team, namely, the codes delivered by the method can be deployed to the production environment, and the continuous deployment is provided with continuous integration capability, high code quality and high automation degree of version construction.
Branching: it may refer to the code repository holding modification records and the basic units of the overall flow for different versions of code.
Merging: may refer to the process of merging the source version into the target version, i.e., the code deposited by the target version becomes consistent with the source version.
The present application is described below with reference to the accompanying drawings, and fig. 1 is a schematic view of an application scenario provided in an embodiment of the present application, and a code warehouse management method provided by the present application may be applied to the application scenario shown in fig. 1. The application scenario includes: a terminal device 101 of a project manager, a project management platform 102, a first development end 1031, a second development end 1032 and a third development end 1033; specifically, the project manager sends the software development requirement corresponding to the determined development task to the project management platform 102 through the terminal device 101, further, the project management platform 102 creates a code warehouse after receiving the software development requirement sent by the terminal device 101, divides the development task into a plurality of code branches based on the software development requirement, further, distributes the plurality of code branches to corresponding development ends for development, for example, distributes the development task to the first development end 1031, the second development end 1032 and the third development end 1033, so that the first development end 1031, the second development end 1032 and the third development end 1033 develop codes based on the tasks corresponding to the corresponding code branches, and submits the developed code branches to the project management platform 102 for processing, thereby obtaining codes meeting the software development requirement.
It should be noted that, in the embodiment of the present application, the number of code branches included in the code repository, that is, the number of code branches into which the code repository is divided based on software development requirements is not specifically limited, and the foregoing is only an example, which depends on an actual application scenario.
The terminal device may be a wireless terminal or a wired terminal. A wireless terminal may refer to a device providing voice and/or other traffic data connectivity to a user, a handheld device having wireless connectivity capabilities, or other processing device connected to a wireless modem. A wireless terminal, which may be a mobile terminal such as a mobile phone (or called a "cellular" phone) and a computer having a mobile terminal, for example, a portable, pocket, hand-held, computer-included or vehicle-mounted mobile device, may communicate with one or more core Network devices via a Radio Access Network (RAN), and exchange languages and/or data with the RAN. For another example, the Wireless terminal may be a Personal Communication Service (PCS) phone, a cordless phone, a Session Initiation Protocol (SIP) phone, a Wireless Local Loop (WLL) station, a Personal Digital Assistant (PDA), and the like. A wireless Terminal may also be referred to as a system, a Subscriber Unit (Subscriber Unit), a Subscriber Station (Subscriber Station), a Mobile Station (Mobile), a Remote Station (Remote Station), a Remote Terminal (Remote Terminal), an Access Terminal (Access Terminal), a User Terminal (User Terminal), a User Agent (User Agent), and a User Device or User Equipment (User Equipment), which are not limited herein. Optionally, the terminal device may also be a smart phone or other devices.
In a possible implementation manner, when a software development project is performed, a plan is used for driving, namely, project requirements are determined, planning is further performed according to the project requirements, developers required by the development project are evaluated, further, the project requirements are split into requirement items for scheduling, each developer performs respective code development according to the scheduling of the developer, after the developers complete respective code development, configuration managers merge codes developed by all the developers together and release the codes to a test environment for testing, and then the software development project is completed.
However, in the above software development method, each developer develops codes in turn according to their own schedule, and it takes a lot of time for the configuration manager to communicate with all developers, and further, the codes of all developers are merged together, which not only results in low development efficiency, but also requires a lot of communication cost and labor cost.
It should be noted that, in the project end stage, the process of the configuration manager taking days or weeks to merge the codes of all developers together and release them into the test environment may be understood as integration, and the integration occurs after each developer completes the respective code development.
In order to solve the problems, the application provides a code warehouse management method, which uses a code warehouse to reduce the labor consumption of integration, deployment and incremental version delivery, and improve the automation degree of a research and development cycle, defines post responsibility and standardizes operation, thereby realizing a practical mode of advancing integration to the early stage of the development cycle and performing iteration, specifically, code branches which are well defined in advance based on software development requirements can be allocated to developers to develop codes, and for a plurality of code branches with dependency relationship, the code branches can be intelligently combined, the possibility of errors is reduced, the accuracy of the code branches is improved, conflicts are prevented, and under a mode of frequent change of requirements and multi-version iterative parallel development, the steps of integration can be intelligently performed, manual intervention is reduced, the code quality is improved, project management has the capabilities of continuous integration, continuous delivery and continuous deployment, the development efficiency is improved, and the communication cost and the labor cost are saved.
It should be noted that, in the conventional project management, once the project requirement changes, the problem may occur to the overall project management process, and the rhythm of the developer may be disturbed, so the conventional management mode is very sensitive to the change of the requirement and is not suitable for the current internet industry, therefore, the code warehouse management method designed in the present application is implemented based on agile project management, which is a management mode in which the requirement is used as the highest weight and the human cost is adjusted along with the requirement.
The technical solution of the present application will be described in detail below with specific examples. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Fig. 2 is a schematic flowchart of a code repository management method provided in an embodiment of the present application, where the code repository is formed by a plurality of code branches, and as shown in fig. 2, the code repository management method includes the following steps:
s201, creating a code branch corresponding to the code warehouse based on software development requirements, and distributing the code branch to at least one development end for code development.
In this embodiment of the present application, the development end may refer to a terminal device used by a developer, and may also refer to a terminal device corresponding to the project management platform.
In this step, the project management platform may create a code warehouse, further create a code branch corresponding to the code warehouse based on software development requirements, such as create and use a master branch (master) for storing an initialization project, and copy the master branch to create a plurality of code branches as an initial development branch, where the initialization project refers to a code branch already stored in the source code warehouse, the initial development branch may refer to a code branch for storing a corresponding requirement written by a developer based on the software development requirements, and further allocate the created plurality of code branches to at least one development end for code development, that is, each development end may claim 1 or several code branches for development of the corresponding codes.
For example, in the application scenario of fig. 1, after receiving a software development requirement sent by the terminal device 101, the project management platform 102 may divide the development task of this iteration into a plurality of units, that is, create a plurality of code branches, and further allocate the plurality of code branches to the first development end 1031, the second development end 1032, and the third development end 1033 for code development, where a predetermined production date of this task may be set as a version number, and mark a type of the code branch of this task, which may be represented as dev- { version } - { unit }, and if a certain code branch is dev-20220101-chat, the code branch is a created code branch for writing a chat class.
Wherein, no initialization engineering exists in the first time of creating the code warehouse; no code is in the first creation of a code branch; when a code warehouse is created for the second time or later, a code branch exists in the code warehouse, and when a corresponding code branch of the code warehouse is created based on software development requirements, the dev- { previous generation version } branch can be copied to create dev- { current version }, for example, dev-20220101 is copied to create dev-20220102.
It should be noted that, the present application may also determine a development cycle, a test cycle, a start/stop date of a version check cycle, and the like based on a production date, where the specific date of the determination is determined according to a specific situation of a development task, and this is not specifically limited in this embodiment of the present application.
S202, responding to the code development operation of at least one development end, obtaining a target code corresponding to each code development operation, and copying the target code to a corresponding code branch to obtain a target code branch.
In this embodiment of the present application, the code development operation may refer to that the development end performs corresponding code development operation based on an executable function corresponding to the allocated code branch, and if a certain code branch corresponds to a chat function, the code development operation corresponding to the code branch is a code of a related chat function written by a developer, and different development ends correspond to different code development operations.
In this step, in response to a code development operation of at least one development end, a target code corresponding to each code development operation is obtained, where the target code is a corresponding functional code written by a developer, and further, the obtained target code is submitted to a corresponding code branch and copied to obtain a target code branch.
S203, responding to the merging request of the target code branch, and determining whether the target code branch to be merged has a dependency relationship.
In the embodiment of the application, the dependency relationship can refer to the condition that a plurality of development ends develop in parallel in a target code branch, and in the process of research and development by a plurality of persons, codes of the plurality of target code branches may have the dependency relationship, that is, the same file may be modified by the plurality of persons, so that target codes corresponding to each target code branch are submitted in a sequence, and when target codes written by different developers are merged into the target code branches, merging conflicts may occur.
The low version may refer to a low-level version developed by a developer based on a code branch of a certain function, the low-level version has fewer functions, the high version may refer to a high-level version developed by the developer based on a code branch of the same function, the high-level version has more functions, and the file modification time of the high-level version is after that of the low-level version.
It should be noted that, merging conflicts in the integration process not only originate from the codes at the merging development end, but also may exist in the case of parallel development of multiple versions, and if the high version does not merge changes from the low version in time, it may result in that the modification time of the file of the low version is after the code of the high version, and code merging conflicts occur.
And S204, if so, merging the target code branches with the dependency relationship, and performing code test on the merged target code branches to test whether codes in the merged target code branches run normally.
In this application embodiment, the code test may refer to a process of running a code in a target code branch in a specific environment, checking whether the code runs normally, and obtaining a running result.
In this step, the target code branch may initiate a merge request, after the project management platform examines the code of the merge request and checks that the result of the target code branch code test passes, the merge request of the target code branch may be granted, the target code branches with dependencies may be merged, and the merged target code branch may be merged to the main branch.
Optionally, when it is determined that there is no dependency relationship in the target code branches to be merged, the target code branches are summarized, that is, the target code branches are submitted to a main branch for storage, and a relationship between the main branch and the target code branches is a relationship of a structure tree.
Therefore, the code warehouse management method provided by the application can be used for creating the code branch corresponding to the code warehouse based on software development requirements and distributing the code branch to at least one development end for code development; further, responding to the code development operation of at least one development end, acquiring a target code corresponding to each code development operation, and copying the target code to a corresponding code branch to obtain a target code branch; further, responding to the merging request of the target code branch, and determining whether the target code branch to be merged has a dependency relationship; if yes, merging the target code branches with the dependency relationship, and performing code testing on the merged target code branches to test whether codes in the merged target code branches run normally, so that the code branches which are defined in advance based on software development requirements can be used for code development, and aiming at the code branches with the dependency relationship, intelligent merging can be performed, the possibility of errors is reduced, the accuracy of the code branches is improved, when the codes need to be changed, the corresponding code branches are directly called to be changed, the codes in the whole code warehouse do not need to be changed, the development efficiency is improved, and the cost is saved.
Optionally, obtaining a target code corresponding to each code development operation, and copying the target code to a corresponding code branch includes:
acquiring a module branch created by each code development operation, wherein the module branch is used for recording a functional code written by a development end;
performing function test on the function codes in the module branches to obtain target codes; the target code is a code which is qualified in the test;
and uploading the target code to a corresponding code branch, and copying the target code.
In the embodiment of the application, a module branch may refer to a development-end editable module corresponding to a code branch, the module branch is used for recording a function code written by the development end, and feature- { version } - { unit } (module branch) may be created locally according to the dev- { version } branch, for example, the module branch is feature-20220101-chat.
It should be noted that, after a certain software is developed and produced, that is, when the production version deployment is completed, all module branches associated with the current version may be deleted, so that the storage space is saved, and the resource waste is reduced.
In the step, a module branch created by each code development operation can be obtained, taking the module branch as feature-20220101-chat as an example, the function test is carried out on the function code in the feature-20220101-chat branch, and a target code is obtained after the test is passed; further, a merging request that the target code corresponding to the feature-20220101-chat branch is uploaded to the branch dev-20220101 is initiated, after the merging request is confirmed to pass, the target code corresponding to the feature-20220101-chat branch is uploaded to the dev-20220101 is approved, and the target code is copied to the dev-20220101.
Therefore, the method and the device can meet the research and development requirements of multiple people, each development end is not interfered with each other, the functional codes used for the development are written on the module branches, the post responsibility is clear, the codes written by each development end can be tested, and if a problem occurs, errors can be accurately positioned, and the method and the device are suitable for agile research and development.
Optionally, the method further includes:
responding to the change operation of a development end in a module branch, and acquiring a function code corresponding to the change operation;
and re-performing function test on the function code corresponding to the change operation, and obtaining a target code qualified in the test.
In this embodiment of the present application, the modification operation may refer to an operation of modifying a code in a certain module branch by a development end before the software code is not put into operation, or may refer to an operation of creating a module branch (repair branch) when a production environment or an execution code is abnormal and needs to be repaired after the software code is put into operation, and the development end repairs the code in the module branch.
In the step, if the dev-20220101-chat branch requirement is changed, the code of the dev-20220101-chat branch needs to be pulled again for development after backspacing, that is, the module branch feature-20220101-chat branch corresponding to the dev-20220101-chat branch is found, the code in the module branch is modified, the function code corresponding to the modified operation is obtained in response to the modified operation of the development end in the feature-20220101-chat branch, and the function test is performed again on the function code corresponding to the modified operation, so that the target code which is qualified in the test is obtained.
Optionally, when the production environment is abnormal and needs to be repaired, a repair branch (fix) may be created in the main branch, that is, a module branch is created, a code in the module branch is written, further, the code is submitted to a release test environment for testing, after the test is passed, an incremental repair version is generated by using the export update file, and then the production environment is released.
And creating a repair branch, namely code rollback is needed, finding a module branch corresponding to the target code branch, modifying or rewriting, and then releasing the repair branch to the production environment.
Therefore, the method and the device for repairing the code in the module branch can meet the requirement for frequent change of the requirement and the repairing requirement, and only the code in the module branch needs to be modified, so that convenience is improved.
Optionally, the code testing is performed on the merged target code branch, and includes:
acquiring a plurality of target code branches which are merged within preset time, and respectively performing code testing on the plurality of target code branches to verify whether codes in the plurality of target code branches run normally or not;
and after the codes in the target code branches are determined to run normally, performing code test on the combined target code branches.
In this embodiment of the present application, the preset time may refer to a test period set for extracting whether a code in a test target code branch normally operates, and the embodiment of the present application does not limit a specific numerical value corresponding to the preset time, and if the preset time may be one day, the target code branch that has merged the request at that day may be used for an extraction test (a test).
In this step, before merging target code branches, the corresponding target code branches of the merging request can be extracted and tested according to the requirement of the current day, if the extraction and the test are passed, the merged target code branches can be subjected to an integration test to verify whether the codes run normally, wherein if a certain target code branch is not passed, the codes of the target code branch are pulled again to be retrograded and then are developed again, and the merging request is initiated again after the development is completed; if the integration test is not passed, the codes of all the target code branches for merging need to be pulled again for development again after rollback, and the merging request is initiated again after the development is completed.
Therefore, the embodiment of the application can be used for testing the corresponding code branch of the merging request in the preset time and testing the merged target code branch, so that the testing accuracy is improved, and errors are reduced.
Optionally, the method further includes:
acquiring merged target code branches and timestamps corresponding to the merged target code branches every other preset period, and compiling codes in the merged target code branches to obtain release branches;
processing each release branch based on a data mirroring method, and determining whether an updated timestamp and/or an updated code exists in the release branch;
and if so, acquiring the updated timestamp and/or the release branch corresponding to the updated code, and releasing the release branch.
In the embodiment of the present application, the preset period may refer to a set version check period of a target code branch; the timestamp may refer to the time of a partial code update in the target code branch; the data mirroring method may refer to a method of comparing codes one by one, the issue branch may refer to a branch for execution in the execution environment, and the execution code may be stored, and a timestamp corresponding to the issue branch is identical to a timestamp corresponding to the target code branch.
It should be noted that, in the embodiment of the present application, no limitation is imposed on the specific numerical value corresponding to the preset period and the timestamp corresponding to each target code branch.
In this step, the merged target code branch and the timestamp corresponding to each merged target code branch may be obtained at preset intervals, and the codes in the merged target code branch are compiled to obtain release branches (release), which may be used for environment deployment, and further, the release branches may be processed using a data mirroring method, that is, the merged target code branch is compared with the codes in the main branch storage (initialization project) based on a data mirroring command, and a file with a redundant and/or later update time in the release branches is copied as an incremental version, which is a release branch to which codes will be released and is determined according to the newly added codes in the merged target code branch and/or the time corresponding to the newly added codes.
Therefore, the code branch can be modified, the incremental version, namely the new code branch, is generated by one key, the automation degree is high, and the labor cost is saved.
Optionally, the issuing branch includes:
acquiring the operating environment corresponding to the release branch, and configuring and generating a configuration file corresponding to the release branch based on the operating environment;
and generating a software package based on the configuration file and the release branch, and releasing the software package.
In this embodiment of the present application, the runtime environment may refer to an environment in which developed software may be deployed, the software package may refer to a version package in which incremental versions that pass testing are merged, and the version package is used for processing a project task, the configuration file may include an Internet Protocol (IP) address and a timing task execution time of the runtime environment, and the timing task execution time may refer to a set time for regularly executing a release branch, for example, a certain release branch is set to be regularly executed at 12, 18, 00 a day, and the timing execution time may be used all along after being edited.
In this step, taking dev-20220101 branch release as an example, the intelligent release task may be edited, that is, the code of dev-20220101 branch is compiled, the running environment corresponding to the compiled dev-20220101 branch is obtained, the configuration file is modified according to the running environment, so that the configuration file may be deployed to the integrated test environment by using a remote host copy command, and further, a software package is generated based on the compiled dev-20220101 branch and the configuration file, and the software package is released.
It should be noted that after the software package (incremental version) is obtained, the production deployment process may be simulated first, that is, the incremental version is simulated to be released in the version check environment, and an acceptance test is performed, further, after the simulation acceptance test is passed, the version package is uploaded to the project management center for verification, and after the verification is passed, the software package may be deployed in the production environment according to a predetermined production day.
Optionally, on the incremental version commissioning day, when the deployment of the production version is completed, the release branch may be merged to the main branch, and the release branch is marked with a version number (tag), and when a major accident occurs in production and code needs to be rolled back, a repair branch may be created based on the tag of the main branch.
Therefore, the created release branch can be put into production and used, and can be deployed in multiple environments, and the application universality is improved.
It should be noted that, in the conventional project construction mode, each set of operating environment deployment corresponds to one release branch (module), when the number of the operating environments is smaller than that of the modules, the remaining module tests will be blocked, and only after the previous module finishes testing, the next module can perform testing, and the agile project will be subject to the conditions of multiple modules, multiple versions and requirement iteration.
It is understood that after a round of iteration is completed, the next round of iteration can be entered or project development can be ended.
Optionally, the method further includes:
when the codes in the merged target code branches are determined to be abnormal in operation, prompt information is generated and sent to a development end, so that the development end can develop the codes again based on the prompt information, wherein the prompt information comprises the codes abnormal in operation and operation problems.
In the embodiment of the application, the prompt information may refer to set prompt information for prompting that a code of a developer is abnormally operated and corresponds to the abnormal operation, the prompt information includes an abnormally operated code and an operation problem, the operation problem may be a problem expression extracted based on the abnormally operated code, and a specific code branch which is abnormally operated may be located.
In this step, in the application scenario of fig. 1, when the project management platform 102 determines that the code in the merged object code branch is not running normally, prompt information may be generated, for example, "the code in the object code branch written by the first development end 1031 has a problem, the problem code is xxx", and the generated prompt information is sent to the first development end 1031 in the form of a short message, so that the first development end 1031 redevelops the code development based on the prompt information.
Therefore, the method and the device can generate prompt information when the code runs abnormally, prompt the development terminal that the code is abnormal, facilitate the development terminal to correct errors in time, and improve the success rate of writing the code.
With reference to the foregoing embodiment, fig. 3 is a flowchart of a specific code warehouse management method provided in an embodiment of the present application, and as shown in fig. 3, taking creating 2 code branches (development branches) based on software development requirements as an example, the 2 code branches are respectively allocated to 2 development ends for code development, and in a whole development cycle stage, the code warehouse management method includes the following steps:
step A: responding to the code development operations of the 2 development ends, and acquiring a module branch correspondingly created by each code development operation; the module branch corresponding to the research and development branch 2 is a module branch 1, a module branch 2 and a module branch 3, and the module branch corresponding to the research and development branch 1 is a module branch 4, a module branch 5 and a module branch 6; further, performing function test and continuous combination on the function codes in the module branches corresponding to each research and development branch to obtain target codes, and uploading the target codes to the corresponding target code branches for copying; the intelligent synchronization module can be used for merging the low-version target code branches into the high-version target code branches in real time, and the intelligent construction module is used for distributing corresponding running environments to each research and development branch so as to test the research and development branches in parallel.
And B: compiling codes in the target code branches after the function codes are combined to obtain release branches; and comparing the release branches based on a data mirroring method aiming at each release branch, determining the release branches which can be put into production for use, uploading the release branches to the main branch, and releasing the release branches (corresponding to the target code branch 1 and the target code branch 2) based on a set production period.
The code warehouse management method can be realized by an agile project management device based on a code warehouse and a timing task, enables a management flow to be scripted, automated and acquiesced, can reduce communication cost and labor cost, and realizes transformation of a traditional project into an agile project through a version management method.
In the foregoing embodiments, the code warehouse management method provided in the embodiments of the present application is described, and in order to implement each function in the method provided in the embodiments of the present application, the electronic device serving as an execution subject may include a hardware structure and/or a software module, and implement each function in the form of a hardware structure, a software module, or a hardware structure plus a software module. Whether any of the above-described functions is implemented as a hardware structure, a software module, or a hardware structure plus a software module depends upon the particular application and design constraints imposed on the technical solution.
For example, fig. 4 is a schematic structural diagram of a code repository management apparatus provided in an embodiment of the present application, where the code repository is formed by multiple code branches, and as shown in fig. 4, the apparatus includes: a creation module 410, a response module 420, a determination module 430, and a merge module 440; the creating module 410 is configured to create a code branch corresponding to the code repository based on software development requirements, and allocate the code branch to at least one development end for code development;
the response module 420 is configured to respond to code development operations of at least one development end, obtain a target code corresponding to each code development operation, and copy the target code to a corresponding code branch to obtain a target code branch;
the determining module 430 is configured to determine, in response to a merging request of a target code branch, whether a dependency relationship exists in the target code branch to be merged;
the merging module 440 is configured to merge the target code branches with dependency relationships when the target code branches to be merged have dependency relationships, and perform code testing on the merged target code branches to test whether codes in the merged target code branches run normally.
Optionally, the response module 420 is specifically configured to:
acquiring a module branch created by each code development operation, wherein the module branch is used for recording a functional code written by a development end;
performing function test on the function codes in the module branches to obtain target codes; the target code is a code which is qualified in the test;
and uploading the target code to a corresponding code branch, and copying the target code.
Optionally, the apparatus further includes a changing module, where the changing module is configured to:
responding to the change operation of a development end in a module branch, and acquiring a function code corresponding to the change operation;
and performing functional test again on the functional code corresponding to the change operation, and obtaining a target code which is qualified in test.
Optionally, the merging module 440 is specifically configured to:
acquiring a plurality of target code branches which are merged within preset time, and respectively performing code testing on the plurality of target code branches to verify whether codes in the plurality of target code branches run normally or not;
and after the codes in the target code branches are determined to run normally, performing code test on the merged target code branches.
Optionally, the apparatus further includes a compiling module, a processing module, and a publishing module;
the compiling module is used for acquiring the merged target code branches and timestamps corresponding to the merged target code branches every other preset period, and compiling codes in the merged target code branches to obtain issuing branches;
the processing module is used for processing each issuing branch based on a data mirroring method and determining whether the issuing branch has an updated timestamp and/or an updated code;
the issuing module is configured to, when it is determined that the updated timestamp and/or the updated code exists in the issuing branch, obtain the issuing branch corresponding to the updated timestamp and/or the updated code, and issue the issuing branch.
Optionally, the publishing module is specifically configured to:
acquiring the operating environment corresponding to the release branch, and configuring and generating a configuration file corresponding to the release branch based on the operating environment;
and generating a software package based on the configuration file and the release branch, and releasing the software package.
Optionally, the apparatus further includes a reminding module, where the reminding module is configured to:
when the codes in the merged target code branches are determined to be abnormal in operation, prompt information is generated and sent to the development end, so that the development end can re-develop the codes based on the prompt information, wherein the prompt information comprises the codes which are abnormal in operation and operation problems.
For specific implementation principles and effects of the code warehouse management device provided in the embodiment of the present application, reference may be made to relevant descriptions and effects corresponding to the above embodiment, which are not described in detail herein.
An embodiment of the present application further provides a schematic structural diagram of an electronic device, and fig. 5 is a schematic structural diagram of an electronic device provided in an embodiment of the present application, and as shown in fig. 5, the electronic device may include: a processor 501 and a memory 502 communicatively coupled to the processor; the memory 502 stores computer programs; the processor 501 executes the computer program stored in the memory 502, so that the processor 501 executes the method according to any of the above embodiments.
The memory 502 and the processor 501 may be connected by a bus 503.
Embodiments of the present application further provide a computer-readable storage medium, in which computer program execution instructions are stored, and the computer program execution instructions, when executed by a processor, are used to implement the method according to any of the foregoing embodiments of the present application.
The embodiment of the present application further provides a chip for executing the instruction, where the chip is used to execute the method in any of the foregoing embodiments executed by the electronic device in any of the foregoing embodiments of the present application.
Embodiments of the present application further provide a computer program product, which includes program code for performing, when a computer runs the computer program, the method described in any of the foregoing embodiments as performed by an electronic device in any of the foregoing embodiments of the present application.
In the technical scheme of the application, the collection, storage, use, processing, transmission, provision, disclosure and other processing of the related information such as financial data or user data and the like all accord with the regulations of related laws and regulations and do not violate the good custom of the public order.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of modules is merely a division of logical functions, and an actual implementation may have another division, for example, a plurality of modules or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or modules, and may be in an electrical, mechanical or other form.
Modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to implement the solution of the present embodiment.
In addition, functional modules in the embodiments of the present application may be integrated into one processing unit, or each module may exist alone physically, or two or more modules are integrated into one unit. The unit formed by the modules can be realized in a hardware mode, and can also be realized in a mode of hardware and a software functional unit.
The integrated module implemented in the form of a software functional module may be stored in a computer-readable storage medium. The software functional module is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) or a processor to execute some steps of the methods described in the embodiments of the present application.
It should be understood that the Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in the incorporated application may be directly implemented by a hardware processor, or may be implemented by a combination of hardware and software modules in the processor.
The Memory may include a Random Access Memory (RAM), and may further include a Non-volatile Memory (NVM), for example, at least one magnetic disk Memory, and may also be a usb disk, a removable hard disk, a read-only Memory, a magnetic disk or an optical disk.
The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (Extended Industry Standard Architecture) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, the buses in the figures of the present application are not limited to only one bus or one type of bus.
The storage medium may be implemented by any type of volatile or non-volatile Memory device or combination thereof, such as Static Random Access Memory (SRAM), electrically Erasable Programmable Read Only Memory (EEPROM), erasable Programmable Read-Only Memory (EPROM), programmable Read-Only Memory (PROM), read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk or optical disk. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. Of course, the storage medium may also be integral to the processor. The processor and the storage medium may reside in an Application Specific Integrated Circuits (ASIC). Of course, the processor and the storage medium may reside as discrete components in an electronic device or host device.
The above description is only a specific implementation of the embodiments of the present application, but the scope of the embodiments of the present application is not limited thereto, and any changes or substitutions within the technical scope disclosed in the embodiments of the present application should be covered by the scope of the embodiments of the present application. Therefore, the protection scope of the embodiments of the present application shall be subject to the protection scope of the claims.

Claims (11)

1. A method of code repository management, wherein the code repository is formed from a plurality of code branches, the method comprising:
creating a code branch corresponding to the code warehouse based on software development requirements, and distributing the code branch to at least one development end for code development;
responding to code development operation of at least one development end, acquiring a target code corresponding to each code development operation, and copying the target code to a corresponding code branch to obtain a target code branch;
responding to a merging request of the target code branch, and determining whether the target code branch to be merged has a dependency relationship;
if yes, merging the target code branches with the dependency relationship, and performing code testing on the merged target code branches to test whether codes in the merged target code branches run normally.
2. The method of claim 1, wherein obtaining object code corresponding to each code development operation and copying the object code to a corresponding code branch comprises:
acquiring a module branch created by each code development operation, wherein the module branch is used for recording a functional code written by a development end;
performing function test on the function codes in the module branches to obtain target codes; the target code is a code which is qualified in the test;
and uploading the target code to a corresponding code branch, and copying the target code.
3. The method of claim 2, further comprising:
responding to the change operation of a development end in a module branch, and acquiring a function code corresponding to the change operation;
and performing functional test again on the functional code corresponding to the change operation, and obtaining a target code which is qualified in test.
4. The method of claim 1, wherein code testing the merged target code branch comprises:
acquiring a plurality of target code branches which are merged within preset time, and respectively performing code testing on the plurality of target code branches to verify whether codes in the plurality of target code branches normally operate;
and after the codes in the target code branches are determined to run normally, performing code test on the merged target code branches.
5. The method of claim 1, further comprising:
acquiring the merged target code branches and timestamps corresponding to the merged target code branches every other preset period, and compiling codes in the merged target code branches to obtain issuing branches;
processing each issuing branch based on a data mirroring method and determining whether an updated timestamp and/or an updated code exists in the issuing branch;
and if so, acquiring the updated timestamp and/or the release branch corresponding to the updated code, and releasing the release branch.
6. The method of claim 5, wherein publishing the publish branch comprises:
acquiring the operating environment corresponding to the release branch, and configuring and generating a configuration file corresponding to the release branch based on the operating environment;
and generating a software package based on the configuration file and the release branch, and releasing the software package.
7. The method according to any one of claims 1-6, further comprising:
when the codes in the merged target code branches are determined to be abnormal in operation, prompt information is generated and sent to a development end, so that the development end can develop the codes again based on the prompt information, wherein the prompt information comprises the codes abnormal in operation and operation problems.
8. A code repository management apparatus, characterized in that the code repository is constituted by a plurality of code branches, the apparatus comprising:
the creating module is used for creating a code branch corresponding to the code warehouse based on software development requirements and distributing the code branch to at least one development end for code development;
the response module is used for responding to the code development operation of at least one development end, acquiring a target code corresponding to each code development operation, and copying the target code to a corresponding code branch to obtain a target code branch;
the determining module is used for responding to the merging request of the target code branch and determining whether the target code branch to be merged has a dependency relationship;
and the merging module is used for merging the target code branches with the dependency relationship when the target code branches to be merged have the dependency relationship, and performing code test on the merged target code branches to test whether codes in the merged target code branches run normally.
9. An electronic device, comprising: a processor, and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor executes computer-executable instructions stored by the memory to implement the method of any of claims 1-7.
10. A computer-readable storage medium having computer-executable instructions stored thereon, which when executed by a processor, perform the method of any one of claims 1-7.
11. A computer program product comprising a program code for performing the method of any one of claims 1-7 when the computer program is run by a computer.
CN202211142530.0A 2022-09-20 2022-09-20 Code warehouse management method and device, electronic equipment and storage medium Pending CN115904933A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211142530.0A CN115904933A (en) 2022-09-20 2022-09-20 Code warehouse management method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211142530.0A CN115904933A (en) 2022-09-20 2022-09-20 Code warehouse management method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115904933A true CN115904933A (en) 2023-04-04

Family

ID=86484814

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211142530.0A Pending CN115904933A (en) 2022-09-20 2022-09-20 Code warehouse management method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115904933A (en)

Similar Documents

Publication Publication Date Title
US10572249B2 (en) Software kit release management
US9946517B2 (en) Dynamic model based software application development
JP3329841B2 (en) Network system and its software management method
US8677348B1 (en) Method and apparatus for determining least risk install order of software patches
CN109086071A (en) A kind of method and server of management software version information
CN108776643B (en) Target code merging control method and system based on version control process
CN110727575B (en) Information processing method, system, device and storage medium
CN112764753A (en) Project deployment method and device, electronic equipment and storage medium
CN101753619B (en) Method and system for extending service model
CN109445800B (en) Version automatic deployment method and system based on distributed system
CN110865806A (en) Code processing method, device, server and storage medium
CN117111907A (en) Software development system
US9396239B2 (en) Compiling method, storage medium and compiling apparatus
CN115904933A (en) Code warehouse management method and device, electronic equipment and storage medium
CN113741931B (en) Software upgrading method and device, electronic equipment and readable storage medium
CN111142923B (en) Patch management method and system
CN113918162A (en) Front-end code automatic checking method based on centralized management mode
CN113688028A (en) Code submission method and device
Sporer et al. Incorporation of model-based system and software development environments
CN112948480B (en) Data extraction method, device, electronic equipment and storage medium
CN110175116B (en) Test date switching method, device and system
US20230359547A1 (en) Targeted Testing for Modular Software Applications
CN109002287B (en) Management method and device for software in cloud data system
US20230136623A1 (en) Infrastructure quality assurance framework
CN118227193A (en) Version construction method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination