Assembly line task generation method and related equipment

Through the pipeline task generation method, pipeline task templates and configuration parameters are used to generate pipeline tasks, which solves the problems of cumbersome script writing and low accuracy in the existing technology, and realizes standardization and low-code arrangement of pipeline tasks.

CN119690521APending Publication Date: 2025-03-25MASHANG CONSUMER FINANCE CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411771232.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

In the existing pipeline task generation method, the script writing process is cumbersome and error-prone, resulting in inaccuracy and inefficiency of task scripts.

Method used

A pipeline task generation method is provided. By responding to the configuration request of the pipeline task, the pipeline task template and task configuration parameters matching the pipeline task are determined. If the parameters comply with the rules, a pipeline task is generated. This method uses pipeline task templates for users to configure, reducing the need for manual writing.

Benefits of technology

It realizes the standardization of pipeline tasks, reduces the cumbersome operations of task script writing, improves the accuracy of task scripts, simplifies the pipeline orchestration process, and provides users with low-coded pipeline task generation convenience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690521A_ABST
    Figure CN119690521A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, in particular to an assembly line task generation method and device, electronic equipment and a computer readable storage medium. The assembly line task generation method comprises the steps that in response to a configuration request of an assembly line task, an assembly line task template matched with the assembly line task and task configuration parameters of the assembly line task are determined, and the assembly line task template comprises task configuration items, parameter configuration rules of the task configuration items and a task script template; the task configuration parameters of the assembly line task are task configuration parameters configured based on the task configuration items; and if the task configuration parameters of the assembly line task accord with the parameter configuration rule, generating the assembly line task based on the task configuration parameters and the task script template. The tedious operation of compiling the task script can be reduced, and the accuracy of the task script is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a pipeline task generation method and related equipment. Background Art

[0002] Pipeline is an orchestrated continuous integration and delivery (CI / CD) method that defines the build, test, and deployment processes in the software development process in code.

[0003] Users can write tasks and combine them through pipelines to build pipelines that can achieve complete functions. However, the script writing process is cumbersome and prone to errors. Summary of the invention

[0004] In view of the above, the embodiments of the present application provide a pipeline task generation method, device, electronic device and computer-readable storage medium, which can reduce the tedious operations of task script writing and improve the accuracy of task scripts.

[0005] In a first aspect, an embodiment of the present application provides a pipeline task generation method, comprising:

[0006] In response to a configuration request of a pipeline task, determining a pipeline task template matching the pipeline task and task configuration parameters of the pipeline task;

[0007] Wherein, the pipeline task template includes a task configuration item, a parameter configuration rule of the task configuration item, and a task script template, and the task configuration parameters of the pipeline task are task configuration parameters configured based on the task configuration item;

[0008] If the task configuration parameters of the pipeline task conform to the parameter configuration rules, the pipeline task is generated based on the task configuration parameters and the task script template.

[0009] The embodiment of the present application adopts a pipeline task template for users to configure. When the task configuration parameters comply with the parameter configuration rules, the pipeline task is generated based on the task configuration parameters and the task script template, which is conducive to the standardization of pipeline tasks, reduces the tedious operations of task script writing, realizes low-code pipeline orchestration, and provides convenience for users to create pipeline tasks.

[0010] In a second aspect, an embodiment of the present application provides a pipeline task generation device, comprising:

[0011] A parameter acquisition module, used to determine, in response to a configuration request of a pipeline task, a pipeline task template matching the pipeline task and task configuration parameters of the pipeline task;

[0012] Wherein, the pipeline task template includes a task configuration item, a parameter configuration rule of the task configuration item, and a task script template, and the task configuration parameters of the pipeline task are task configuration parameters configured based on the task configuration item;

[0013] The task generation module is used to generate a pipeline task based on the task configuration parameters and the task script template when the task configuration parameters of the task configuration item meet the parameter configuration rules.

[0014] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory, wherein the memory is used to store instructions, and the processor is used to call the instructions in the memory so that the electronic device executes the pipeline task generation method described in the first aspect.

[0015] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the pipeline task generation method as described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0017] Figure 1 It is a schematic diagram of the implementation environment of the pipeline task generation method provided according to an embodiment of the present application.

[0018] Figure 2 It is a flowchart of the steps of a pipeline task generation method provided according to an embodiment of the present application.

[0019] Figure 3 It is a schematic diagram of an application scenario for generating a pipeline task according to an embodiment of the present application.

[0020] Figure 4 It is a step flow chart of a pipeline task generation method provided according to another embodiment of the present application.

[0021] Figure 5 It is a schematic diagram of an application scenario of pipeline orchestration provided according to an embodiment of the present application.

[0022] Figure 6 It is a flowchart of the steps of pipeline arrangement verification provided according to an embodiment of the present application.

[0023] Figure 7 It is a flowchart of the steps of topologically sorting an execution sequence graph provided according to an embodiment of the present application.

[0024] Figure 8 It is a structural diagram of a pipeline task generation device provided according to an embodiment of the present application.

[0025] Fig. 9 It is a schematic diagram of the structure of an electronic device provided according to an embodiment of the present application. DETAILED DESCRIPTION

[0026] In order to more clearly understand the above-mentioned purposes, features and advantages of the present application, the present application is described in detail below in conjunction with the accompanying drawings and specific implementation methods. It should be noted that the implementation methods of the present application and the features in the implementation methods can be combined with each other without conflict.

[0027] In the following description, many specific details are set forth to facilitate a full understanding of the present application. The described implementations are only part of the implementations of the present application, rather than all the implementations.

[0028] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application.

[0029] It should be further noted that, in this article, the terms "comprises", "includes" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0030] In this application, "at least one" means one or more, and "more than one" means two or more than two. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The terms "first", "second", "third", "fourth", etc. (if any) in the specification, claims and drawings of this application are used to distinguish similar objects, rather than to describe a specific order or sequence.

[0031] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0032] JavaScript Object Notation (JSON) is a lightweight data representation method. The JSON format uses the "key:value" method to record data.

[0033] json schema: json schema is a json-based format used to describe the specification of Json data structure. It defines the format, structure and content rules of data to ensure the validity and consistency of data. json schema can verify json data to ensure that it complies with the format and requirements. It is widely used in API development, configuration files and data exchange.

[0034] Directed Acyclic Graph (DAG): The main feature of DAG is acyclicity, that is, there is no path from a node back to that node. Directedness means that each edge in the graph has a direction, from one node to another vertex. It is widely used in the field of task scheduling.

[0035] Tekton: Tekton is an open source continuous integration and continuous delivery (CI / CD) system that allows development teams to build, test, and deploy software applications.

[0036] Continuous integration (CI) means that during the development process, developers frequently integrate code into a shared trunk and verify the success of the integration through automated testing.

[0037] Continuous deployment (CD) is the process of automatically deploying an application to a production or test environment after all tests have passed.

[0038] Pipeline: represents a definition of continuous integration and continuous delivery. The pipeline contains a series of pipeline tasks, which define the entire process of code from the version control system to the final deployment.

[0039] Pipeline tasks, which can be referred to as tasks for short, are the basic building blocks of the pipeline. They represent an executable unit of work, such as compilation, testing, image building, etc. They are generally executable shell fragments.

[0040] The task dependency relationship between pipeline tasks refers to the mutual relationship and constraints between the execution order of each pipeline task. The task dependency relationship determines that certain pipeline tasks need to be executed in a specific order to ensure the smoothness and correctness of the pipeline process.

[0041] The dependencies of pipeline tasks are generally the interrelationships and constraints that need to be met due to factors such as the execution logic, data requirements, or resource limitations of the pipeline tasks.

[0042] Run the pipeline (pipelinerun): Running the pipeline is an instance of executing the pipeline. By passing in multiple parameters, the pipeline is executed once.

[0043] Pipeline orchestration: A user-defined pipeline build behavior. Users can select these tasks, arrange the order of execution, and implement the CI build logic they need.

[0044] When choreographing a pipeline, users need to first define the pipeline steps, such as code pull, code check, build, unit test, deployment, and other steps, and then define the execution order of these steps, that is, the user determines the steps that can be serialized and the steps that can be parallelized. Next, users can write tasks according to each step, and then combine tasks to write pipelines, and deploy pipelines and tasks in the cluster.

[0045] However, the amount of work required for users to write pipelines and tasks is large, and the script writing process is cumbersome and prone to errors.

[0046] In view of the above, embodiments of the present application provide a pipeline task generation method, device, electronic device and computer-readable storage medium.

[0047] refer to Figure 1 As shown, Figure 1 A schematic diagram of an implementation environment for a pipeline task generation method provided in an embodiment of the present application.

[0048] See also Figure 1 , Figure 1 The schematic diagram of the implementation environment of the pipeline task generation method provided in the embodiment of the present application is shown in FIG. 1 , and the implementation environment of the embodiment may include an electronic device 100. The electronic device 100 is integrated with the pipeline task generation device provided in the embodiment of the present application.

[0049] The electronic device 100 is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to a processor, a microprogrammed control unit (MCU), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a digital signal processor (DSP), an embedded device, etc.

[0050] The electronic device 100 may be a computer, a network host, a single network server, a plurality of network servers, or a cloud server composed of a plurality of servers, but is not limited thereto. The cloud server may be composed of a large number of computers or network servers based on cloud computing.

[0051] Those skilled in the art will understand that Figure 1 The implementation environment shown in is merely one implementation environment of the present application and does not constitute a limitation on the implementation environment of the present application.

[0052] In addition, if Figure 1 As shown, the implementation environment may also include a display device 200, which is used to provide a display interface to interact with the user and transmit interactive data to the electronic device 100. For example, the display device 200 may receive a user's pipeline task configuration request and transmit it to the electronic device 100.

[0053] The electronic device 100 can obtain task configuration parameters of task configuration items in a pipeline task template in response to a configuration request of a pipeline task. The pipeline task template includes the task configuration items to be configured for the pipeline task, parameter configuration rules of the task configuration items, and a task script template.

[0054] When the task configuration parameters of the task configuration items conform to the parameter configuration rules, the electronic device 100 may also generate a pipeline task based on the task configuration parameters and the task script template.

[0055] The embodiments of the present application can reduce the tedious operations of task script writing, realize low-code pipeline orchestration, and provide convenience for users to create pipeline tasks.

[0056] refer to Figure 2 and Figure 3 As shown, Figure 2 It is a step flow chart of an embodiment of the pipeline task generation method of the present application. Figure 3The following is a schematic diagram of an application scenario for generating a pipeline task provided by an embodiment of the present application. The pipeline task generation method may include the following steps.

[0057] Step 201, in response to a configuration request of a pipeline task, determining a pipeline task template matching the pipeline task and task configuration parameters of the pipeline task.

[0058] For example, the display device can provide a visual interface, which displays identifiers of various types of pipeline task templates and task configuration items defined in the pipeline task templates. The user can select the type of configured pipeline task in the visual interface and input the task configuration parameters of these task configuration items. For example, the user can input the task configuration parameters of the task configuration items in the format of json data. After the display device obtains the task configuration parameters, it can package them into a configuration request for the pipeline task and transmit the configuration request for the pipeline task to the electronic device. For example, the json data can be transmitted to the electronic device.

[0059] After receiving a configuration request for a pipeline task, the electronic device can parse the configuration request to obtain an identifier of the pipeline task template and task configuration parameters of the pipeline task. The electronic device can also search for the pipeline task template marked by the identifier in pre-stored pipeline task templates.

[0060] The identifier of the pipeline task template can be used to indicate the type of the pipeline task template, etc., but is not limited thereto.

[0061] The types of pipeline task templates can include code pulling, code scanning, unit testing, compilation and building, build upload, image generation, host deployment, callback notification and other task templates.

[0062] Different types of pipeline task templates have data formats, data contents, etc. adapted to them, which are not limited in the embodiments of the present application.

[0063] Step 202: Check whether the task configuration parameters of the pipeline task comply with the parameter configuration rules.

[0064] The pipeline task template may include a task script template, a task configuration item, and parameter configuration rules of the task configuration item. The task script template, the task configuration item, and the parameter configuration rules of the task configuration item are described below:

[0065] 1.Task script template:

[0066] The task script template is a general script template for this type of pipeline task. The task script template can be a shell template.

[0067] 2. Task configuration items:

[0068] Task configuration items are used to define the types of task configuration parameters that need to be passed into the task script template. For example, task configuration items may include image version, deployment resources, deployment node preference, number of retries, programming language type, build type, etc., but are not limited to these.

[0069] In the task configuration items, you can use json schema technology to define the configuration parameter options and fillable items of the task configuration items. For example, you can refer to the following:

[0070] (1) Yes or No, such as whether the compilation and build task requires security hardening.

[0071] (2) Single option, such as providing multiple Maven versions for compilation and build tasks.

[0072] (3) Multiple options, such as the compilation task requires the destination address of the uploaded build.

[0073] (4) Fillable items, such as the compile and build commands that need to be filled in for the compile and build task.

[0074] (5) Additional items, such as additional commands that need to be filled in.

[0075] Using json Schema to define the type of input parameters of task configuration items can guide users in configuration and help standardize the input configuration parameters.

[0076] 3. Parameter configuration rules for task configuration items:

[0077] The parameter configuration rules of a task configuration item refer to the constraint rules for the task configuration parameters input into the task configuration item. The parameter configuration rules can be implemented using json schema technology.

[0078] For example, the constraint rule may include a format constraint rule of a task configuration parameter.

[0079] The format constraint rule is used to represent the constraint on the input format of the task configuration parameter. For example, the step of the electronic device checking whether the task configuration parameter of the task configuration item conforms to the format constraint rule may include:

[0080] (1) Check whether the task configuration parameters include a string. If the task configuration parameters include a string, a true value (true) may be returned; if not, a false value (false) may be returned.

[0081] (2) Check whether the task configuration parameters satisfy the regular expression. If the task configuration parameters satisfy the regular expression, a true value may be returned; if the task configuration parameters do not satisfy the regular expression, a false value may be returned.

[0082] (3) Check whether the task configuration parameters meet the string length requirement. If the task configuration parameters meet the string length requirement, a true value may be returned; if the task configuration parameters do not meet the string length requirement, a false value may be returned.

[0083] (4) Check whether the value of the task configuration parameter meets the preset value range. If the task configuration parameter meets the value range, a true value can be returned; if the task configuration parameter does not meet the value range, a false value can be returned.

[0084] If the test result of a format constraint rule is a false value, it proves that the task configuration parameters do not satisfy the format constraint rule; if the test result of a format constraint rule is a true value, it proves that the task configuration parameters satisfy the format constraint rule.

[0085] The above format constraint rules are only examples and can be configured according to requirements in actual application process, and the embodiments of the present application are not limited to this.

[0086] For another example, the parameter configuration rule of the task configuration item may include a parameter association relationship between the task configuration parameters.

[0087] The parameter association relationship between task configuration parameters means that when the task configuration parameter of a certain task configuration item is configured to a specific value (also called a target configuration parameter), another task configuration item has the permission to be configured.

[0088] For example, there is a first configuration item in the pipeline task template, which is a task configuration item that is associated with a preset configuration item key-value pair. The configuration item key-value pair includes an identifier of a task configuration item associated with the first configuration item (recorded as a second configuration item), and a target configuration parameter of the second task configuration item.

[0089] The electronic device can search for the task configuration item marked by the identifier in the pipeline task template based on the configuration item key-value pair to obtain the second configuration item; when the task configuration parameters of the second configuration item are different from the target configuration parameters, it means that the first configuration item does not have the permission to be configured. Therefore, if the task configuration parameters of the first configuration item exist in the task configuration parameters of the pipeline task, it means that the user has still configured the first configuration item, which indicates that the task configuration parameters of the pipeline task do not satisfy the parameter association relationship, that is, the first configuration item does not comply with the parameter configuration rules.

[0090] When the task configuration parameters of the second configuration item are the same as the target configuration parameters, it means that the first configuration item has the permission to be configured, and the user can configure the first configuration item, that is, the task configuration parameters of the pipeline task can include the task configuration parameters of the first configuration item.

[0091] For example, the first configuration item is "build type". The build type indicates that the pipeline task can be built using Maven technology or Gradle technology. The target key-value pair associated with the first configuration item includes the identifier and target configuration parameters of the second configuration item. Assume that the second configuration item represents the configuration of "programming language type" and the target configuration parameter is "java language". When the actual task configuration parameter of the second configuration item is "java language", it means that the configuration permission of the first configuration item can be enabled, that is, the user can configure the first configuration item.

[0092] When the task configuration parameter of the second configuration item is "C language", it means that the first configuration item does not have the configured permission. If the received task configuration parameters contain the task configuration parameters of the first configuration item, the electronic device can confirm that the task configuration parameters of the first configuration item do not comply with the parameter configuration rules.

[0093] That is, only when the "Programming language type" is "Java language" can you have the permission to configure the "Build type"; when the "Programming language type" is not "Java language", you cannot configure the "Build type". If the electronic device still receives the task configuration parameters of the "Build type", it means that the task configuration parameters are incorrectly configured and the task configuration parameters do not comply with the parameter configuration rules.

[0094] The parameter association relationship between task configuration parameters can also be implemented using json schema technology. For example, add the identifier of the associated task configuration item (such as the identifier of the second configuration item) in the json schema corresponding to the parameter configuration rule of the first configuration item. If the electronic device detects that the identifier of the first configuration item exists in the parameter configuration rule of the first configuration item, it can search for the task configuration parameter of the second configuration item based on the identifier and determine whether the task configuration parameter of the second configuration item is the target configuration parameter; if the task parameter is the target task configuration parameter, it is confirmed that the first configuration item meets the parameter dependency relationship.

[0095] If the electronic device confirms that the task configuration parameters meet the parameter configuration rules, the electronic device may execute the following step 2031. If the electronic device confirms that the task configuration parameters do not meet the parameter configuration rules, the electronic device may execute step 2032, that is, prompting the user that the task configuration parameters are incorrect.

[0096] Step 2031, generating a pipeline task based on the task configuration parameters and the task script template.

[0097] In some embodiments, the parameter configuration rule may include at least one of: a format constraint rule and a parameter association relationship between task configuration parameters. When the task configuration parameters of each task configuration item in the pipeline task template all meet the corresponding parameter configuration rule, the pipeline task can be generated based on the task configuration item and the task script template.

[0098] For example, the generation of the pipeline task based on the task configuration parameters and the task script template can be implemented in the following manner:

[0099] Step 1: The electronic device parses the task script template to obtain a syntax tree of the task script template.

[0100] In some embodiments, step 1 can be implemented as follows:

[0101] The first step is to parse the task script template to obtain the tag flow of the task script template, wherein the tag flow includes variable tags, text tags and action tags.

[0102] For example, the electronic device may decompose the task script template into characters, then search for the start symbol and the end symbol of the tag in each character, and analyze the content of the character string between the start symbol and the end symbol to determine the type of the tag.

[0103] The types of tags include variables, texts, and actions, etc. Actions can be judgments (such as if), loops (such as for loops, while loops), method calls, etc.

[0104] The second step is to create a root node, which is used to identify the task script template.

[0105] The third step is to traverse the marker stream.

[0106] The processing process for each traversed mark stream can be as follows:

[0107] When the traversed current tag (referred to as the first tag) is the text tag or the variable tag, the current tag is used as a child node of the root node.

[0108] Specifically, for a text tag, a text node is created and added to the child node list of the root node. The text node contains the text content in the tag.

[0109] For variable tags, create a variable node and add it to the root node's child node list. The variable node contains the variable's name, etc.

[0110] In the case that the current mark is an action mark, the electronic device constructs a subtree based on the type of the action mark, and uses the subtree as a child node of the root node.

[0111] For example, action tags generally include sub-tags. For tags containing sub-tags (such as branches in if actions), these sub-tags can be processed recursively and corresponding sub-trees can be constructed. These sub-trees will be added to the child node list of the parent node.

[0112] When the traversal of each tag in the tag stream is completed, the syntax tree of the task script template is obtained, and then the electronic device can execute step 2.

[0113] Step 2: Generate the pipeline task based on the syntax tree and the task configuration parameters.

[0114] After obtaining the syntax tree, the variable values ​​in the syntax tree that match the task configuration items may be updated to task configuration parameters to obtain an updated syntax tree, and then a task script representing the pipeline task may be generated based on the updated syntax tree.

[0115] The embodiment of the present application parses the task script template to analyze the elements (i.e., tags) therein that represent actual meanings, such as variables, text, and action tags, and generates a syntax tree based on the tag stream. The syntax tree can reflect the code structure of the script template, so that when the code of the corresponding pipeline task is generated in combination with the task configuration parameters, the code structure and code semantics of the script template are not lost, thereby ensuring the accuracy of the generated pipeline task code.

[0116] In some embodiments, after obtaining the task script, the task script may be deployed to the cluster based on the cluster deployment information of the task configuration parameters. The cluster deployment information may include image name, build parameters, mount key, etc., but is not limited thereto.

[0117] The embodiment of the present application adopts a pipeline task template for users to configure. When the task configuration parameters comply with the parameter configuration rules, the pipeline tasks are automatically generated based on the task configuration parameters and the task script template. This is conducive to the standardization of pipeline tasks, reducing the tedious operations of task script writing, realizing low-code pipeline orchestration, and providing convenience for users to create pipeline tasks.

[0118] In some embodiments, after generating the pipeline task, the electronic device may also obtain pipeline scheduling information, and generate tasks based on the pipeline scheduling information and the pipeline task to generate a pipeline.

[0119] refer to Figure 4 and Figure 5 As shown, the pipeline task generation method may further include:

[0120] Step 204: Respond to the pipeline scheduling request and obtain pipeline scheduling information.

[0121] For example, the display device can display the pipeline orchestration interface, and the user can input pipeline orchestration information in the pipeline orchestration interface. After the display device obtains the pipeline orchestration information from the pipeline orchestration interface, it packages the pipeline orchestration information to obtain a pipeline orchestration request, and sends the pipeline orchestration request to the electronic device. The electronic device can respond to the pipeline orchestration request and parse the pipeline orchestration request to obtain the pipeline orchestration information.

[0122] The pipeline scheduling information is used to indicate the pipeline tasks included in the pipeline to be generated, and the execution order of the pipeline tasks.

[0123] Specifically, the configuration methods of pipeline orchestration information include:

[0124] 1. Specify the pipeline tasks included in the pipeline to be generated.

[0125] 2. Define the execution order of pipeline tasks, where the configuration method of the execution order of pipeline tasks may include:

[0126] (1) Specify the order in which the pipeline tasks are executed. For example, execute pipeline task A first, then execute pipeline task B.

[0127] (2) Specify the triggering conditions for the execution of pipeline tasks. For example, if pipeline A is executed and a certain triggering condition is met, then pipeline task B will be executed.

[0128] The above-mentioned order of execution of pipeline tasks is only an example. In actual application, it can be set according to needs, and the embodiments of the present application are not limited to this.

[0129] Step 205: Generate a pipeline based on the pipeline scheduling information and the pipeline tasks.

[0130] In some embodiments, after receiving the pipeline scheduling information, the electronic device may generate a pipeline according to the execution order of each pipeline task in the pipeline scheduling information.

[0131] In some other embodiments, step 205 may also be implemented in the following manner: detecting whether the pipeline scheduling information satisfies the pipeline scheduling rules; if the pipeline scheduling information satisfies the pipeline scheduling rules, generating a pipeline based on the pipeline scheduling information.

[0132] Pipeline orchestration rules can be implemented using json Schema technology.

[0133] The embodiment of the present application detects the pipeline arrangement information based on the pipeline arrangement rules, which can improve the accuracy of the pipeline arrangement information.

[0134] In some embodiments, the pipeline orchestration rules include that each pipeline task in the pipeline has a directed acyclic characteristic. The above-mentioned detection of whether the pipeline orchestration information satisfies the pipeline orchestration rules includes: the electronic device generates an execution sequence diagram based on the pipeline orchestration information, wherein the execution sequence diagram includes multiple task nodes and directed edges for connecting the task nodes, the task nodes represent pipeline tasks, and the directed edges represent the execution order of the pipeline tasks; if the execution sequence diagram is a directed acyclic graph, confirming that the pipeline orchestration information satisfies the directed acyclic characteristic.

[0135] The embodiment of the present application can prevent users from mistakenly configuring pipeline tasks into an infinite loop mode by checking whether the execution steps of each pipeline task satisfy the directed acyclic property, thereby ensuring the accuracy of the pipeline configuration.

[0136] In some embodiments, the pipeline orchestration rules further include task dependencies between the pipeline tasks, and the detecting whether the pipeline orchestration information satisfies the pipeline orchestration rules may further include: detecting whether the pipeline orchestration information satisfies the task dependency rules.

[0137] Among them, the task dependency rule is used to describe the forward or backward dependency relationship between pipeline tasks.

[0138] A forward dependency is a pipeline task that needs to be executed before another pipeline task is executed, for example, the pull code task needs to be executed before the edit build task is executed.

[0139] A backward dependency refers to another pipeline task that needs to be executed after the execution of a pipeline task.

[0140] Furthermore, the embodiment of the present application can also detect the task dependency relationship between pipeline tasks in combination with a directed acyclic graph. That is, the electronic device can first generate an execution sequence graph, and then check whether the execution sequence is a directed acyclic graph. If the execution sequence graph is a directed acyclic graph, the pipeline arrangement information is checked based on the execution sequence graph to see whether it meets the task dependency rule.

[0141] Specifically, please refer to Figure 6 As shown, the step of detecting whether the pipeline arrangement information satisfies the pipeline arrangement rule may include:

[0142] Step 601: Generate an execution sequence diagram based on pipeline arrangement information.

[0143] The execution sequence diagram includes a plurality of task nodes and directed edges for connecting the task nodes, the task nodes represent pipeline tasks, and the directed edges represent the execution order of the pipeline tasks.

[0144] Step 602, detecting whether the execution sequence graph is a directed acyclic graph.

[0145] If the execution sequence graph is a directed acyclic graph, execute steps 603 to 604 ; if the execution sequence graph is not a directed acyclic graph, execute step 605 .

[0146] Step 603: Check whether each pipeline task satisfies the task dependency relationship based on the execution sequence diagram.

[0147] For example, the electronic device may perform topological sorting on the execution sequence graph to obtain a sorting queue of the execution sequence graph, and then determine whether each pipeline task satisfies the task dependency relationship based on the sorting queue.

[0148] Among them, when the topological sorting is completed, the sorting queue of the execution sequence graph meets the following two conditions:

[0149] 1. All task nodes in the execution sequence diagram appear in the sorting queue and only appear once.

[0150] 2. If there is a path from task node A to task node B in the execution sequence graph, task node A appears before task node B in the sorting queue.

[0151] In some embodiments, reference Figure 7 As shown, the steps of performing topological sorting of the electronic device may include:

[0152] Step 701, calculate the in-degree of each task node in the execution sequence graph to obtain an in-degree node set.

[0153] That is, the in-degree node set stores the in-degree of each task node in the execution task sequence graph.

[0154] The electronic device may also create a sorting queue, which is initially empty.

[0155] Step 702: Add the first node in the in-degree node set to a sorting queue.

[0156] Among them, the first node is a node with in-degree zero.

[0157] Step 703: Delete the first node from the in-degree node set.

[0158] Step 704: Check whether there are any task nodes in the in-degree node set.

[0159] If there is a task node in the in-degree node set, execute step 705; if there is no task node in the in-degree node set, execute step 706.

[0160] Step 705: In the in-degree node set, reduce the in-degree of the second node by one.

[0161] The second node is a successor node of the first node.

[0162] After step 705 , step 702 may be continued until there is no task node in the in-degree node set, indicating that all task nodes have been added to the sorting queue and the topological sorting is completed. The electronic device may then execute step 706 .

[0163] Step 706: Determine whether the pipeline task scheduling information satisfies the task dependency based on the sorting queue.

[0164] In some embodiments, the order of execution of pipeline tasks represented in the task dependency rule can be compared with the topological sorting result. If the two are consistent, it is determined that the pipeline scheduling information meets the task dependency rule, and step 604 can be executed; if the two are inconsistent, it is determined that the pipeline scheduling information does not meet the task dependency rule, and step 605 can be executed.

[0165] Step 604: confirm that the pipeline scheduling information satisfies the pipeline scheduling rules.

[0166] Step 605: Issue an arrangement error prompt.

[0167] For example, the orchestration error prompt may carry the cause of the orchestration error, such as the pipeline orchestration information not satisfying the directed acyclic property, or the pipeline orchestration information not satisfying the task dependency.

[0168] In the above manner, it is possible to check whether the pipeline scheduling information satisfies the pipeline scheduling rules. After confirming that the pipeline scheduling information satisfies the pipeline scheduling rules, the electronic device can generate a pipeline based on the pipeline scheduling information and the pipeline task.

[0169] In some embodiments, the electronic device can generate a directed acyclic pipeline orchestration graph based on the pipeline orchestration information and the pipeline task, each node in the pipeline orchestration graph includes a referenced pipeline task, a construction parameter type, a variable transfer rule of the pipeline task, a conditional judgment statement for triggering task construction, etc. Then, the electronic device can use a topological sorting algorithm to traverse the pipeline orchestration graph from a node with an in-degree of zero. Each node in the pipeline orchestration graph is traversed to the node with the in-degree of zero. Figure 1 A node is found and the deployment resource corresponding to the node is determined. After the directed acyclic graph is traversed, the deployment resource corresponding to the pipeline can be determined, and the pipeline can be deployed to the cluster according to the deployment resource.

[0170] After the pipeline is deployed, the user can enter build parameters, such as branch, image number, product name, version number, etc., to initiate a continuous integration build task.

[0171] In the embodiment of the present application, the user can configure the pipeline arrangement information in the front-end interface to realize the pipeline arrangement, reduce the difficulty of the pipeline arrangement, and simplify the pipeline arrangement process. In addition, the embodiment of the present application can automatically check the pipeline arrangement information to ensure the accuracy of the pipeline arrangement information, thereby ensuring the accuracy of the pipeline.

[0172] Based on the same idea as the pipeline task generation method in the above embodiment, the present application also provides a pipeline task generation device, which can be used to execute the above pipeline task generation method. For ease of explanation, the structural diagram of the pipeline task generation device embodiment only shows the parts related to the embodiment of the present application. It can be understood by those skilled in the art that the illustrated structure does not constitute a limitation on the device, and may include more or fewer components than shown in the diagram, or combine certain components, or arrange the components differently.

[0173] like Figure 8 As shown, the pipeline task generation device includes a parameter acquisition module 801 and a task generation module 802. In some embodiments, the above modules can be programmable software instructions stored in a memory and can be called and executed by a processor. It is understood that in other embodiments, the above modules can also be program instructions or firmware fixed in the processor.

[0174] The parameter acquisition module 801 is used to determine the pipeline task template matching the pipeline task and the task configuration parameters of the pipeline task in response to the configuration request of the pipeline task;

[0175] Wherein, the pipeline task template includes a task configuration item, a parameter configuration rule of the task configuration item, and a task script template, and the task configuration parameters of the pipeline task are task configuration parameters configured based on the task configuration item;

[0176] The task generation module 802 is used to generate a pipeline task based on the task configuration parameters and the task script template when the task configuration parameters of the task configuration item meet the parameter configuration rules.

[0177] Fig. 9 This is a schematic diagram of an embodiment of an electronic device of the present application.

[0178] The electronic device 100 includes a memory 20, a processor 30, and a computer program 40 stored in the memory 20 and executable on the processor 30. When the processor 30 executes the computer program 40, the steps in the above pipeline task generation method embodiment are implemented, for example Figure 2 Steps 201, 202, 2031 and 2032 shown in FIG. Figure 4 Steps 201 to 205 are shown.

[0179] Exemplarily, the computer program 40 can also be divided into one or more modules / units, which are stored in the memory 20 and executed by the processor 30. The one or more modules / units can be a series of computer program instruction segments that can perform specific functions, and the instruction segments are used to describe the execution process of the computer program 40 in the electronic device 100. For example, it can be divided into Figure 8 The parameter acquisition module 801 and the task generation module 802 are shown.

[0180] Those skilled in the art will understand that the schematic diagram is merely an example of the electronic device 100 and does not constitute a limitation of the electronic device 100. The electronic device 100 may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device 100 may also include input and output devices, network access devices, buses, etc.

[0181] The processor 30 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor, a single-chip microcomputer, or the processor 30 may also be any conventional processor, etc.

[0182] The memory 20 can be used to store the computer program 40 and / or the module / unit. The processor 30 realizes various functions of the electronic device 100 by running or executing the computer program and / or the module / unit stored in the memory 20 and calling the data stored in the memory 20. The memory 20 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data (such as audio data) created according to the use of the electronic device 100, etc. In addition, the memory 20 can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other non-volatile solid-state storage devices.

[0183] If the module / unit integrated in the electronic device 100 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0184] In the several embodiments provided in this application, it should be understood that the disclosed electronic device and method can be implemented in other ways. For example, the electronic device embodiments described above are only schematic, for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation.

[0185] In addition, each functional unit in each embodiment of the present application may be integrated into the same processing unit, each unit may exist physically separately, or two or more units may be integrated into the same unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.

[0186] It is obvious to those skilled in the art that the present application is not limited to the details of the above exemplary embodiments, and that the present application can be implemented in other specific forms without departing from the spirit or basic features of the present application. Therefore, no matter from which point of view, the embodiments should be regarded as exemplary and non-restrictive. In addition, it is obvious that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or electronic devices stated in the electronic device claim can also be implemented by the same unit or electronic device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.

[0187] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present application and are not intended to limit it. Although the present application has been described in detail with reference to the above embodiments, a person of ordinary skill in the art should understand that the technical solution of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present application.

Claims

1. A pipeline task generation method, characterized in that: include: In response to a configuration request of a pipeline task, determine a pipeline task template matching the pipeline task and task configuration parameters of the pipeline task; wherein the pipeline task template includes a task configuration item, a parameter configuration rule of the task configuration item, and a task script template, and the task configuration parameters of the pipeline task are task configuration parameters configured based on the task configuration item; If the task configuration parameters of the pipeline task conform to the parameter configuration rules, the pipeline task is generated based on the task configuration parameters and the task script template.

2. The pipeline task generation method according to claim 1, characterized in that: The task configuration items of the pipeline task template include a first configuration item; The first configuration item is a task configuration item associated with a preset configuration item key-value pair, wherein the configuration item key-value pair includes an identifier of a task configuration item associated with the first configuration item and a target configuration parameter of the task configuration item; After determining the pipeline task template matching the pipeline task and the task configuration parameters of the pipeline task, the method further includes: Searching for a task configuration item corresponding to the identifier in the pipeline task template to obtain a second configuration item; If the task configuration parameters of the second configuration item are different from the target configuration parameters, and the task configuration parameters of the pipeline task include the task configuration parameters of the first configuration item, then the task configuration parameters of the pipeline task do not comply with the parameter configuration rules.

3. The pipeline task generation method according to claim 1, characterized in that: The generating of the pipeline task based on the task configuration parameters and the task script template includes: Parsing the task script template to obtain a tag stream of the task script template, wherein the tag stream includes variable tags, text tags, and action tags; Creating a root node, where the root node is used to identify a task script template; Traversing the tag stream, and when the first traversed tag is the text tag or the variable tag, taking the first tag as a child node of the root node; In the case where the first tag is an action tag, constructing a subtree based on the type of the action tag, and using the subtree as a child node of the root node; When the traversal of each tag in the tag stream is completed, a syntax tree of the task script template is obtained; The pipeline task is generated based on the syntax tree and the task configuration parameters.

4. The pipeline task generation method according to any one of claims 1 to 3, characterized in that: After generating the pipeline task based on the task configuration parameters and the task script template, the method further includes: In response to the pipeline scheduling request, obtaining pipeline scheduling information, wherein the pipeline scheduling information is used to indicate pipeline tasks included in the pipeline to be generated and the execution order of the pipeline tasks; A pipeline is generated based on the pipeline scheduling information and the pipeline tasks.

5. The pipeline task generation method according to claim 4, characterized in that: The generating a pipeline based on the pipeline arrangement information and the pipeline task includes: If the pipeline scheduling information satisfies the pipeline scheduling rule, a pipeline is generated based on the pipeline scheduling information and the pipeline task.

6. The pipeline task generation method according to claim 5, characterized in that: The pipeline scheduling rule includes that each pipeline task in the pipeline has a directed acyclic characteristic; The pipeline arrangement information satisfies the pipeline arrangement rule, including: generating an execution sequence diagram based on the pipeline arrangement information; The execution sequence diagram includes a plurality of task nodes and directed edges for connecting the task nodes, the task nodes represent pipeline tasks, and the directed edges represent the execution order of the pipeline tasks; If the execution sequence graph is a directed acyclic graph, confirm that the pipeline scheduling information satisfies the directed acyclic property.

7. The pipeline task generation method according to claim 6, characterized in that: The pipeline scheduling rule also includes the task dependency relationship between the pipeline tasks, and after confirming that the pipeline scheduling information satisfies the directed acyclic property, further includes: Calculate the in-degree of each task node in the execution sequence graph to obtain an in-degree node set; In the in-degree node set, adding a first node to a sorting queue, where the first node is a node with an in-degree of zero; Deleting the first node from the in-degree node set; If there is a task node in the in-degree node set, then in the in-degree node set, the in-degree of the second node is reduced by one, wherein the second node is a successor node of the first node; and the step of adding the first node to the sorting queue in the in-degree node set is continued; If there is no task node in the in-degree node set, determining whether the pipeline task scheduling information satisfies the task dependency relationship is based on the sorting queue.

8. A pipeline task generation device, characterized in that: include: A parameter acquisition module, used to determine, in response to a configuration request of a pipeline task, a pipeline task template matching the pipeline task and task configuration parameters of the pipeline task; Wherein, the pipeline task template includes a task configuration item, a parameter configuration rule of the task configuration item, and a task script template, and the task configuration parameters of the pipeline task are task configuration parameters configured based on the task configuration item; The task generation module is used to generate a pipeline task based on the task configuration parameters and the task script template when the task configuration parameters of the task configuration item meet the parameter configuration rules.

9. An electronic device, comprising a processor and a memory, characterized in that: The memory is used to store instructions, and the processor is used to call the instructions in the memory, so that the electronic device executes the pipeline task generation method according to any one of claims 1 to claim 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed on an electronic device, the electronic device executes the pipeline task generation method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Micro-service task node management method and system, electronic equipment and medium

    CN120687207A