Pipeline optimization method and device for continuous integration environment
By obtaining the number of runners and the number of parallel jobs, the pipeline build time of the continuous integration environment is optimized, solving the problem of excessively long pipeline build time and improving development efficiency.
Patent Information
- Application Number
- CN202010629800.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-02
- Publication Date
- 2024-10-08
- Estimated Expiration
- 2040-07-02
AI Technical Summary
In a continuous integration environment of a warehouse management system, pipeline build time becomes a bottleneck that hinders developers from iterating quickly, especially when the testing volume is large and the testing requirements are complex.
By obtaining the number of runners configured in the project management system and the number of parallel jobs supported by each runner, a configuration file is created and pushed to the build pipeline of the warehouse management system. Based on this information, optimization strategies are determined to reduce the build time of the pipeline.
The pipeline build time has been optimized, reducing build time and increasing the iteration speed for developers.
Smart Images

Figure CN113962415B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a pipeline optimization method and device for a continuous integration environment. Background Art
[0002] Gitlab continuous integration (Gitlab CI) is a continuous integration service provided by Gitlab. It integrates the code into the trunk to ensure that there will be no quality problems after merging the main line.
[0003] In gitlab CI, each code in the configuration file pushed to the gitlab server will build a pipeline of the continuous integration environment, so as to automatically build, unit test and code detection the code to achieve automated testing. However, when the test volume is large and the test requirements are complex, the pipeline build time will become a bottleneck that hinders developers from iterating quickly, which needs to be further resolved. Summary of the invention
[0004] The embodiments of the present application provide a pipeline optimization method and device for a continuous integration environment, in the hope of optimizing the construction time of the pipeline and reducing the construction time of the pipeline.
[0005] In a first aspect, an embodiment of the present application provides a pipeline optimization method for a continuous integration environment, comprising:
[0006] Create a project in a warehouse management system, and obtain at least one runner configured for the project and the number of jobs that can be run in parallel supported by each of the at least one runner, wherein the at least one runner is used to run the jobs of the project and return the running results to the warehouse management system;
[0007] Creating a first configuration file in the root directory of the project, and pushing the first configuration file to the warehouse management system to build a pipeline of a continuous integration environment;
[0008] An optimization strategy for the build time of the pipeline is determined according to the number of runners included in the at least one runner and the number of jobs running in parallel supported by each of the at least one runner, and the optimization strategy is executed.
[0009] In a second aspect, an embodiment of the present application provides a pipeline optimization device for a continuous integration environment, the device comprising a processing unit, the processing unit being configured to:
[0010] Creating a project in a warehouse management system, and obtaining at least one runner configured for the project and the number of jobs that can be run in parallel supported by each of the at least one runner, wherein the at least one runner is used to run the jobs of the project and return the running results to the warehouse management system;
[0011] Creating a first configuration file in the root directory of the project, and pushing the first configuration file to the warehouse management system to build a pipeline of a continuous integration environment;
[0012] An optimization strategy for the build time of the pipeline is determined according to the number of runners included in the at least one runner and the number of jobs running in parallel supported by each of the at least one runner, and the optimization strategy is executed.
[0013] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor, a memory, and a communication interface, wherein the memory stores one or more programs, and the one or more programs are executed by the processor, and the one or more programs are used to execute instructions for the steps in the first aspect of the embodiment of the present application.
[0014] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, and the computer program is operable to enable a computer to execute some or all of the steps described in the first aspect of the embodiment of the present application.
[0015] In a fifth aspect, an embodiment of the present application provides a computer program product, wherein the computer program product includes a computer program, and the computer program is operable to enable a computer to execute some or all of the steps described in the first aspect of the embodiment of the present application, and the computer program product can be a software installation package.
[0016] It can be seen that in the embodiment of the present application, first, by obtaining at least one runner configured for the project created in the warehouse management system and the number of jobs running in parallel supported by each of the at least one runner; then, create a first configuration file for the project, and push the first configuration file to the warehouse management system to build a pipeline; finally, determine the optimization strategy for the construction time of the pipeline according to the number of runners contained in the at least one runner and the number of jobs running in parallel supported by each of the at least one runner. Because the embodiment of the present application determines the optimization strategy for the construction time of the pipeline according to the number of configured runners and the number of jobs running in parallel supported by the runner, and executes the optimization strategy to optimize the construction time of the pipeline, thereby reducing the construction time of the pipeline. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art description are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0018] Figure 1 It is a schematic diagram of the architecture of a communication system provided by an embodiment of the present application;
[0019] Figure 2 It is a flow chart of a pipeline optimization method for a continuous integration environment provided in an embodiment of the present application;
[0020] Figure 3 It is a structural schematic diagram of a pipeline provided in an embodiment of the present application;
[0021] Figure 4 It is a schematic diagram of a structure after optimizing the pipeline provided in an embodiment of the present application;
[0022] Figure 5 This is a schematic diagram of another structure after optimizing the pipeline provided in an embodiment of the present application;
[0023] Figure 6 This is a schematic diagram of another structure after optimizing the pipeline provided in an embodiment of the present application;
[0024] Figure 7 This is a schematic diagram of another structure after optimizing the pipeline provided in an embodiment of the present application;
[0025] Figure 8 This is a schematic diagram of another structure after optimizing the pipeline provided in an embodiment of the present application;
[0026] Fig. 9 This is a schematic diagram of another structure after optimizing the pipeline provided in an embodiment of the present application;
[0027] Fig.10 This is a schematic diagram of another structure after optimizing the pipeline provided in an embodiment of the present application;
[0028] Fig.11 This is a schematic diagram of another structure after optimizing the pipeline provided in an embodiment of the present application;
[0029] Fig.12 It is a block diagram of the functional units of a pipeline optimization device for a continuous integration environment provided in an embodiment of the present application. DETAILED DESCRIPTION
[0030] The technical solutions in the embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0031] In order to better understand the solution of the embodiment of the present application, the communication system that may be involved in the embodiment of the present application is first introduced. Figure 1 As shown. Among them, the communication system 100 may include an electronic device 110, a warehouse management system server 120 and an operator server 130. A user can create a project in a warehouse management system running on the electronic device 110, and create a configuration file in the root directory of the project; the warehouse management system server 120 can configure one or more operators for the project created in the warehouse management system, find the specified operator in the configuration file under the project, and build a pipeline according to the configuration file; the operator server 130 can be used to load the operator configured for the project, and the loaded operator can be used to run the project's job and return the running result to the warehouse management system server 120. It should be noted that one or more operators can be loaded on the operator server 130, or the operator server 130 can be a collection of one or more operator servers.
[0032] Specifically, the electronic device 110 in the embodiment of the present application can be various handheld devices with pipeline optimization functions in a continuous integration environment, vehicle-mounted devices, wearable devices, user equipment (UE), terminal devices (terminal device), personal digital assistants (PDA), personal computers (PC), relay devices, computers supporting 802.11 protocols, terminal devices supporting 5G systems, and terminal devices in future evolved public land mobile communication networks (PLMN), etc., and the embodiments of the present application are not specifically limited.
[0033] Specifically, the warehouse management system server 120 in the embodiment of the present application can be various cloud servers, Internet of Things devices, data center network devices, user devices, terminal devices, personal computers, relay devices, computers supporting 802.11 protocols, network devices supporting 5G systems, and network devices in future evolved PLMNs, etc., which are not specifically limited by the embodiment of the present application.
[0034] Specifically, the runner server 130 in the embodiment of the present application can be various cloud servers for loading runners, Internet of Things devices, data center network devices, user devices, terminal devices, personal computers, relay devices, computers supporting 802.11 protocols, network devices supporting 5G systems, and network devices in future evolved PLMNs, etc., and the embodiment of the present application does not make specific restrictions.
[0035] The following will introduce the execution steps of pipeline optimization in a continuous integration environment from the perspective of method examples. Figure 2 . Figure 2 1 is a flow chart of a pipeline optimization method for a continuous integration environment provided in an embodiment of the present application. The method can be applied to an electronic device 110. The method includes:
[0036] S210. Create a project in the warehouse management system, and obtain at least one executor configured for the project and the number of parallel-running jobs supported by each of the at least one executor.
[0037] Among them, at least one runner can be used to run the job of the project and return the running result to the warehouse management system (gitlab).
[0038] It should be noted that, first, the electronic device 110 can receive an instruction from the user and create a project in the warehouse management system according to the instruction; then, the warehouse management system server 120 can configure one or more runners for the project; finally, the runner configured by the warehouse management system server 120 for the project can be loaded into the runner server 130, and the runner is used to process the jobs in the project and return the processed running results to the warehouse management system server 120, and the running results are returned to the electronic device 110 by the warehouse management system server 120. In addition, the warehouse management system server 120 can configure at least one runner for each created project, and each runner can process one or more jobs at the same time, that is, the number of jobs supported by each runner to run in parallel can be one or more. At the same time, there can be multiple runners of the same type and multiple runners of different types in at least one runner configured for the project. At the same time, the number of jobs supported by each runner of the same type to run in parallel is the same.
[0039] For example, a project is configured with runner 1 (gitlab runner1), runner 2 (gitlab runner2), and runner 3 (gitlab runner3). Among them, gitlab runner1 and gitlab runner2 are runners of the same type, while gitlab runner1, gitlab runner2, and gitlab runner3 are runners of different types. At the same time, the number of parallel jobs supported by gitlab runner1 and gitlab runner2 is the same, while the number of parallel jobs supported by gitlabrunner1, gitlab runner2, and gitlab runner3 can be the same or cannot be different.
[0040] S220: Create a first configuration file in the root directory of the project, and push the first configuration file to the warehouse management system to build a pipeline of the continuous integration environment.
[0041] It is understandable that the electronic device 110 can receive instructions from the user, and create a first configuration file in the root directory of the project according to the instructions, and push the first configuration file to the warehouse management system server 120; then, the warehouse management system server 120 can build a pipeline of a continuous integration environment according to the code in the first configuration file.
[0042] Specifically, the pipeline can include multiple processes, such as automatic building, automatic unit testing, automatic code checking, etc. Figure 3 , a pipeline can include multiple stages, and each stage can include multiple jobs, that is, each stage is a logical division of multiple jobs. Among them, all stages in the pipeline run in sequence, and the failure of any stage will cause each stage after this stage to not be executed, and the pipeline can only be built successfully after all stages are successfully completed. In addition, all jobs in the same stage will run in parallel, and only when all jobs in the current stage run successfully can the current stage be built successfully.
[0043] S230. Determine an optimization strategy for the build time of the pipeline based on the number of runners included in the at least one runner and the number of parallel-running jobs supported by each of the at least one runner, and execute the optimization strategy.
[0044] It should be noted that the number of parallel running jobs supported by each runner configured for each project by the warehouse management system server 120 can be 1 or more, and the number of runners configured for each project can be 1 or more, which is specifically configured according to the project requirements created in the warehouse management system, and the embodiments of the present application do not impose specific restrictions.
[0045] Furthermore, if there are n jobs running on the same type of runner in the same stage, the number of parallel running jobs supported by each runner of this type is greater than or equal to n.
[0046] For example, a project is configured with runner 1 (gitlab runner1) and runner 2 (gitlabrunner2). Among them, gitlab runner1 and gitlab runner2 are runners of the same type. If there are two jobs running on the same type of runner in the same stage, the number of parallel jobs supported by gitlab runner1 and gitlab runner2 is greater than or equal to 2.
[0047] Since the pipeline built by the continuous integration system based on the warehouse management system can realize continuous integration automated testing, the situation of large test volume and complex test requirements will also increase the construction time of the pipeline, resulting in the running time of the continuous integration system and affecting the rapid iteration of software development. Therefore, the embodiment of the present application considers optimizing the construction time of the pipeline by the number of runners and the number of parallel running jobs supported by the runners, as described below.
[0048] In one possible example, determining an optimization strategy for pipeline build time based on the number of runners included in at least one runner and the number of jobs running in parallel supported by each runner in at least one runner may include the following operations: dividing an independent use case set into at least one independent use case subset based on the number of runners included in at least one runner; wherein the independent use case set can be used to represent a logical set of independent use cases, and the independent use case can be used to represent an execution unit that cannot be further divided and is not premised on the output of any use case; grouping each subset in the at least one independent use case subset into a first job to obtain at least one first job; wherein each first job in the at least one first job corresponds to a runner in at least one runner; and incorporating at least one first job into a stage in the pipeline based on the number of jobs running in parallel supported by each runner.
[0049] It should be noted that, since different independent use cases may correspond to different types of runners, and the type of each runner in the at least one runner configured for the project by the warehouse management system server 120 in the embodiment of the present application is different from each other, that is, the number of runner types contained in the at least one runner can be used to indicate how many runners there are. Therefore, in the process of optimizing which jobs can be included in each stage of the pipeline, it is necessary to divide the independent use case set according to the number of runners, and group each of the divided independent use case sets into a job. In addition, since a pipeline can include multiple stages, and each stage can include multiple jobs, and each job needs to be run by a runner, in the process of optimizing which jobs can be included in each stage of the pipeline, it is also necessary to consider the number of parallel running jobs supported by the runner. At the same time, since all stages in the pipeline run in sequence and all jobs in the same stage can run in parallel, the pipeline can only be successfully built after all stages are successfully completed. Therefore, the embodiment of the present application compiles all jobs into all stages in the pipeline according to the number of parallel running jobs supported by the runner, and ensures that as many jobs as possible run in parallel in the same stage, thereby reducing the construction time of the pipeline to optimize the construction time of the pipeline.
[0050] In the example, first, a project is configured with runner 1 (gitlab runner1) and runner 2 (gitlabrunner2), and gitlab runner1 and gitlab runner2 support single job or multiple jobs running in parallel; secondly, the independent use case set is divided into independent use case subset 1 and independent use case subset 2 according to gitlab runner1 and gitlab runner2, where independent use case subset 1 corresponds to gitlab runner1 and independent use case subset 2 corresponds to gitlabrunner2; then, independent use case subset 1 is grouped into job 1, and independent use case subset 2 is grouped into job 2, where the job corresponding to gitlab runner1 is job 1, and the job corresponding to gitlab runner2 is job 2; finally, job 1 and job 2 are compiled into the stages in the pipeline.
[0051] It can be seen that in the process of optimizing the number of jobs contained in the stages in the pipeline, the embodiment of the present application not only considers the impact of the number of runners and the number of jobs running in parallel supported by the runners on the optimization, but also considers the impact of different use case types on the optimization, thereby ensuring the efficiency and accuracy of the pipeline optimization process and reducing the time of pipeline construction.
[0052] The following embodiments of the present application will specifically introduce how the relationship between the number of parallel running jobs supported by the runner and the number of jobs in the job corresponding to the runner affects the optimization process of the pipeline construction time.
[0053] In one possible example, incorporating at least one first job into a stage in the pipeline according to the number of jobs running in parallel supported by each runner may include the following operations: incorporating at least one first job into a first stage in the pipeline when the number of jobs running in parallel supported by each runner is greater than or equal to the number of jobs in the first job corresponding to each runner, the first stage being a stage in the pipeline.
[0054] It is understandable that when the number of jobs supported by a certain runner to run in parallel is greater than the number of jobs in the job corresponding to the runner, the jobs corresponding to the runner can be compiled into the same stage. In addition, jobs corresponding to different runners can also be compiled into the same stage. Since jobs compiled into the same stage can run in parallel, it is helpful to reduce the construction time of the pipeline to optimize the construction time of the pipeline.
[0055] For example, see Figure 4 As shown, first, a project is configured with runner 1 (gitlab runner1) and runner 2 (gitlab runner2), and both gitlab runner1 and gitlab runner2 only support single job running. Secondly, the independent use case set is divided into independent use case subset 1 and independent use case subset 2 according to gitlab runner1 and gitlab runner2, where independent use case subset 1 corresponds to gitlab runner1 and independent use case subset 2 corresponds to gitlabrunner2. Then, independent use case subset 1 is grouped into job 1 (job1), and independent use case subset 2 is grouped into job 2 (job2), where the job corresponding to gitlab runner1 is job 1 and the job corresponding to gitlab runner2 is job 2. Finally, since the number of jobs supported by gitlab runner1 and gitlab runner2 is equal to 1, and the number of jobs in the jobs corresponding to gitlabrunner1 and gitlab runner2 is equal to 1, job 1 and job 2 are compiled into the same stage, that is, stage n.
[0056] See also Figure 5As shown, first, a project is configured with runner 1 (gitlab runner1), and the number of jobs that gitlabrunner1 supports in parallel is 3. Secondly, the independent use case set is divided into independent use case subset 1 and independent use case subset 2 according to gitlab runner1. Then, independent use case subset 1 is grouped into job 1, and independent use case subset 2 is grouped into job 2. Finally, since the number of jobs 3 that gitlab runner1 supports in parallel is greater than the number of jobs 2 in the job corresponding to gitlabrunner1, job 1 and job 2 are compiled into the same stage, that is, stage n.
[0057] See also Figure 6 As shown, first, a project is configured with runner 1 (gitlab runner1) and runner 2 (gitlab runner2), and the number of jobs supported by gitlab runner1 and gitlab runner2 for parallel operation is 3. Secondly, the independent use case set is divided into independent use case subset 1, independent use case subset 2, independent use case subset 3 and independent use case subset 4 according to gitlab runner1 and gitlab runner2, wherein independent use case subset 1 and independent use case subset 2 correspond to gitlab runner1, and independent use case subset 3 and independent use case subset 4 correspond to gitlab runner2. Then, independent use case subset 1 is grouped into job 1, independent use case subset 2 is grouped into job 2, independent use case subset 3 is grouped into job 3, and independent use case subset 4 is grouped into job 4. Finally, since the number of jobs supported by gitlab runner1 and gitlab runner2 for parallel operation is greater than the number of jobs in the jobs corresponding to gitlab runner1 and gitlab runner2, job 1, job 2, job 3 and job 4 are compiled into the same stage, namely stage n.
[0058] It should be noted that the technical solutions in the embodiments of the present application are not limited to Figure 5 , Figure 6 and Figure 7 Based on the examples in the examples, those skilled in the art can understand that the technical solutions in the embodiments of the present application may also include other examples without specific limitation.
[0059] In one possible example, incorporating at least one first job into a stage in a pipeline according to the number of jobs running in parallel supported by each runner may include the following operations: when the number of jobs running in parallel supported by each runner is less than or equal to the number of jobs in the first job corresponding to each runner, starting from the second stage in the pipeline, incorporating a first number of jobs selected from the first job corresponding to each runner into the second stage, the first number being less than or equal to the number of jobs running in parallel supported by each runner; and incorporating the remaining jobs of the at least one first job starting from the next stage of the second stage.
[0060] It should be noted that by incorporating the first number of jobs into the same stage and incorporating the remaining jobs from the next stage, since the jobs in the same stage can be run in parallel, it is beneficial to reduce the construction time of the pipeline to optimize the construction time of the pipeline. In addition, the remaining first jobs in the at least one first job are incorporating the second number of first jobs selected from the first jobs corresponding to each runner into the next stage of the second stage, and so on, until the at least one first job is taken, and the second number is less than or equal to the number of jobs supported by each runner to run in parallel.
[0061] For example, see Figure 7 First, a project is configured with runner 1 (gitlab runner1), and the number of jobs that gitlab runner1 supports in parallel is 2. Secondly, the independent use case set is divided into independent use case subset 1, independent use case subset 2, and independent use case subset 3 according to gitlab runner1. Then, independent use case subset 1 is grouped into job 1, independent use case subset 2 is grouped into job 2, and independent use case subset 3 is grouped into job 3. Finally, since the number of jobs 2 that gitlab runner1 supports in parallel is less than the number of jobs 3 in the job corresponding to gitlab runner1, job 1 and job 2 are selected from job 1, job 2, and job 3 corresponding to gitlab runner1, and job 1 and job 2 are compiled into the same stage, that is, stage n, and job 3 is compiled into the next stage, that is, stage n+1.
[0062] See also Figure 8First, a project is configured with runner 1 (gitlab runner1) and runner 2 (gitlabrunner2), and the number of jobs supported by gitlab runner1 and gitlab runner2 for parallel operation is 1. Secondly, the independent use case set is divided into independent use case subset 1, independent use case subset 2, independent use case subset 3 and independent use case subset 4 according to gitlab runner1 and gitlab runner2, where independent use case subset 1 and independent use case subset 2 correspond to gitlab runner1, and independent use case subset 3 and independent use case subset 4 correspond to gitlab runner2. Then, independent use case subset 1 is grouped into job 1, independent use case subset 2 is grouped into job 2, independent use case subset 3 is grouped into job 3, and independent use case subset 4 is grouped into job 4. Then, since the number of jobs supported by gitlab runner1 and gitlab runner2 is less than the number of jobs in the jobs corresponding to gitlab runner1 and gitlab runner2, job 1 is selected from jobs 1 and 2 corresponding to gitlab runner1, and job 3 is selected from jobs 3 and 4 corresponding to gitlab runner2, and jobs 1 and 3 are put into the same stage, that is, stage n. Finally, jobs 2 and 4 are put into the next stage, that is, stage n+1.
[0063] It should be noted that the technical solutions in the embodiments of the present application are not limited to Figure 8 and Fig. 9 Based on the examples in the examples, those skilled in the art can understand that the technical solutions in the embodiments of the present application may also include other examples without specific limitation.
[0064] The above describes the case where there are only independent use case sets. The following specifically describes the case where there are only predecessor use case sets and conditional use case sets. Among them, the predecessor use case set can be used to represent the logical set of predecessor use cases, and the conditional use case set can be used to represent the logical set of conditional use cases. The predecessor use case can be an independent use case or a conditional use case, and the conditional use case can be used to represent an execution unit that depends on the output of the predecessor use case as a prerequisite.
[0065] In one possible example, determining an optimization strategy for pipeline build time based on the number of runners included in at least one runner and the number of jobs supported by each of the at least one runner to run in parallel may include the following operations: dividing the set of prerequisite use cases into at least one subset of prerequisite use cases and dividing the set of conditional use cases into at least one subset of conditional use cases based on the number of runners included in the at least one runner; wherein each subset in the at least one subset of conditional use cases corresponds one-to-one to each subset in the at least one prerequisite use case set; and combining each subset in the at least one prerequisite use case set into a second job to obtain at least one a second job, and each subset in at least one conditional use case set is composed into a third job to obtain at least one third job; at least one second job and at least one third job are compiled into stages in the pipeline according to the number of jobs running in parallel supported by each runner; wherein, a stage in which a second job composed of a first predecessor use case subset is compiled is before a stage in which a third job composed of a first conditional use case subset is compiled, the first predecessor use case subset is a subset in at least one predecessor use case set, and the first conditional use case set is a subset in at least one conditional use case set that depends on the output of the first predecessor use case set as a premise.
[0066] In this example, first, a project is configured with runner 1 (gitlab runner1) and runner 2 (gitlabrunner2), the prerequisite use case set belongs to gitlab runner1, the conditional use case set belongs to gitlab runner2, and gitlabrunner1 and gitlab runner2 support single job or multiple jobs running in parallel. Secondly, the prerequisite use case set is divided into prerequisite use case subset 1 and prerequisite use case subset 2 according to gitlab runner1, and the conditional use case set is divided into conditional use case subset 1 and conditional use case subset 2 according to gitlabrunner2. Among them, prerequisite use case subset 1 is the use case subset that conditional use case subset 1 depends on, and prerequisite use case subset 2 is the use case subset that conditional use case subset 2 depends on. Then, precondition use case subset 1 is grouped into job 1, precondition use case subset 2 is grouped into job 2, condition use case subset 1 is grouped into job 3, and condition use case subset 2 is grouped into job 4, where the jobs corresponding to gitlab runner1 are job 1 and job 2, and the jobs corresponding to gitlab runner2 are job 3 and job 4. Finally, job 1 and job 2 are compiled into the stage in the pipeline.
[0067] It can be seen that in the process of optimizing the number of jobs contained in the stages in the pipeline, the embodiment of the present application not only considers the impact of the number of executors and the number of jobs running in parallel supported by the executors on the optimization, but also considers the impact of the causal relationship between the prerequisite use cases and the conditional use cases on the optimization, thereby ensuring the efficiency and accuracy of the pipeline optimization process.
[0068] In one possible example, all second jobs in at least one preconditioning use case set correspond to a first runner in at least one runner, and all third jobs in at least one conditional use case set correspond to a second runner in the at least one runner; wherein the relationship between the first runner and the second runner is one of the following: the first runner and the second runner are the same runner, the first runner and the second runner contain at least one identical runner, and each runner in the first runner is different from each runner in the second runner.
[0069] In this example, the first runner may include gitlab runner1 and gitlab runner2, and the second runner may include gitlab runner2 and gitlab runner3. In this case, the first runner and the second runner include the same runner, namely gitlab runner2.
[0070] It is understandable that the preconditioning use case set and the conditional use case set may correspond to the same runner, the preconditioning use case set and the conditional use case set may correspond to the same runner, or the preconditioning use case set and the conditional use case set may not correspond to the same runner. It can be seen that by considering the runners between the preconditioning use case set and the conditional use case set, it is helpful to ensure the accuracy of the pipeline optimization process.
[0071] The following embodiments of the present application will specifically introduce how the relationship between the number of parallel running jobs supported by the executor and the number of jobs in the job corresponding to the executor affects the pipeline optimization process.
[0072] In a possible example, the stage of incorporating at least one second job and at least one third job into the pipeline according to the number of jobs running in parallel supported by each runner may include the following operations:
[0073] When the number of jobs running in parallel supported by each runner in the first runner is greater than or equal to the number of jobs in the second job corresponding to each runner in the first runner, and the number of jobs running in parallel supported by each runner in the second runner is greater than or equal to the number of jobs in the third job corresponding to each runner in the second runner, at least one second job is incorporated into the third stage of the pipeline, and at least one third job is incorporated into the fourth stage of the pipeline, the third stage being a stage before the fourth stage.
[0074] For example, see Fig. 9 First, a project is configured with gitlab runner1, gitlab runner2, and gitlab runner3, the prerequisite use case set belongs to gitlab runner1 and gitlab runner2, the conditional use case set belongs to gitlab runner2 and gitlab runner3, and the number of parallel running jobs supported by gitlab runner1, gitlab runner2, and gitlabrunner3 is 2. Secondly, the prerequisite use case set is divided into prerequisite use case subset 1 according to gitlab runner1, the remaining prerequisite use case sets are divided into prerequisite use case subset 2 according to gitlab runner2, the conditional use case set is divided into conditional use case subset 1 according to gitlab runner2, and the remaining conditional use case set is divided into conditional use case subset 2 according to gitlab runner3. Then, the prerequisite use case subset 1 is composed into job 1, the prerequisite use case 2 is composed into job 2, the conditional use case subset 1 is composed into job 3, and the conditional use case subset 2 is composed into job 4. Among them, the job corresponding to gitlab runner1 is job 1, the jobs corresponding to gitlab runner2 are jobs 2 and 3, and the job corresponding to gitlab runner3 is job 4. Finally, since the number of jobs supported by gitlab runner1, gitlab runner2, and gitlab runner3 is greater than or equal to the number of jobs in their respective corresponding jobs, job 1 and job 2 are compiled into the same stage, that is, stage n. In addition, since the stage compiled into job 1 needs to be before job 3, and the stage compiled into job 2 needs to be before job 4, job 3 and job 4 are compiled into the next stage of stage n, that is, stage n+1.
[0075] It can be seen that by considering the runners between the prerequisite use case set and the conditional use case set, it is helpful to ensure the accuracy of the pipeline optimization process.
[0076] In a possible example, the stage of incorporating at least one second job and at least one third job into the pipeline according to the number of jobs running in parallel supported by each runner may include the following operations:
[0077] When the number of jobs running in parallel supported by each runner in the first runner is greater than or equal to the number of jobs in the second job corresponding to each runner in the first runner, and the number of jobs running in parallel supported by each runner in the second runner is greater than or equal to the number of jobs in the third job corresponding to each runner in the second runner, starting from the fifth stage in the pipeline, each second job in at least one second job is sequentially incorporated into the stages in the pipeline in the order of stages; wherein, in at least one second job, jobs corresponding to the same runner are incorporated into different stages, and in at least one second job, jobs corresponding to different runners are incorporated into the same stages; starting from the sixth stage in the pipeline, each third job in at least one third job is sequentially incorporated into the stages in the pipeline in the order of stages, and the fifth stage is a stage before the sixth stage; wherein, in at least one third job, jobs corresponding to the same runner are incorporated into different stages, and in at least one third job, jobs corresponding to different runners are incorporated into the same stages.
[0078] For example, see Fig.10First, a project is configured with gitlab runner1, gitlab runner2, and gitlab runner3, the prerequisite use case set belongs to gitlab runner1 and gitlab runner2, the conditional use case set belongs to gitlab runner2 and gitlab runner3, and the number of parallel jobs supported by gitlab runner1, gitlab runner2, and gitlabrunner3 is 2. Secondly, the prerequisite use case set is divided into prerequisite use case set 1 according to gitlab runner1, the remaining prerequisite use case sets are divided into prerequisite use case set 2 and prerequisite use case set 3 according to gitlab runner2, the conditional use case set is divided into conditional use case set 1 according to gitlab runner2, and the remaining conditional use case set is divided into conditional use case set 2 and conditional use case set 3 according to gitlab runner3. Then, the precondition use case subset 1 is grouped into job 1, the precondition use case 2 is grouped into job 2, the precondition use case 3 is grouped into job 3, the condition use case subset 1 is grouped into job 4, the condition use case subset 2 is grouped into job 5, and the condition use case subset 3 is grouped into job 6. Among them, the jobs corresponding to gitlab runner1 are job 1 and job 2, the jobs corresponding to gitlab runner2 are job 3 and job 4, and the jobs corresponding to gitlab runner3 are job 5 and job 6. Finally, since the number of jobs supported by gitlab runner1, gitlabrunner2, and gitlab runner3 to run in parallel is greater than or equal to the number of jobs in their respective corresponding jobs, starting from stage n, job 1, job 2, and job 3 are sequentially compiled. Among them, job 1 and job 2 belong to gitlab runner1, and job 3 belongs to gitlab runner2, so job 2 and job 3 are compiled into stage n+1. Similarly, starting from stage n+1, tasks 4 and 5 are included in the same stage, but since task 5 needs to be included in the stage after task 2, tasks 4 and 5 are included in stage n+2, and task 6 is included in stage n+3.
[0079] It can be seen that by considering the runners between the prerequisite use case set and the conditional use case set, it is helpful to ensure the accuracy of the pipeline optimization process.
[0080] In one possible example, incorporating at least one second job and at least one third job into stages in a pipeline according to the number of jobs running in parallel supported by each runner may include the following operations: when the number of jobs running in parallel supported by each runner in a first runner is less than or equal to the number of jobs in a second job corresponding to each runner in the first runner, and the number of jobs running in parallel supported by each runner in a second runner is less than or equal to the number of jobs in a third job corresponding to each runner in the second runner, starting from the seventh stage in the pipeline, incorporating the jobs in at least one second job into stages in the pipeline in sequence according to the order of stages; wherein, in at least one second job, jobs corresponding to the same runner are incorporated into different stages, and in at least one second job, jobs corresponding to different runners are incorporated into the same stages; starting from the eighth stage in the pipeline, incorporating the jobs in at least one third job into stages in the pipeline in sequence according to the order of stages, the seventh stage being a stage before the eighth stage; wherein, in at least one third job, jobs corresponding to the same runner are incorporated into different stages, and in at least one third job, jobs corresponding to different runners are incorporated into the same stages.
[0081] For example, see Fig.11First, a project is configured with gitlab runner1 and gitlab runner2, the preconditioning use case set belongs to gitlab runner1, the conditional use case set belongs to gitlab runner2, and the number of jobs supported by gitlab runner1 and gitlab runner2 is 1. Secondly, the preconditioning use case set is divided into preconditioning use case set 1, preconditioning use case set 2, and preconditioning use case set 3 according to gitlab runner1, and the conditional use case set is divided into conditional use case set 1, conditional use case set 2, and conditional use case set 3 according to gitlab runner2. Then, preconditioning use case set 1 is grouped into job 1, preconditioning use case set 2 is grouped into job 2, preconditioning use case set 3 is grouped into job 3, conditional use case set 1 is grouped into job 4, conditional use case set 2 is grouped into job 5, and conditional use case set 3 is grouped into job 6. Among them, the jobs corresponding to gitlab runner1 are job 1, job 2, and job 3, and the jobs corresponding to gitlab runner2 are job 4, job 5, and job 6. Finally, since the number of jobs supported by gitlab runner1 and gitlab runner2 is less than the number of jobs in their respective corresponding jobs, starting from stage n, jobs 1, 2, and 3 are sequentially compiled. Among them, jobs 1, 2, and 3 belong to gitlab runner1, so job 2 is compiled into stage n+1, and job 3 is compiled into stage n+2. Similarly, starting from stage n+1, jobs 4, 5, and 6 are compiled into different stages in sequence.
[0082] It can be seen that by considering the runners between the prerequisite use case set and the conditional use case set, it is helpful to ensure the accuracy of the pipeline optimization process.
[0083] The above respectively introduces specific embodiments in the case where there is only an independent use case set or only a precondition use case set and a condition use case set. It should be noted that, based on the understanding of those skilled in the art, through the technical solutions and diagrams provided in the embodiments of the present application, specific embodiments in the case where there are an independent use case set, a precondition use case set and a condition use case set at the same time can be obtained, which will not be repeated here.
[0084] It can be seen that in the embodiment of the present application, first, at least one runner configured for the project created in the warehouse management system and the number of jobs supported by each of the at least one runner for parallel operation are obtained; then, a first configuration file is created for the project, and the first configuration file is pushed to the warehouse management system to build a pipeline; finally, an optimization strategy for the build time of the pipeline is determined according to the number of runners contained in the at least one runner and the number of jobs supported by each of the at least one runner for parallel operation. Since the embodiment of the present application optimizes the build time of the pipeline in the continuous integration environment by the number of configured runners and the number of jobs supported by the runner for parallel operation, it is conducive to optimizing the build time of the pipeline and reducing the build time of the pipeline.
[0085] The above mainly introduces the scheme of the embodiment of the present application from the perspective of the execution process on the method side. It is understandable that, in order to realize the above functions, the electronic device 110 includes a hardware structure and / or software module corresponding to each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiment provided herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.
[0086] The embodiment of the present application can divide the electronic device 110 into functional units according to the above method example. For example, each functional unit can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical functional division, and there may be other division methods in actual implementation.
[0087] In the case of an integrated unit, Fig.12 The block diagram of the functional units of a pipeline optimization device for a continuous integration environment is shown. The pipeline optimization device 1200 for a continuous integration environment is applied to an electronic device 110, and specifically includes a processing unit 1220 and a communication unit 1230. The processing unit 1220 is used to control and manage the actions of the electronic device 110. For example, the processing unit 1220 is used to support the electronic device 110 to execute Figure 2The communication unit 1230 is used to support the communication between the electronic device 110 and the warehouse management system server 120. The pipeline optimization device 1200 of the continuous integration environment may also include a storage unit 1210 for storing program codes and data of the electronic device 110.
[0088] Among them, the processing unit 1220 can be a processor or a controller, for example, a central processing unit (CPU), a general processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It can implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processing unit 1220 can also be a combination that implements a computing function, such as a combination of one or more microprocessors, a combination of DSP and microprocessors, etc. The communication unit 1230 can be a communication interface, a transceiver, a transceiver circuit, etc. The storage unit 1210 can be a memory, and the memory can include a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM) or a portable read-only memory (CD-ROM).
[0089] In specific implementation, the processing unit 1220 is used to execute any step executed by the electronic device 110 in the above method embodiment, and when performing data transmission such as sending, the communication unit 1230 can be selectively called to complete the corresponding operation.
[0090] Processing unit 1220 is used to: create a project in a warehouse management system, and obtain at least one runner configured for the project and the number of parallel-running jobs supported by each of the at least one runner, the at least one runner being used to run the jobs of the project and return the running results to the warehouse management system; create a first configuration file in the root directory of the project, and push the first configuration file to the warehouse management system to build a pipeline in a continuous integration environment; determine an optimization strategy for the build time of the pipeline based on the number of runners included in the at least one runner and the number of parallel-running jobs supported by each of the at least one runner, and execute the optimization strategy.
[0091] It can be seen that in the embodiment of the present application, first, at least one runner configured for the project created in the warehouse management system and the number of jobs running in parallel supported by each of the at least one runner are obtained; then, a first configuration file is created for the project, and the first configuration file is pushed to the warehouse management system to build a pipeline; finally, an optimization strategy for the build time of the pipeline is determined according to the number of runners contained in the at least one runner and the number of jobs running in parallel supported by each of the at least one runner. Since the embodiment of the present application optimizes the build time of the pipeline in the continuous integration environment by the number of configured runners and the number of jobs running in parallel supported by the runners, it is conducive to optimizing the build time of the pipeline and reducing the build time of the pipeline.
[0092] In one possible example, in terms of determining an optimization strategy for pipeline build time based on the number of runners included in at least one runner and the number of jobs running in parallel supported by each runner in at least one runner, processing unit 1220 is used to: divide an independent use case set into at least one independent use case subset based on the number of runners included in at least one runner; wherein the independent use case set is used to represent a logical set of independent use cases, and the independent use case is used to represent an execution unit that cannot be further divided and is not premised on the output of any use case; group each subset in the at least one independent use case subset into a first job to obtain at least one first job; wherein each first job in the at least one first job corresponds to a runner in at least one runner; and organize the at least one first job into a stage in the pipeline based on the number of jobs running in parallel supported by each runner.
[0093] In one possible example, in terms of incorporating at least one first job into a stage in a pipeline according to the number of jobs running in parallel supported by each runner, the processing unit 1220 is used to: when the number of jobs running in parallel supported by each runner is greater than or equal to the number of jobs in the first job corresponding to each runner, incorporating at least one first job into a first stage in the pipeline, the first stage being a stage in the pipeline.
[0094] In one possible example, in terms of the stage of incorporating at least one first job into the pipeline according to the number of jobs running in parallel supported by each runner, the processing unit 1220 is used to: when the number of jobs running in parallel supported by each runner is less than or equal to the number of jobs in the first job corresponding to each runner, starting from the second stage in the pipeline, incorporate a first number of jobs selected from the first job corresponding to each runner into the second stage, the first number being less than or equal to the number of jobs running in parallel supported by each runner; and incorporate the remaining jobs of the at least one first job starting from the next stage of the second stage.
[0095] In one possible example, in terms of determining an optimization strategy for the build time of a pipeline based on the number of runners included in at least one runner and the number of jobs running in parallel supported by each of the at least one runner, the processing unit 1220 is used to: divide the premise use case set into at least one premise use case subset according to the number of runners included in the at least one runner, and divide the condition use case set into at least one condition use case subset; wherein the premise use case set is used to represent a logical set of premise use cases, the condition use case set is used to represent a logical set of condition use cases, the premise use case is an independent use case or a conditional use case, the independent use case is used to represent an execution unit that cannot be further divided and is not premised on the output of any use case, the conditional use case is used to represent an execution unit that depends on the output of the premise use case as a premise, and at least one conditional use case Each subset in the subset corresponds one-to-one to each subset in at least one preceding use case set; each subset in at least one preceding use case set is composed into a second job to obtain at least one second job, and each subset in at least one conditional use case set is composed into a third job to obtain at least one third job; at least one second job and at least one third job are compiled into stages in the pipeline according to the number of jobs running in parallel supported by each runner; wherein, a stage in which a second job composed of the first preceding use case set is compiled is before a stage in which a third job composed of the first conditional use case set is compiled, the first preceding use case set is a subset in at least one preceding use case set, and the first conditional use case set is a subset that depends on the output of the first preceding use case set as a prerequisite in at least one conditional use case set.
[0096] In one possible example, all second jobs in at least one preconditioning use case set correspond to a first runner in at least one runner, and all third jobs in at least one conditional use case set correspond to a second runner in at least one runner; wherein the relationship between the first runner and the second runner is one of the following: the first runner and the second runner are the same runner, the first runner and the second runner contain at least one identical runner, and each runner in the first runner is different from each runner in the second runner.
[0097] In one possible example, in terms of the stages of incorporating at least one second job and at least one third job into the pipeline according to the number of jobs running in parallel supported by each runner, the processing unit 1220 is used to: when the number of jobs running in parallel supported by each runner in the first runner is greater than or equal to the number of jobs in the second job corresponding to each runner in the first runner, and the number of jobs running in parallel supported by each runner in the second runner is greater than or equal to the number of jobs in the third job corresponding to each runner in the second runner, then incorporating at least one second job into the third stage of the pipeline, and incorporating at least one third job into the fourth stage of the pipeline, the third stage being before the fourth stage. a stage in the pipeline; or, starting from the fifth stage in the pipeline, each second job in at least one second job is sequentially incorporated into the stages in the pipeline in the order of the stages; wherein, in at least one second job, the jobs corresponding to the same runner are incorporated into different stages, and in at least one second job, the jobs corresponding to different runners are incorporated into the same stages; starting from the sixth stage in the pipeline, each third job in at least one third job is sequentially incorporated into the stages in the pipeline in the order of the stages, and the fifth stage is a stage before the sixth stage; wherein, in at least one third job, the jobs corresponding to the same runner are incorporated into different stages, and in at least one third job, the jobs corresponding to different runners are incorporated into the same stages.
[0098] In one possible example, in terms of incorporating at least one second job and at least one third job into the stages of the pipeline according to the number of jobs running in parallel supported by each runner, the processing unit 1220 is used to: when the number of jobs running in parallel supported by each runner in the first runner is less than or equal to the number of jobs in the second job corresponding to each runner in the first runner, and the number of jobs running in parallel supported by each runner in the second runner is less than or equal to the number of jobs in the third job corresponding to each runner in the second runner, starting from the seventh stage in the pipeline, sequentially incorporating the jobs in at least one second job into the stages of the pipeline in the order of the stages; wherein, in at least one second job, jobs corresponding to the same runner are incorporated into different stages, and in at least one second job, jobs corresponding to different runners are incorporated into the same stages; starting from the eighth stage in the pipeline, sequentially incorporating the jobs in at least one third job into the stages of the pipeline in the order of the stages, the seventh stage being a stage before the eighth stage; wherein, in at least one third job, jobs corresponding to the same runner are incorporated into different stages, and in at least one third job, jobs corresponding to different runners are incorporated into the same stages.
[0099] An embodiment of the present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, and the computer program is operable to cause a computer to execute part or all of the steps of any method recorded in the above method embodiments.
[0100] The present application also provides a computer program product, wherein the computer program product includes a computer program, and the computer program is operable to enable a computer to execute some or all steps of any method described in the above method embodiment. The computer program product may be a software installation package.
[0101] It should be noted that, for the above-mentioned various method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. Those skilled in the art should be aware that the present application is not limited by the described order of actions, because some steps in the embodiments of the present application can be performed in other orders or simultaneously. In addition, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of the present application.
[0102] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0103] In several embodiments provided in the present application, those skilled in the art should be aware that the described device can be implemented in other ways. It is understandable that the device embodiments described above are merely schematic. For example, the division of the above units is only a logical function division, and there may be other division methods in practice. In other words, multiple units or components can be combined or integrated into another software, and some features can be ignored or not executed. In addition, the coupling, direct coupling or communication connection between each other shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, or can be electrical or other forms.
[0104] The units described above as separate components may or may not be physically separated. In addition, the components shown above as units may or may not be physical units, that is, they may be located on one network unit or distributed on multiple network units. Therefore, the above embodiments may be implemented by selecting some or all of the units therein according to actual needs.
[0105] In addition, each functional unit in the above embodiments may be integrated into one processing unit, or may exist in different physical units, or two or more functional units may be integrated into one physical unit. The above units may be implemented in the form of hardware or software functional units.
[0106] If the above-mentioned units are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable memory. It is understandable that the technical solution of the present application (the part of the technical solution that contributes to the prior art or all or part of the technical solution) can be embodied in the form of a computer software product. The computer software product is stored in a memory, including several instructions for a computer device (a personal computer, a server or a network device, etc.) to perform all or part of the steps of the embodiment of the present application. In addition, the above-mentioned memory includes various media that can store program codes, such as a USB flash drive, ROM, RAM, a mobile hard disk, a magnetic disk or an optical disk.
[0107] Those skilled in the art should be aware that all or part of the steps of the embodiments of the present application can be completed by a program to instruct related hardware, and the program can be stored in a memory, which can include a flash drive, ROM, RAM, a magnetic disk or an optical disk, etc.
[0108] The embodiments of the present application are described in detail above, and the description in the embodiments of the present application is only used to help understand the method and core idea of the present application. Those skilled in the art should know that the embodiments of the present application may be changed in specific implementation and application scope, and the content of this specification should not be construed as limiting the present application.
Claims
1. A pipeline optimization method for a continuous integration environment, characterized in that: include: Create a project in a warehouse management system, and obtain at least one runner configured for the project and the number of jobs that can be run in parallel supported by each of the at least one runner, wherein the at least one runner is used to run the jobs of the project and return the running results to the warehouse management system; Creating a first configuration file in the root directory of the project, and pushing the first configuration file to the warehouse management system to build a pipeline of a continuous integration environment; Determining an optimization strategy for the build time of the pipeline according to the number of runners included in the at least one runner and the number of jobs running in parallel supported by each of the at least one runner, and executing the optimization strategy; The optimization strategy includes: dividing the independent use case set into at least one independent use case subset according to the number of runners included in the at least one runner; wherein the independent use case set is used to represent a logical set of independent use cases, and the independent use case is used to represent an execution unit that cannot be further divided and is not premised on the output of any use case; forming each subset in the at least one independent use case subset into a first job to obtain at least one first job; and incorporating the at least one first job into a stage in the pipeline according to the number of jobs supported by each runner to run in parallel; Alternatively, the optimization strategy includes: dividing the set of prerequisite use cases into at least one subset of prerequisite use cases, and dividing the set of conditional use cases into at least one subset of conditional use cases according to the number of runners included in the at least one runner; wherein the set of prerequisite use cases is used to represent a logical set of prerequisite use cases, and the set of conditional use cases is used to represent a logical set of conditional use cases, the prerequisite use cases are independent use cases or conditional use cases, the independent use cases are used to represent execution units that cannot be further divided and are not premised on the output of any use case, and the conditional use cases are used to represent execution units that are premised on the output of the prerequisite use case; each subset in the at least one prerequisite use case set is composed into a second job to obtain at least one second job, and each subset in the at least one conditional use case set is composed into a third job to obtain at least one third job; and the at least one second job and the at least one third job are compiled into the stages in the pipeline according to the number of jobs running in parallel supported by each runner.
2. The method according to claim 1, characterized in that Each first job in the at least one first job corresponds to an executor in the at least one executor.
3. The method according to claim 2, characterized in that The stage of incorporating the at least one first job into the pipeline according to the number of jobs running in parallel supported by each executor comprises: When the number of parallel running jobs supported by each executor is greater than or equal to the number of jobs in the first job corresponding to each executor, the at least one first job is incorporated into the first stage of the pipeline, and the first stage is a stage in the pipeline.
4. The method according to claim 2, characterized in that: The stage of incorporating the at least one first job into the pipeline according to the number of jobs running in parallel supported by each executor comprises: In a case where the number of jobs supported by each runner for parallel operation is less than or equal to the number of jobs in the first job corresponding to each runner, starting from the second stage in the pipeline, a first number of jobs selected from the first job corresponding to each runner are compiled into the second stage, the first number being less than or equal to the number of jobs supported by each runner for parallel operation; The remaining tasks of the at least one first task are incorporated starting from a stage next to the second stage.
5. The method according to claim 1, characterized in that Each subset in the at least one conditional use case set corresponds one-to-one to each subset in the at least one preconditional use case set; Before the stage in which a second job consisting of a first prerequisite use case set is incorporated, a third job consisting of a first conditional use case set is incorporated, the first prerequisite use case set is a subset of the at least one prerequisite use case set, and the first conditional use case set is a subset of the at least one conditional use case set that depends on the output of the first prerequisite use case set as a premise.
6. The method according to claim 1, characterized in that All second jobs in the at least one prerequisite use case set correspond to a first runner in the at least one runner, and all third jobs in the at least one conditional use case set correspond to a second runner in the at least one runner; wherein the relationship between the first runner and the second runner is one of the following: the first runner and the second runner are the same runner, the first runner and the second runner contain at least one identical runner, and each runner in the first runner is different from each runner in the second runner.
7. The method according to claim 6, characterized in that The stage of incorporating the at least one second job and the at least one third job into the pipeline according to the number of jobs running in parallel supported by each executor comprises: In the case where the number of jobs running in parallel supported by each of the first runners is greater than or equal to the number of jobs in the second job corresponding to each of the first runners, and the number of jobs running in parallel supported by each of the second runners is greater than or equal to the number of jobs in the third job corresponding to each of the second runners, Including the at least one second job in a third stage of the pipeline, and including the at least one third job in a fourth stage of the pipeline, wherein the third stage is a stage before the fourth stage; or Starting from the fifth stage in the pipeline, each of the at least one second job is sequentially incorporated into the stages of the pipeline in the order of stages; wherein, the stages into which the jobs corresponding to the same runner in the at least one second job are incorporated are different, and the stages into which the jobs corresponding to different runners in the at least one second job are incorporated are the same; starting from the sixth stage in the pipeline, each of the at least one third job is sequentially incorporated into the stages of the pipeline in the order of stages, and the fifth stage is a stage before the sixth stage; wherein, the stages into which the jobs corresponding to the same runner in the at least one third job are incorporated are different, and the stages into which the jobs corresponding to different runners in the at least one third job are incorporated are the same.
8. The method according to claim 6, characterized in that The stage of incorporating the at least one second job and the at least one third job into the pipeline according to the number of jobs running in parallel supported by each executor comprises: In the case where the number of jobs running in parallel supported by each of the first runners is less than or equal to the number of jobs in the second job corresponding to each of the first runners, and the number of jobs running in parallel supported by each of the second runners is less than or equal to the number of jobs in the third job corresponding to each of the second runners, Starting from the seventh stage in the pipeline, the operations in the at least one second operation are sequentially compiled into the stages in the pipeline according to the order of the stages; wherein the stages compiled into which the operations in the at least one second operation corresponding to the same runner are different, and the stages compiled into which the operations in the at least one second operation corresponding to different runners are the same; Starting from the eighth stage in the pipeline, the jobs in the at least one third job are sequentially incorporated into the stages in the pipeline in the order of the stages, and the seventh stage is a stage before the eighth stage; wherein, the jobs in the at least one third job corresponding to the same runner are incorporated into different stages, and the jobs in the at least one third job corresponding to different runners are incorporated into the same stages.
9. A pipeline optimization device for a continuous integration environment, characterized in that: The apparatus comprises a processing unit, wherein the processing unit is configured to: Create a project in a warehouse management system, and obtain at least one runner configured for the project and the number of jobs that can be run in parallel supported by each of the at least one runner, wherein the at least one runner is used to run the jobs of the project and return the running results to the warehouse management system; Creating a first configuration file in the root directory of the project, and pushing the first configuration file to the warehouse management system to build a pipeline of a continuous integration environment; Determine an optimization strategy for the pipeline according to the number of runners included in the at least one runner and the number of jobs running in parallel supported by each of the at least one runner, and execute the optimization strategy for the pipeline; The optimization strategy includes: dividing the independent use case set into at least one independent use case subset according to the number of runners included in the at least one runner; wherein the independent use case set is used to represent a logical set of independent use cases, and the independent use case is used to represent an execution unit that cannot be further divided and is not premised on the output of any use case; forming each subset in the at least one independent use case subset into a first job to obtain at least one first job; and incorporating the at least one first job into a stage in the pipeline according to the number of jobs supported by each runner to run in parallel; Alternatively, the optimization strategy includes: dividing the set of prerequisite use cases into at least one subset of prerequisite use cases, and dividing the set of conditional use cases into at least one subset of conditional use cases according to the number of runners included in the at least one runner; wherein the set of prerequisite use cases is used to represent a logical set of prerequisite use cases, and the set of conditional use cases is used to represent a logical set of conditional use cases, the prerequisite use cases are independent use cases or conditional use cases, the independent use cases are used to represent execution units that cannot be further divided and are not premised on the output of any use case, and the conditional use cases are used to represent execution units that are premised on the output of the prerequisite use case; each subset in the at least one prerequisite use case set is composed into a second job to obtain at least one second job, and each subset in the at least one conditional use case set is composed into a third job to obtain at least one third job; and the at least one second job and the at least one third job are compiled into the stages in the pipeline according to the number of jobs running in parallel supported by each runner.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program for electronic data exchange, wherein the computer program is operable to cause a computer to execute the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Visualization method and device for continuous delivery, and server
CN109783090A
Configuration method and device for project continuous integration assembly line, equipment and storage medium
CN110597552A
Project construction method, continuous integration system and terminal equipment
CN111144839A
Agile team structure and processes recommendation
US20180068271A1
