Code hosting platform management method and device, computer device and storage medium
By monitoring and configuring task processes on a code hosting platform, customizing running modules, and automatically executing task events, this technology solves the problems of existing runner scripts being unable to adapt to different situations and developers needing to constantly monitor task results, thus achieving efficient task execution and automatic code merging events.
Patent Information
- Application Number
- CN202010964414.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-15
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2040-09-15
AI Technical Summary
Existing code hosting platforms cannot run custom runner scripts, making them unable to adapt to task events under different circumstances. At the same time, developers need to constantly monitor the execution results of pipeline tasks, resulting in a heavy workload.
By listening to events on the code hosting platform, configuring task processes to customize running modules, automatically executing unexecuted task events, adding execution tags to the task library to avoid duplicate execution, and listening to the review and inspection status of pull requests to automatically merge code events.
It enables the flexibility of customizing the runner, improves task execution efficiency, reduces server computing power waste, automatically merges code events, and improves the work efficiency of developers.
Smart Images

Figure CN112099843B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer research and development management, and particularly relates to a code hosting platform management method and device, computer equipment and a storage medium. BACKGROUND
[0002] The sustainable integration application is applied to a code hosting platform (such as Gitlab and GitHub), which is an important link for project management in the industry at present. Real-time and reasonable CI can effectively help to detect the correctness and standardization of the submitted code. Therefore, after building a CI standardization work platform, the developer can monitor the state of CI, detailed logs, timely merge PullRequest, close Issues and other operations.
[0003] The sustainable integration platform in the industry at present cannot provide an automatic Actions function, that is, automatically executing a task event generated by a code event. The developer needs to call an external running module to run the task event to obtain an execution result.
[0004] However, the inventor realizes that the external running module usually cannot run a custom runner script, that is, the running module with the custom runner script cannot adapt to the task event under different conditions. At the same time, since the current method for merging the pull request code event usually needs the developer to pay attention to the merging on the code hosting platform, the current developer needs to pay attention to the execution result of each pipeline task at all times to timely merge the code event of the pull request type, which brings great inconvenience to the development work. SUMMARY
[0005] The present application provides a code hosting platform management method, device, computer equipment and storage medium, which can solve the problem that the existing technology cannot run a custom runner script, which cannot adapt to the task event under different conditions, and the problem that the current developer needs to pay attention to the execution result of each pipeline task at all times due to manual merging, which brings great inconvenience to the development work.
[0006] To achieve the above-mentioned purpose, the present application provides a code hosting platform management method, comprising:
[0007] listening to whether a code event is received by the code hosting platform;
[0008] If the code hosting platform receives a code event, a task process is performed to configure the code event according to preset integration configuration information to obtain a task event, wherein the integration configuration information defines a method of scheduling and triggering a preset running module, and a method of obtaining an execution result of the task event;
[0009] The running module is called to execute a task event in the task library with an execution state of unexecuted, and an execution result of the task event is obtained;
[0010] The review state and the check state of the code event of the pull request type in the code hosting platform are listened to; if the review states are all agreed and the check state is successful, the code event is merged according to the execution result.
[0011] In the above scheme, the step of calling the running module to execute a task event in the task library with an execution state of unexecuted, and obtaining an execution result of the task event, comprises:
[0012] The label information and the associated group information sent by the control end are received;
[0013] The label information and the associated group information are written into a label of the running module, wherein the label can write at least one label information and associated group information;
[0014] The running module is called to execute a pipeline task in the task library corresponding to the task label and the associated group label of the running module and with an execution state of unexecuted, and an execution result of the pipeline task is obtained;
[0015] The execution results of the pipeline tasks in the task event are summarized to obtain an execution result of the task event.
[0016] In the above scheme, the step of calling the running module to execute a pipeline task in the task library corresponding to the task label and the associated group label of the running module and with an execution state of unexecuted, and obtaining an execution result of the pipeline task, comprises:
[0017] A running module with an idle running state is identified;
[0018] The running module is called to execute a pipeline task in the task library corresponding to the task label and the associated group label of the running module and with an execution state of unexecuted, and the execution state of the pipeline task in the task library is modified to be in execution;
[0019] monitoring progress of the running module in executing the pipeline task, and if the running module completes the pipeline task, obtaining an execution result of the pipeline task and modifying an execution state of the pipeline task to executed;
[0020] identifying whether the pipeline task in the task event is of a type of pull request, and if yes, synchronizing the execution result of the pipeline task to a checking module of a code hosting platform.
[0021] In the above scheme, after the running module is invoked to execute the task event with an execution state of unexecuted in the task library and the execution result of the task event is obtained, the following steps are included:
[0022] extracting a running log generated by the running module in executing the task event, summarizing basic information of the task event, the execution result and the running log to form event data, and extracting a running state and a running content of the running module to obtain module data, wherein the basic information of the task event includes generation time of the task event, submitted information, Commit SHA and execution state, the running state reflects a current working state of the running module, and the running content describes a task event or a pipeline task currently executed by the running module.
[0023] In the above scheme, after the running module is invoked to execute the task event with an execution state of unexecuted in the task library and the execution result of the task event is obtained, the following steps are included:
[0024] receiving control information sent by a control end, and controlling the running module to re-execute the task event with the execution result of failure or execution timeout or to cancel the task event being executed according to the control information.
[0025] In the above scheme, the step of merging the code events according to the execution result includes:
[0026] summarizing the code events belonging to the same project to form an event set;
[0027] judging whether the execution results of the code events in the event set are all passed;
[0028] if the execution results are all passed, invoking a merging module in the code hosting platform to merge the code events in the event set, obtaining a target code event and sending the target code event to the code hosting platform;
[0029] if at least one execution result is failed, returning a merging rejection information to the control end and the code hosting platform.
[0030] According to the execution result, the code events are merged, and the following steps are included:
[0031] Transaction information is obtained from a code hosting platform, and a project corresponding to the transaction information is identified, and integrated configuration information of the project is extracted; change information generated by the code hosting platform according to the transaction information is listened to, a preset closing rule in the integrated configuration information is extracted, and it is judged whether the change information conforms to the closing rule; if yes, the transaction information is closed; if not, a closing rejection information is returned to a control end and the code hosting platform;
[0032] According to the execution result, the code events are merged, and the following steps are included:
[0033] The merged code events are uploaded to a block chain.
[0034] To achieve the above object, the application further provides a code hosting platform management device, which comprises:
[0035] An event listening module is configured to listen to whether a code hosting platform receives a code event;
[0036] An event configuration module is configured to execute a task process to configure the code event to obtain a task event according to preset integrated configuration information when the code hosting platform receives the code event, wherein the integrated configuration information defines a method of scheduling and triggering a preset running module, and a method of obtaining an execution result by executing the task event;
[0037] An event execution module is configured to call a running module to execute a task event in a task library with an execution state of unexecuted, and obtain an execution result of the task event;
[0038] A listening and merging module is configured to listen to a review state and a check state of a code event of a pull request type in the code hosting platform; if the review state is all agreed and the check state is successful, the code events are merged according to the execution result.
[0039] To achieve the above object, the application further provides a computer device, which comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor of the computer device executes the computer program to realize the steps of the above code hosting platform management method.
[0040] To achieve the above object, the application further provides a computer storage medium, which stores a computer program, and the computer program stored in the computer storage medium is executed by a processor to realize the steps of the above code hosting platform management method.
[0041] The application provides a code hosting platform management method and device, computer equipment and a storage medium. The application listens to the received event of the project of the code hosting platform to ensure that the code event of the code hosting platform can be learned in time, and the event of the platform can be processed in time. The application integrates configuration information to achieve the technical effect of customizing a runner, expands the use range, and ensures the flexibility of the runner. The application calls a running module to execute a task event in a task library and obtains a corresponding execution result to ensure the effectiveness of the code, achieve the technical effect of automatically executing the task event, and add an execution tag reflecting the execution state of the task event to the task event in the task library to ensure that the running module only executes the unexecuted task event and avoid the repeated execution of the task event in the task library, which causes the waste of server computing power. The application listens to the review state and the check state of the code event and merges the code event to achieve the technical effect of automatically merging the code event, improve the efficiency of the code merging work, avoid the current developer needing to pay attention to the execution result of each pipeline task at all times, and timely merge the code event of the pull request type, which causes the problem of heavy work of the developer. BRIEF DESCRIPTION OF DRAWINGS
[0042] Figure 1 The flowchart of the code hosting platform management method embodiment one of the application;
[0043] Figure 2 The environment application schematic diagram of the code hosting platform management method in the code hosting platform management method embodiment two of the application;
[0044] Figure 3 The specific method flowchart of the code hosting platform management method in the code hosting platform management method embodiment two of the application;
[0045] Figure 4 The flowchart of calling the running module to execute the task event with the unexecuted execution state in the task library and obtaining the execution result of the task event in the code hosting platform management method embodiment two of the application;
[0046] Figure 5 The flowchart of calling the running module to execute the pipeline task corresponding to the task tag and the associated group tag of the running module and with the unexecuted execution state in the task library and obtaining the execution result of the pipeline task in the code hosting platform management method embodiment two of the application;
[0047] Figure 6 The flowchart of merging the code event according to the execution result in the code hosting platform management method embodiment two of the application;
[0048] Figure 7 Figure 3 is a schematic diagram of program modules for the code hosting platform management device of the third embodiment of the present application;
[0049] Figure 8 Figure 4 is a schematic diagram of the hardware structure of the computer device of the fourth embodiment of the present application. DETAILED DESCRIPTION
[0050] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of the present application.
[0051] The following embodiments are provided:
[0052] Embodiment 1
[0053] Please refer to Figure 1 The code hosting platform management method of the present embodiment comprises the following steps:
[0054] S102: Listen to whether the code hosting platform receives a code event;
[0055] S103: If the code hosting platform receives a code event, execute a task process to configure the code event according to preset integration configuration information to obtain a task event, wherein the integration configuration information defines a method of scheduling and triggering a preset running module, and a method of obtaining an execution result by executing the task event;
[0056] S104: Call the running module to execute a task event with an execution state of unexecuted in the task library, and obtain the execution result of the task event;
[0057] S108: Listen to the review state and the check state of the code event of the pull request type in the code hosting platform; if the review state is all agreed and the check state is successful, merge the code event according to the execution result.
[0058] In the example embodiment, the events of the project received by the code hosting platform are monitored in real time by calling the webhook of the code hosting platform, so as to ensure that the code events (for example, push and pull request events) of the code hosting platform can be learned in time, and the events of the platform can be processed in time (for example, merging and closing issues). The types of the code events include push and pull request. The integration configuration information is a ci.yml file, wherein the ci.yml configuration includes a ci-server execution script and a ci-runner execution script; the ci-server execution script defines a method of scheduling and triggering a running module; and the ci-runner execution script defines a method of obtaining an execution result of a task event (for example, testing, compiling, packaging, etc.). Therefore, the technical effect of customizing a running runner is achieved by the integration configuration information, the use range is expanded, and the flexibility of the running runner is ensured.
[0059] The technical effect of automatically executing a task event is achieved by calling a running module to execute a task event in a task library and obtaining a corresponding execution result. In order to avoid repeatedly executing the task event in the task library and wasting server computing power, an execution tag reflecting the execution state of the task event is added to the task event in the task library, and the execution tag includes unexecuted, executed and executing, so as to ensure that the running module only executes the unexecuted task event.
[0060] The technical effect of automatically merging a code event is achieved by monitoring the review state and the check state of the code event of the pull request type in the code hosting platform, and merging the code event if the review state is agreed and the check state is successful. The efficiency of the code merging work is improved, and the problem that the current developer needs to pay attention to the execution result of each pipeline task at all times and timely merge the code event of the pull request type, resulting in heavy work of the developer, is avoided.
[0061] Embodiment two:
[0062] The embodiment is a specific application scenario of the above-mentioned embodiment one, and the method provided by the application can be more clearly and specifically described by the embodiment.
[0063] Below, taking the example of configuring the code event in the server running the code hosting platform management method to obtain the task event and executing the task event to obtain the execution result of the task event, and monitoring the review state and check state of the code event of the pull request type, and merging the code event, to specifically describe the method provided in the embodiment. It should be noted that the embodiment is only exemplary and does not limit the scope of the embodiments of the present application.
[0064] Figure 2 The environment application schematic diagram of the code hosting platform management method according to Embodiment Two of the present application is schematically shown.
[0065] In the exemplary embodiment, the server 2 where the code hosting platform management method is located is connected to the code hosting platform 3, the control end 4 and the sending end 5 through the network; the server 2 can provide services through one or more networks, and the network can include various network devices, such as routers, switches, multiplexers, hubs, modems, bridges, repeaters, firewalls, proxy devices and / or the like. The network can include physical links, such as coaxial cable links, twisted pair cable links, fiber optic links, combinations thereof and / or the like. The network can include wireless links, such as cellular links, satellite links, Wi-Fi links and / or the like; the control end 4 and the sending end 5 can be computer devices such as smartphones, tablets, notebooks, desktop computers and the like.
[0066] Figure 3 is a specific method flowchart of a code hosting platform management method provided by an embodiment of the present application, and the method specifically includes steps S201 to S209.
[0067] S201: Obtain the runner code base and install to obtain the running module, and create a data extraction interface.
[0068] Since the actions of the current code hosting platform (such as: github or GitHub) are to issue tasks to the cloud service prepared by the platform, they cannot be deployed to the local machine in the intranet, so the execution of the task event needs to be performed on the cloud service, so that the local server needs to upload the corresponding task event to the cloud service, and the action in the cloud service can obtain the required execution result, which reduces the execution efficiency of the task event of the local server, therefore, in order to improve the execution efficiency of the task event of the local server, the step obtains the runner code library (such as: the source code of the runner), and executes the installation script in the runner code library, so that the local server installs the running module of the runner code library, so as to realize the effect of executing the task event in the local server, improve the execution efficiency of the task event, and solve the problem of calling the action in the cloud service. The runner code library can be the source code of the open source version of GitHub Actions.
[0069] It should be noted that the actions of the code hosting platform can include: code grabbing, test running, remote server login, and publishing to third-party services.
[0070] In order to facilitate the main panel of the control end to obtain the task event execution situation, the step creates a data extraction result to facilitate the main panel to extract the data of the task event execution situation. In the present embodiment, Datas API can be used as the data extraction interface.
[0071] S202: Listen whether the code hosting platform receives the code event.
[0072] In order to ensure that the code event (such as: push, pull request event) of the code hosting platform can be learned in time, so as to ensure that the event of the platform can be processed in time (such as: merging, closing issues), the step calls the webhook of the code hosting platform to listen to the event of the project received by GitHub.
[0073] It should be noted that webhook is an API concept, which is one of the usage paradigms of microservice API, and is also called reverse API, that is, the front end does not actively send a request, and the back end is completely pushed. WebHook is a URL that receives HTTP POST (or GET, PUT, DELETE). An API provider that implements WebHook is to send a message to the configured URL when an event occurs. In the present embodiment, the URL can be set as the address of the local server to realize the technical effect of listening whether the code hosting platform receives the code event.
[0074] S203: If the code event is received by the code hosting platform, a task process is performed to configure the code event to obtain a task event according to preset integration configuration information, wherein the integration configuration information defines a method of scheduling and triggering a running module, and a method of obtaining an execution result of the task event.
[0075] In this embodiment, the types of the code event include push and pull request. The integration configuration information is a ci.yml file, wherein the ci.yml configuration includes a ci-server execution script and a ci-runner execution script; the ci-server execution script defines the method of scheduling and triggering the running module; and the ci-runner execution script defines the method of obtaining the execution result of the task event (such as testing, compiling, packaging, etc.).
[0076] For example, a project corresponding to the received code event of the type of push or pull request is extracted, such as a ProjectA project; a ci.yml file of the ProjectA project is extracted, and the code event of push or pull request is configured according to the ci.yml file to obtain a task event, wherein the task event includes at least one pipeline task, such as pipeline task 1 and pipeline task 2; the pipeline task is a task unit (such as a job) generated by configuring the code event according to the integration configuration information.
[0077] In a preferred embodiment, before extracting the integration configuration information of the project where the code event is located, the following steps are included:
[0078] It is determined whether the project where the code event is located has integration configuration information; if yes, the task process is called; and if no, the task is ended.
[0079] In a preferred embodiment, the task process includes:
[0080] The integration configuration information of the project where the code event is located is extracted.
[0081] The code event is configured in sequence according to the integration configuration information to generate a pipeline task, and the type of the pipeline task includes push and pull request.
[0082] The pipeline tasks are summarized to obtain a task event of the project.
[0083] Further, if the project receives a new code event of a new type of pull request, a new pipeline task is generated according to the integration configuration information of the project and is loaded into the task event corresponding to the project.
[0084] For example, a new code event of a pull request, such as a commit event, is received, and the project where the code event is located is Project A; according to the integration configuration information, the new code event is configured to obtain pipeline task 3, and pipeline task 3 is loaded into the task event of Project A, so that the task event includes pipeline task 1, pipeline task 2 and pipeline task 3.
[0085] In this embodiment, the execution state of the pipeline task in the task event obtained by the task process is by default not executed, i.e., pending state.
[0086] S204: calling a running module to execute the task event with an execution state of not executed in the task library and obtaining an execution result of the task event.
[0087] To implement the execution of the task event to ensure the effectiveness of the code, this step executes the task event in the task library by calling the running module and obtains the corresponding execution result. To avoid repeated execution of the task event in the task library, which leads to waste of server computing power, this step adds an execution tag reflecting the execution state of the task event to the task event in the task library, the execution tag including not executed, executed and executing, to ensure that the running module only executes the task event that is not executed.
[0088] Preferably, the running module can add a task tag and an associated group tag to implement the many-to-many association relationship between the running module and each project in the code hosting platform, wherein the task tag is the number of the pipeline task in the task event, and the associated group tag is the number of the group where the project is located.
[0089] For example, the code hosting platform has Project A of h5 group, and the task events of pipeline task 1 and pipeline task 2 are generated, so if a running module, such as runner 1, needs to execute pipeline task 1 and pipeline task 2 of the project, the associated group tag h5, the task tag pipeline task 1 and the task tag pipeline task 2 are added in runner 1, and the running module supports association with multiple groups and multiple tags.
[0090] In a preferred embodiment, please refer toFigure 4 The step of calling the running module to execute the task event in the task library with an execution state of unexecuted and obtaining an execution result of the task event includes:
[0091] S41: receiving label information and association group information sent by a control end.
[0092] S42: writing the label information and the association group information into a label of the running module, wherein the label can write at least one label information and association group information.
[0093] S43: calling the running module to execute a pipeline task corresponding to the task label and the association group label of the running module in the task library and with an execution state of unexecuted, and obtaining an execution result of the pipeline task.
[0094] S44: summarizing the execution results of the pipeline tasks in the task event to obtain an execution result of the task event.
[0095] Through the method, the many-to-many binding of the pipeline tasks of multiple projects and multiple running modules runner is realized, that is, one project can correspond to multiple runners, when multiple pipeline tasks are generated in the project, multiple running modules runner simultaneously execute different pipeline tasks, and the concurrent running capability is improved; and one running module runner can correspond to multiple projects, when a small number of task events are generated in the project, only one running module is executed to execute all pipeline tasks, and the situation that multiple running modules are simultaneously enabled to execute a small number of pipeline tasks to cause the waste of local server computing power is avoided.
[0096] Preferably, the running state of the running module includes busy, idle, and offline. The type of the pipeline task includes push and pull request.
[0097] In a preferred embodiment, referring to Figure 5 The step of calling the running module to execute the task event in the task library with an execution state of unexecuted and obtaining an execution result of the task event includes:
[0098] S43-1: identifying the running module with an idle running state;
[0099] S43-2: calling the running module to execute the pipeline task in the task library corresponding to the task tag and the associated group tag of the running module, and the execution state of the pipeline task in the task library is modified to executing.
[0100] S43-3: monitoring the progress of the running module executing the pipeline task, if the running module completes the execution of the pipeline task, obtaining the execution result of the pipeline task, and modifying the execution state of the pipeline task to executed.
[0101] S43-4: identifying whether there is a pipeline task of type pull request in the task event.
[0102] S43-5: if yes, synchronizing the execution result of the pipeline task to the check module of the code hosting platform.
[0103] S43-6: if no, ending.
[0104] Exemplarily, if the task event has a pipeline task of type pull request, for example: pipeline task 2, the execution result of the pipeline task 2 is synchronized to the check event of the check module of the code hosting platform of github or gitlab, so that the reviewer can see the execution result of the pipeline task of each pull request during code review.
[0105] By the above method, the running module in idle state is identified to execute the task event, so that the running module will not crash or die due to excessive load, and the stability of the local server is improved.
[0106] S205: extracting the running log generated by the running module executing the task event, summarizing the basic information, execution result and running log of the task event to form event data, extracting the running state and running content of the running module to obtain module data, wherein the basic information of the task event includes the generation time of the task event, the submitted information, CommitSHA and execution state, the running state reflects the current working state of the running module, and the running content describes the task event or pipeline task currently executed by the running module.
[0107] In this step, the running state of the running module includes busy, idle and offline.
[0108] It is to be noted that the COMMIT command is used to save the modifications made by the transaction to the database, and it saves all the transactions after the last COMMIT or ROLLBACK command to the database. Each time the commit command is used, a 40-bit hash value is generated in the database, which is also called a commit-id. The hash value is usually calculated by the SHA algorithm, so the commit SHA is the commit-id. SHA (Secure Hash Algorithm) is a series of cryptographic hash functions designed by the National Security Agency (NSA) of the United States and published by the National Institute of Standards and Technology (NIST). The commit SHA is very useful when version rollback, which is equivalent to a snapshot, and can be returned here at any time in the future through a combination command with git reset.
[0109] S206: receiving the user information sent by the control terminal, obtaining the permission range of the control terminal according to the user information, and sending the module data and the event data to the control terminal according to the permission range.
[0110] In this embodiment, the main panel of the control terminal can obtain the module data of the runner and the event data of the task event through the data extraction interface.
[0111] S207: receiving the control information sent by the control terminal, and controlling the runner to re-execute the task event with a failed execution result or an execution timeout, or cancel the task event being executed according to the control information.
[0112] In order to facilitate the operator of the control terminal to control the task event and the pipeline task in the runner, this step receives the control information sent by the control terminal, and controls the runner to re-execute the task event with a failed execution result or an execution timeout, or cancel the task event being executed according to the control information.
[0113] Further, the control information includes re-execution information and cancellation information.
[0114] According to the re-execution information, the runner is controlled to re-execute the task event with a failed execution result or an execution timeout, and according to the cancellation information, the task event being executed is cancelled.
[0115] The re-execution information and the cancellation information can be obtained by the user clicking the “re-execute” button and the “cancel” button on the control terminal.
[0116] S208: Listen to the review state and check state of the code event of the pull request type in the code hosting platform; if the review state is all agreed and the check state is successful, merge the code event according to the execution result.
[0117] To avoid the current developer needs to keep abreast of the execution result of each pipeline task, and timely merge the code event of the pull request type, resulting in the problem of heavy work of the developer, this step listens to the review state and check state of the code event of the pull request type in the code hosting platform; if the review state is all agreed and the check state is successful, merge the code event, to realize the automatic merging of the code event of the pull request type, and improve the efficiency of the code merging work.
[0118] In this embodiment, the review state includes agree and disagree, and the check state includes success and failure. It should be noted that the review module of the code hosting platform is used to review the code event, and the Check module is used to check the code event. Since the review module and the Check module are common modules of the code hosting platform, they will not be described in detail in this application.
[0119] Further, by calling the webhook of the code hosting platform, the result message generated by the code hosting platform in the review and check of the code event is listened to, and the result message includes the event code of the code event, and the review state and the check state of the code event.
[0120] The review state and the check state are extracted, and if the review state is all agreed and the check state is successful, the task event corresponding to the event code is extracted, and the execution result of the task event is obtained.
[0121] In a preferred embodiment, please refer to Figure 6 According to the execution result, the step of merging the code event includes:
[0122] S81: The code events belonging to the same project are summarized to form an event set.
[0123] S82: Determine whether the execution result of each code event in the event set is passed.
[0124] S83: If all are passed, call the merging module in the code hosting platform to merge the code events in the event set, obtain the target code event and send it to the code hosting platform.
[0125] S84: If at least one execution result is failed, return a merge rejection information to the control terminal and the code hosting platform.
[0126] In this embodiment, since the code events of the same project are aggregated, the code events of other projects are avoided from mixing into the event set of the project, and the accuracy of obtaining the target code event is ensured.
[0127] The merge module is a merge module of the code hosting platform, which is used to merge the code events of the pull request type. Since the merge module is a prior art, the technical problem to be solved by the present application is how to realize the automatic merging of the code events. Therefore, the specific technical principle of the merge module for merging the code events will not be described herein.
[0128] Preferably, after merging the code events according to the execution result, the method further comprises:
[0129] Uploading the merged code events to a blockchain.
[0130] It should be noted that the corresponding summary information is obtained based on the merged code events. Specifically, the summary information is obtained by hashing the merged code events, for example, by using the sha256s algorithm. Uploading the summary information to the blockchain can ensure its security and fairness and transparency to the user. The user device can download the summary information from the blockchain to verify whether the merged code events have been tampered with. The blockchain referred to in this example is a new application mode of computer technology such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithm. Blockchain, in essence, is a decentralized database, which is a series of data blocks associated using cryptographic methods, each data block containing information about a batch of network transactions, used to verify the validity (anti-fake) of the information and generate the next block. The blockchain can include a blockchain underlying platform, a platform product service layer, and an application service layer.
[0131] S209: Obtain transaction information from the code hosting platform, identify a project corresponding to the transaction information, and extract integration configuration information of the project; listen to change information generated by the code hosting platform based on the transaction information, extract a preset closing rule in the integration configuration information, and determine whether the change information meets the closing rule; if yes, close the transaction information; if no, return a closing rejection information to the control terminal and the code hosting platform.
[0132] In order to avoid a large number of closable transaction information displayed in the code hosting platform, resulting in code event display confusion, making the developer has to repeat the execution of closing, this step obtains transaction information from the code hosting platform and identifies the project corresponding to the transaction information, extracts the integration configuration information of the project, listens to the change information generated by the code hosting platform according to the transaction information, extracts the closing rule in the integration configuration information, and judges whether the change information conforms to the closing rule; if it conforms, the transaction information is closed. At the same time, this step also increases the closing rule in the integration configuration information, so that the operation of closing the transaction information is more in line with the actual needs of the code hosting platform.
[0133] The closing rule can be an examination of the sending end of the change information. If the sending end is a user in the preset whitelist in the closing rule, the change information is determined to have authority, and therefore conforms to the closing rule.
[0134] In the Figure 3 , the S209 is displayed with the following annotations:
[0135] S209-1: obtaining transaction information from the code hosting platform and identifying the project corresponding to the transaction information, and extracting the integration configuration information of the project;
[0136] S209-2: listening to the change information generated by the code hosting platform according to the transaction information;
[0137] S209-3: extracting the preset closing rule in the integration configuration information, and judging whether the change information conforms to the closing rule;
[0138] S209-4: if it conforms, the transaction information is closed;
[0139] S209-5: if it does not conform, return a closing rejection information to the control end and the code hosting platform.
[0140] Embodiment three:
[0141] Please refer to Figure 7 , a code hosting platform management device 1 of the embodiment comprises:
[0142] An event listening module 12 is configured to listen to whether the code hosting platform receives a code event;
[0143] An event configuration module 13 is configured to execute a task process to configure the code event to obtain a task event according to preset integration configuration information when the code hosting platform receives a code event, wherein the integration configuration information defines a method of scheduling and triggering a preset running module, and a method of obtaining an execution result by executing a task event;
[0144] An event execution module 14 is configured to invoke the running module to execute a task event with an execution state of unexecuted in the task library, and obtain an execution result of the task event.
[0145] A listening and merging module 18 is configured to listen to review states and check states of a code event of a pull request type in the code hosting platform. If the review states are all agreed and the check state is successful, the code event is merged according to the execution result.
[0146] Optionally, the code hosting platform management apparatus 1 further comprises:
[0147] An installation management module 11 is configured to obtain a runner code library, install a running module obtained from the runner code library, and create a data extraction interface.
[0148] Optionally, the code hosting platform management apparatus 1 further comprises:
[0149] A log management module 15 is configured to extract a running log generated by the running module in executing a task event, aggregate basic information of the task event, an execution result and the running log to form event data, and extract a running state and a running content of the running module to obtain module data. The basic information of the task event includes a generation time of the task event, submitted information, a commit SHA and an execution state. The running state reflects a current working state of the running module, and the running content describes a task event or a pipeline task currently executed by the running module.
[0150] Optionally, the code hosting platform management apparatus 1 further comprises:
[0151] A permission management module 16 is configured to receive user information sent by a control terminal, obtain a permission range of the control terminal according to the user information, and send module data and event data to the control terminal according to the permission range.
[0152] Optionally, the code hosting platform management apparatus 1 further comprises:
[0153] An event control module 17 is configured to receive control information sent by a control terminal, and control the running module to re-execute a task event with a failed execution result or an execution timeout, or cancel a task event being executed, according to the control information.
[0154] Optionally, the code hosting platform management apparatus 1 further comprises:
[0155] The transaction closing module 19 is used for obtaining transaction information from the code hosting platform, identifying a project corresponding to the transaction information, extracting integrated configuration information of the project, listening to change information generated by the code hosting platform according to the transaction information, extracting a preset closing rule in the integrated configuration information, and judging whether the change information meets the closing rule; if yes, the transaction information is closed; if not, a closing rejection information is returned to the control end and the code hosting platform.
[0156] The technical solution is applied to the development field of research and development management, and the listening to whether the code hosting platform receives a code event is constructed, a task process is executed to configure a task event according to preset integrated configuration information of the code event, an execution result of a task event with an execution state of unexecuted in a task library is obtained by calling a running module, and a code quality tool of a code event with a review state and an inspection state of a pull request type in the code hosting platform is listened to and merged, so as to assist a developer in development.
[0157] Embodiment four
[0158] To achieve the above object, the application further provides a computer device 6, components of the code hosting platform management device 1 of the embodiment three can be dispersed in different computer devices, and the computer device 6 can be a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server or a cabinet server (including a stand-alone server or a server cluster composed of multiple application servers) and the like executing a program. The computer device of the embodiment at least includes but is not limited to a memory 61, a processor 62 and the like which can be connected to each other through a system bus as shown in the figure. Figure 8 It should be pointed out that, Figure 8 Only the computer device with components is shown, but it should be understood that all the shown components are not required to be implemented, and more or less components can be alternatively implemented.
[0159] The memory 61 (i.e., a storage medium) in the embodiment includes a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 61 can be an internal storage unit of the computer device, such as a hard disk or a memory of the computer device. In other embodiments, the memory 61 can also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device. Of course, the memory 61 can also include both the internal storage unit and the external storage device of the computer device. In the embodiment, the memory 61 is generally used to store an operating system and various application software installed on the computer device, such as the program code of the code hosting platform management apparatus of the third embodiment, etc. In addition, the memory 61 can also be used to temporarily store various data that has been output or will be output.
[0160] The processor 62 in some embodiments can be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 62 is generally used to control the overall operation of the computer device. In the embodiment, the processor 62 is used to run the program code or process data stored in the memory 61, such as running the code hosting platform management apparatus to implement the code hosting platform management method of the first embodiment and the second embodiment.
[0161] Embodiment five:
[0162] To achieve the above object, the application further provides a computer storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, a server, an App application mall, etc., on which a computer program is stored. The program is executed by the processor 62 to implement the corresponding function. The computer storage medium of the embodiment is used to store the code hosting platform management apparatus, which is executed by the processor 62 to implement the code hosting platform management method of the first embodiment and the second embodiment.
[0163] The above embodiment numbers of the application are only for description, and do not represent the advantages and disadvantages of the embodiments.
[0164] Through the above description of the embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be realized by means of software and necessary general hardware platforms, and of course, they can also be realized by hardware, but in many cases, the former is a better embodiment.
[0165] The above are only preferred embodiments of the present application, and do not limit the patent scope of the present application, and any equivalent structure or equivalent process transformation made by using the content of the specification and drawings of the present application, or directly or indirectly applied to other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A code hosting platform management method, characterized in that, The method comprises the following steps: monitoring whether a code event is received by a code hosting platform; if the code event is received by the code hosting platform, executing a task process to configure the code event according to preset integration configuration information to obtain a task event, wherein the integration configuration information defines a method of scheduling and triggering a preset running module and a method of executing the task event to obtain an execution result; before extracting the integration configuration information of a project in which the code event is located, the method comprises the following steps: determining whether the project in which the code event is located has integration configuration information; if yes, calling the task process; if no, ending the task; the task process comprises the following steps: extracting the integration configuration information of the project in which the code event is located; configuring pipeline tasks of the code event in sequence according to the integration configuration information, wherein the types of the pipeline tasks include push and pull request; summarizing the pipeline tasks to obtain a task event of the project; if the project obtains a new code event of the pull request type, generating a new pipeline task according to the integration configuration information of the project and loading the new pipeline task into the task event corresponding to the project; calling a running module to execute a task event in a task library, wherein the execution state of the task event is not executed, and obtaining an execution result of the task event; extracting running logs generated by the running module executing the task event, summarizing basic information, execution results and running logs of the task event to form event data, and extracting a running state and running content of the running module to obtain module data, wherein the basic information of the task event includes generation time, submission information, commit SHA and execution state of the task event, the running state reflects a current working state of the running module, and the running content describes a task event or pipeline task currently executed by the running module; monitoring review states and inspection states of the code event of the pull request type in the code hosting platform; if the review states are all agreed and the inspection state is successful, merging the code event according to the execution result.
2. The code hosting platform management method of claim 1, wherein, The step of calling a running module to execute a task event in a task library, wherein the execution state of the task event is not executed, and obtaining an execution result of the task event, comprises the following steps: receiving label information and association group information sent by a control end; writing the label information and the association group information into a label of the running module, wherein the label can write at least one label information and association group information; calling the running module to execute a pipeline task in the task library, wherein the pipeline task corresponds to a task label and an association group label of the running module, and the execution state of the pipeline task is not executed, and obtaining an execution result of the pipeline task; summarizing the execution results of the pipeline tasks in the task event to obtain the execution result of the task event.
3. The code hosting platform management method of claim 2, wherein, The step of calling the running module to execute the pipeline task in the task library, wherein the pipeline task corresponds to the task label and the association group label of the running module, and the execution state of the pipeline task is not executed, and obtaining the execution result of the pipeline task, comprises the following steps: identifying a running module in an idle state; calling the running module to execute a pipeline task in the task library corresponding to the task tag and the associated group tag of the running module and having an execution state of not executed, and modifying the execution state of the pipeline task in the task library to executing; monitoring the progress of the running module in executing the pipeline task, and if the running module completes the execution of the pipeline task, obtaining the execution result of the pipeline task and modifying the execution state of the pipeline task to executed; identifying whether the pipeline task in the task event is of a pull request type, and if so, synchronizing the execution result of the pipeline task to a check module of a code hosting platform.
4. The code hosting platform management method of claim 1, wherein, After calling a running module to execute a task event in the task library and obtaining the execution result of the task event, the method comprises: receiving control information sent by a control end, and controlling the running module to re-execute a task event with an execution result of failure or execution timeout or to cancel a task event being executed according to the control information.
5. The code hosting platform management method of claim 1, wherein, The step of merging the code events according to the execution result comprises: summarizing code events belonging to the same project to form an event set; judging whether the execution results of the code events in the event set are all passed; if so, calling a merge module in the code hosting platform to merge the code events in the event set, obtaining a target code event and sending it to the code hosting platform; if at least one execution result is not passed, returning a merge rejection information to the control end and the code hosting platform.
6. The code hosting platform management method of claim 1, wherein, After merging the code events according to the execution result, the method comprises: obtaining transaction information from the code hosting platform and identifying a project corresponding to the transaction information, extracting integration configuration information of the project, listening to change information generated by the code hosting platform according to the transaction information, extracting a preset closing rule in the integration configuration information, and judging whether the change information meets the closing rule; if so, closing the transaction information; if not, returning a closing rejection information to the control end and the code hosting platform; After merging the code events according to the execution result, the method further comprises: uploading the merged code event to a blockchain.
7. A code hosting platform management apparatus, comprising: The method comprises: an event listening module configured to listen to whether a code event is received by a code hosting platform; An event configuration module is configured to execute a task process to configure the code event to obtain a task event according to preset integration configuration information when the code event is received by the code hosting platform, wherein the integration configuration information defines a method of scheduling and triggering a preset running module and a method of executing a task event to obtain an execution result; before extracting the integration configuration information of the project where the code event is located, the method includes: judging whether the project where the code event is located has integration configuration information; if yes, calling the task process; if no, ending the task; the task process includes: extracting the integration configuration information of the project where the code event is located; configuring a pipeline task according to the integration configuration information, wherein the type of the pipeline task includes: push and pull request; and summarizing the pipeline task to obtain the task event of the project; if the project obtains a new code event of the pull request type, a new pipeline task is generated according to the integration configuration information of the project and is loaded into the task event corresponding to the project; An event execution module is configured to call a running module to execute a task event in a task library with an execution state of unexecuted and obtain an execution result of the task event; A log management module is configured to extract a running log generated by the running module executing the task event, summarize basic information, an execution result and a running log of the task event to form event data, and extract a running state and a running content of the running module to obtain module data, wherein the basic information of the task event includes generation time, submitted information, Commit SHA and an execution state of the task event, the running state reflects a current working state of the running module, and the running content describes a task event or a pipeline task currently executed by the running module; A listening merging module is configured to listen to review states and check states of code events of the pull request type in the code hosting platform; if the review states are all agreed and the check state is successful, the code event is merged according to the execution result.
8. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The computer program stored in the storage medium is executed by the processor to implement the steps of the code hosting platform management method in any one of claims 1 to 6.
9. A computer storage medium having stored thereon a computer program, characterized in that The computer program stored in the storage medium is executed by the processor to implement the steps of the code hosting platform management method in any one of claims 1 to 6.
Citation Information
Patent Citations
Method and device for constructing running environment, code incorporation method and system
CN109117170A