Task generation method and device, electronic equipment, storage medium and program product

By analyzing the continuous integration task configuration file and generating custom task construction parameters, the problem of fixed task generation methods in the existing technology is solved, the ability to flexibly generate diversified continuous integration tasks is realized, and the adaptation between tasks and business needs is improved. sex.

CN119166191APending Publication Date: 2024-12-20MASHANG CONSUMER FINANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410757634.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-12
Publication Date
2024-12-20

AI Technical Summary

Technical Problem

The task generation method in the existing continuous integration construction tool is fixed, and it is impossible to flexibly generate diverse continuous integration tasks and cannot meet actual business needs.

Method used

By analyzing the task configuration file of the continuous integration task, the task generation function and customized task construction parameters are obtained, and the task generation function is run based on the construction parameters to generate a diverse continuous integration task.

Benefits of technology

It realizes flexible generation of diversified continuous integration tasks based on actual business needs, and improves the flexibility and adaptability of task generation methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119166191A_ABST
    Figure CN119166191A_ABST
Patent Text Reader

Abstract

The invention provides a task generation method and device, electronic equipment, a computer readable medium and a computer program product, and belongs to the technical field of computers. The method comprises the following steps: analyzing a task configuration file of a continuous integration task to obtain a task generation function and a self-defined task construction parameter; running the task generation function according to the task construction parameter to obtain a function running result; and generating a continuous integration task according to a function operation result. According to the method, the function operation result of the task generation function can be flexibly configured according to actual business requirements, so that diversified and self-defined continuous integration tasks can be conveniently and flexibly generated.
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 task generation method, device, electronic device, storage medium and program product. Background Art

[0002] In the process of business operation, various tasks need to be generated and executed, such as continuous integration tasks. Among them, continuous integration is a software development practice. By executing multiple continuous integration tasks in sequence, effective quality control of project code can be achieved.

[0003] In the related art, continuous integration tasks can usually be automatically generated by continuous integration building tools. Among them, the task generation method of the continuous integration task is preset in the continuous integration building tool, so through the continuous integration building tool, a continuous integration task can be quickly generated according to the corresponding task generation method.

[0004] However, in the above, the task generation method in the continuous integration build tool is fixed, so it is impossible to flexibly generate diverse continuous integration tasks. Summary of the invention

[0005] The present application provides a task generation method, device, electronic device, storage medium and program product.

[0006] In a first aspect, the present application provides a task generation method, comprising:

[0007] Parse the task configuration file of the continuous integration task to obtain the task generation function and customized task construction parameters;

[0008] Run the task generation function according to the task construction parameters to obtain the function running result;

[0009] Generate a continuous integration task according to the function running result.

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

[0011] The parsing module is used to parse the task configuration file of the continuous integration task to obtain the task generation function and customized task construction parameters;

[0012] An operation module is used to run the task generation function according to the task construction parameters to obtain a function operation result;

[0013] A generation module is used to generate a continuous integration task according to the function running result.

[0014] In a third aspect, the present application provides an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores one or more computer programs executable by the at least one processor, and one or more of the computer programs are executed by the at least one processor so that the at least one processor can perform the above-mentioned task generation method.

[0015] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the above-mentioned task generation method when executed by a processor / processing core.

[0016] In a fifth aspect, the present application provides a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying a computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above-mentioned task generation method.

[0017] The task generation method, device, equipment, and medium provided in the embodiments of the present application can obtain a task generation function and customized task construction parameters by parsing the task configuration file of the continuous integration task. As the name implies, the parameter types and specific values ​​of the customized task construction parameters can be flexibly configured according to actual conditions. Therefore, by running the task generation function according to the customized task construction parameters, the function running results of the task generation function can be flexibly configured according to actual business needs, thereby facilitating the flexible generation of diverse and customized continuous integration tasks. This method solves the defect of a single task generation method for continuous integration tasks, and can flexibly generate a variety of continuous integration tasks.

[0018] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The accompanying drawings are used to provide a further understanding of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the present application and do not constitute a limitation of the present application. The above and other features and advantages will become more apparent to those skilled in the art by describing detailed example embodiments with reference to the accompanying drawings. In the accompanying drawings:

[0020] Figure 1 A flowchart of a task generation method provided in an embodiment of the present application;

[0021] Figure 2 A flowchart of a task generation method provided in an embodiment of the present application;

[0022] Figure 3 A block diagram of a task generation device provided in an embodiment of the present application;

[0023] Figure 4 A block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0024] In order to enable those skilled in the art to better understand the technical solution of the present application, the exemplary embodiments of the present application are described below in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0025] In the absence of conflict, the embodiments of the present application and the features therein may be combined with each other.

[0026] As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.

[0027] The terms used herein are only used to describe specific embodiments and are not intended to limit the present application. As used herein, the singular forms "a" and "the" are also intended to include plural forms, unless the context clearly indicates otherwise. It will also be understood that when the terms "including" and / or "made of" are used in this specification, the presence of the features, wholes, steps, operations, elements and / or components is specified, but the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof is not excluded. "Connected" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect.

[0028] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by those of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this application, and will not be interpreted as having an idealized or overly formal meaning unless explicitly defined herein.

[0029] In the related art, continuous integration tasks can usually be automatically generated by continuous integration build tools. Among them, the task generation method of continuous integration tasks is preset in the continuous integration build tool. Therefore, through the continuous integration build tool, a continuous integration task can be quickly generated according to the corresponding task generation method. However, the above-mentioned continuous integration tasks are all fixed task contents preset by the build tool, which cannot meet the flexible business processing requirements. In order to solve the above problems, in this application, a task generation method, device, equipment, and medium are proposed. By parsing the task configuration file of the continuous integration task, a task generation function and a customized task construction parameter can be obtained. As the name implies, the parameter type and specific value of the customized task construction parameter can be flexibly configured according to the actual situation. Therefore, the task generation function is run according to the customized task construction parameter, and the function running result of the task generation function can be flexibly configured according to the actual business needs, so as to facilitate the flexible generation of diversified and customized continuous integration tasks. This method solves the defect of the single task generation method of the continuous integration task, and can flexibly generate a variety of continuous integration tasks.

[0030] The task generation method according to the embodiment of the present application can be performed by an electronic device such as a terminal device or a server, and the terminal device can be a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. The method can be implemented by a processor calling a computer-readable program instruction stored in a memory. The server can be an independent physical server, a server cluster composed of multiple servers, or a cloud server capable of cloud computing.

[0031] Figure 1 A flowchart of a task generation method provided in an embodiment of the present application. Figure 1 , the method comprising:

[0032] Step S110: parsing the task configuration file of the continuous integration task to obtain the task generation function and the customized task construction parameters.

[0033] The task configuration file of the continuous integration task is a configuration file written by the user according to the application scenario for generating the continuous integration task, and the task configuration file includes the function and parameter information for generating the continuous integration task. For example, the task configuration file includes the task generation function and the task construction parameters for generating the continuous integration task that can be run by the build tool.

[0034] In addition, the task configuration file may also include resource information required for the continuous integration task to run, such as image information, CPU capacity used by the task application, CPU capacity used by the task limit, memory capacity used by the task request, memory capacity used by the task limit, etc., as well as related processing functions such as function verification and parameter verification required to generate the continuous integration task. In short, the specific content of the task configuration file can be adaptively written by the user according to the needs of building the continuous integration task, and the embodiments of the present application do not limit this.

[0035] It should be noted that there are many ways to obtain the task configuration file of the continuous integration task: it can be automatically obtained by automatic monitoring and triggering, for example, a user submits a task configuration file at a specified location, and the specified location is monitored in real time. If the addition or modification of the task configuration file is detected, the newly added or modified task configuration file at the specified location is directly obtained to achieve timely acquisition of the task configuration file. It can also be obtained by receiving user requests. For example, a user initiates a task generation request. After receiving the request, the corresponding task configuration file can be obtained from the address of the task configuration file and the name of the task configuration file contained in the request parameters. This embodiment of the present application does not limit this.

[0036] The task generation function is used to generate the corresponding continuous integration task. For example, when there are multiple task generation functions, each task generation function can be used to generate a corresponding continuous integration task, such as code cloning, code testing, etc. The task generation function may include task generation logic, task scripts, and other task generation-related content.

[0037] Among them, the task generation logic defines the process of composing the relevant content of the continuous integration task (such as task scripts, task build parameters) into a complete task structure that can be executed by the build tool.

[0038] The task script is a grammatical fragment of a parameter value to be filled, which defines the specific task execution steps of the continuous integration task. The grammatical fragment can be executed only after the parameter value is filled.

[0039] Among them, the task construction parameters are used to characterize the custom task properties of the continuous integration task. Each task generation function has its corresponding task construction parameters.

[0040] For example, for a code cloning task, the task construction parameters may include the source code address and local storage address of the code to be cloned; for a code testing task, the task construction parameters may include the address of the test case, the location of the test code segment, the test duration, etc. It can be seen that for different continuous integration tasks, the corresponding task construction parameters are personalized parameters defined based on the characteristics of the task.

[0041] It should be noted that the task construction parameters are all related parameters required by the task script, that is, the parameter information of the corresponding parameter values ​​needs to be filled in the task script of the task generation function. For example, for the task script git clone${input.params.git_url}${input.params.local_url}, gir_url and local_url are the corresponding task construction parameters. By filling the parameter values ​​of the task construction parameters into the corresponding positions of the task script, an executable task script can be generated.

[0042] It should also be noted that the parameter value of the task construction parameter can be directly defined in the task configuration file, for example, the parameter value of the task construction parameter can be directly set in the task configuration file, and can also be input by the user through parameter value transmission. Therefore, when parsing the configuration file to obtain the task construction parameter, for the task construction parameter whose parameter value has been defined in the task configuration file, the parameter value of the task construction parameter can be directly obtained, and for the task construction parameter whose parameter value is not defined, the parameter value can be obtained after the user enters the custom parameter value.

[0043] In an optional implementation, in order to realize automatic parsing of the task configuration file, the task configuration file can be parsed by constructing an interpreter corresponding to the task configuration file, and the type of the interpreter is determined according to the programming language of the task configuration file. Specifically, when the task configuration file is written based on the Python language, a Python interpreter can be constructed to parse the task configuration file, and when the task configuration file is written based on the JavaScript language, a JavaScript interpreter can be constructed to parse the task configuration file.

[0044] It should also be noted that the constructed interpreter needs to perform lexical analysis, syntax analysis, and evaluation on the task configuration file to achieve parsing of the task configuration file.

[0045] In an optional implementation, when parsing the task configuration file based on the interpreter, the following steps may be included:

[0046] First, the lexical analyzer in the interpreter is called to convert the acquired task configuration file source code into lexical units. After acquiring the source code of the task configuration file, the lexical analysis operation of the source code is implemented through the lexical analyzer. Specifically, the source code text is read character by character by using preset delimiters such as spaces and line breaks, and parsed into a data structure of a specified format, such as a Token (a data structure) format.

[0047] Then, the parser in the interpreter is called to convert the extracted lexical units into an abstract syntax tree. In this step, the lexical units need to be further parsed to construct an abstract syntax tree, which is a tree representation of the abstract syntax structure of the source code. When constructing the abstract syntax tree, a variety of commonly used abstract syntax tree generation methods can be used, and the embodiments of the present application do not limit this.

[0048] Exemplarily, the Pratt parsing method can be used to generate an abstract syntax tree based on top-down operator priority. Specifically, the parser uses two pointers, curToken and peekToken, to traverse the extracted lexical units, and then parses them into an abstract syntax tree. The nodes of the abstract syntax tree can be divided into two types of nodes: statements and expressions, wherein the statement nodes can be divided into multiple statement types such as expression statements, assignment statements, and return statements, and the expression nodes can include multiple data structures such as arrays, hash tables, numbers, strings, and functions. In addition, expression nodes are further divided into prefix expression nodes and infix expression nodes, and for different expression nodes, the corresponding lexical units have different front and back orders. In the process of generating an abstract syntax tree, if it is detected that the current grammar rule contains a grammatical error, the error will be printed and returned to the user, and the current syntax tree construction process will be terminated. After the user re-corrects the syntax of the configuration file, the configuration file parsing will be performed again.

[0049] Finally, after the abstract syntax tree is generated, the abstract syntax tree is evaluated. During the evaluation process, by traversing each node of the abstract syntax tree, the variables, arrays, hash tables, functions, and digital operations, string processing operations, expression operations, function calls, etc. declared in the task configuration file are saved to the data structure of the runtime variable. By calling the evaluation method, the corresponding evaluation operation is performed on the variable value of the runtime variable. If an error occurs in the evaluation process, such as the literal is not declared, the operator is unknown, the operator is not supported, the type does not match, etc., the corresponding error type will be returned and the current task configuration file parsing process will end. After all evaluation operations are passed, the task configuration file is parsed, and the task generation function and the customized task construction parameters are obtained.

[0050] Step S120: Run the task generation function according to the task construction parameters to obtain the function running result.

[0051] Among them, the function running result is a complete task structure that can be run by the construction tool. Then running the task generation function according to the task construction parameters can include: filling parameters of the task script of the task generation function according to the parameter values ​​of the task construction parameters to generate a complete task structure that can be run by the construction tool.

[0052] In some optional implementations, the task generation function includes a preset task structure, a first task script, and a task generation logic. The task generation function is run according to the task construction parameters to obtain the function running result, including: filling in the parameters of the first task script of the task generation function according to the parameter values ​​of the task construction parameters to obtain the second task script; writing the second task script into the corresponding position of the preset task structure according to the task generation logic of the task generation function to obtain the function running result.

[0053] Among them, the first task script can also be called the initial task script, which is a task script that has not been assigned. For each task generation function, by setting the first task script, and when the task generation function is running, the parameter values ​​of the task construction parameters are filled in the first task script, so that the specific content of the continuous integration task can be configured by simply changing the specific parameter values ​​of the task construction parameters; the second task script is the task script after the first task script is assigned. After the assignment process, the second task script can be written into the preset task structure to obtain the function running result.

[0054] Exemplarily, the task generation function includes a preset task structure, task generation logic, and a first task script. Thus, when the task generation function is run according to the task construction parameters, the parameter values ​​of the task construction parameters can be filled into the corresponding parameter positions of the first task script to obtain the second task script, and then, according to the task generation logic, the task construction parameters and the second task script are assembled into the preset task structure to obtain the function running result.

[0055] It should be noted that the preset task structure is the task template that needs to be followed when the build tool generates continuous integration tasks. For example, the preset task structure for the build tool tekton (an open source continuous integration and continuous delivery system) is:

[0056]

[0057] It should be noted that, since different build tools follow different components in the task templates, the task generation logic defined in the task generation function needs to be adaptively adjusted according to the task structure requirements of the build tool. By defining the task generation logic, a complete and executable task structure can be generated for different build tools, improving the adaptability of continuous integration tasks to different build tools.

[0058] For example, for the build tool tekton, its task template contains not only the task script, but also the task build parameters, including image information and other resource information required for the task. Therefore, for the task generation logic of the build tool tekton, it is also necessary to obtain the resource information required for the task, and write the task build parameters, task script and resource information into the preset task structure. For another example, for the build tool Jenkins, its task structure contains the task script and task name. Therefore, for the task generation logic of the build tool Jenkins, after writing all the parameter values ​​of the task build parameters into the corresponding parameter positions of the task script, it is necessary to write the task name, task script, etc. into the preset task structure to generate a complete task structure that can be run.

[0059] In some optional implementations, different custom parameter values ​​can be flexibly configured for task construction parameters for different application scenarios, so that custom parameter values ​​that are adapted to the current application scenario can be dynamically selected during use to build a custom continuous integration task that is adapted to the current application scenario. Accordingly, the task construction parameters include multiple parameter values, and different parameter values ​​correspond to different application scenarios; running the task generation function according to the task construction parameters includes: selecting a target parameter value that matches the current application scenario from multiple parameter values; and running the task generation function according to the target parameter value.

[0060] In actual application scenarios, even for the same type of continuous integration tasks, the corresponding application scenarios will be quite different. For example, for code cloning tasks, the code addresses corresponding to different business projects are different, so the parameter values ​​of the task construction parameter code address under different business projects are also different. For another example, for code testing tasks, under different test backgrounds and test requirements, the corresponding task construction parameters such as test cases and test times are all different.

[0061] Among them, running the task generation function according to the target parameter value may include: filling the target parameter value into the corresponding position of the task script in the task generation function to obtain the task script after the parameters are filled; writing the task script after the parameters are filled into the corresponding position of the preset task structure of the task generation function to obtain a complete task structure.

[0062] Exemplarily, for the task construction parameters corresponding to the code cloning task, the parameter values ​​of the clone warehouse address include (URL_1, URL_2), and the parameter values ​​of the local storage address include (LocalURL_1, LocalURL_2). Then, when its application scenario is the code cloning task of business project A, it is necessary to select the target parameter value that matches it from the task construction parameters, that is, the target parameter value URL_1 of the clone warehouse address, and the target parameter value LocalURL_1 of the local storage address, so that according to the target parameter value, it is assigned to the corresponding formal parameter in the task script of the task generation function, and the task script after the assignment is written into the corresponding position of the preset task structure of the task generation function to obtain a complete task structure. Similarly, when the application scenario changes, such as when it is necessary to construct the code cloning task of business project B, the target parameter value that matches the application scenario is selected, that is, the target parameter value URL_2 of the clone warehouse address, and the target parameter value LocalURL_2 of the local storage address, and the task generation function is run according to the target parameter value.

[0063] In an embodiment of the present application, by customizing different parameter values ​​for task construction parameters in different application scenarios, and dynamically selecting parameter values ​​that are adapted to the current application scenario from multiple parameter values ​​when generating continuous tasks, the task configuration efficiency can be improved, and the adaptability of the continuous integration task to the current application scenario can be improved.

[0064] Step S130: Generate a continuous integration task according to the function running result.

[0065] The function running result is the complete task structure that can be run by the build tool.

[0066] By deploying and executing the function running results, a continuous integration task can be generated. Exemplarily, generating a continuous integration task according to the function running results includes: deploying the function running results to a distributed cluster, executing the task script in the function running results through the distributed cluster, and generating a continuous integration task.

[0067] The task generation method provided in the embodiment of the present application can obtain the task generation function of the continuous integration task and the customized task construction parameters by parsing the task configuration file of the continuous integration task. As the name implies, the parameter types and specific values ​​of the customized task construction parameters can be flexibly configured according to the actual situation. Therefore, by running the task generation function according to the customized task construction parameters, the function running results of the task generation function can be flexibly configured according to actual business needs, thereby facilitating the flexible generation of diverse and customized continuous integration tasks. This method solves the defect of a single task generation method for continuous integration tasks, and can flexibly generate a variety of continuous integration tasks.

[0068] It can be seen that the present application can generate customized continuous integration tasks according to the task generation function and task construction parameters of the configuration file of the continuous integration task, avoiding the use of fixed continuous integration tasks preset by the build tool, and improving the adaptability of the continuous integration tasks to actual application scenarios.

[0069] Those skilled in the art may also make various modifications and variations to the above embodiments:

[0070] In some possible implementations, the inventors found that for some continuous integration tasks of the same type, the task execution steps are the same, and the only difference is that the corresponding task construction parameter values ​​are different. Therefore, by pre-storing the task generation function corresponding to each type of continuous integration task, the corresponding task generation function can be determined only according to the task type of the continuous integration task to be generated, thereby improving the reusability of the task generation function. Accordingly, parsing the task configuration file of the continuous integration task to obtain the task generation function includes: parsing the task configuration file to obtain the task type of the continuous integration task to be generated; and determining the task generation function according to the task type.

[0071] Among them, the task type of the continuous integration task can be divided according to the construction stage of the continuous integration. For example, the task type can be divided into code cloning task type, code testing task type, code building task type, etc., which is not limited in the embodiment of the present application.

[0072] It should be noted that, in the case of different build tools, the task type of the continuous integration task can also be a combination of types divided according to the build phase of the continuous integration and the type of the build tool. For example, if the task type of the continuous integration task is "code cloning task, build tool A", then its corresponding task generation function can include the task script corresponding to the code cloning task and the preset task structure corresponding to build tool A.

[0073] Among them, the task script defines the specific task execution steps of the continuous integration task, and the task script contains the task construction parameters to be filled in with parameter values. For different continuous integration tasks, such as code cloning, code testing, code construction, etc., when each task is applied to different application scenarios, it is only necessary to change the parameter values ​​of the task construction parameters required by the task script, while the task execution steps of the task script do not change. Therefore, by pre-storing task scripts under different task types, users only need to set the parameter values ​​of the task construction parameters required by the task script, which effectively improves the efficiency of task configuration.

[0074] It should also be noted that the task generation function can be stored in a preset storage space, such as a preset database or a preset interpreter, to facilitate parsing of the task configuration file, which is not limited in this embodiment of the present application.

[0075] In an embodiment of the present application, since different types of continuous integration tasks are generated by different types of task generation functions, taking into account the large number of customized continuous integration tasks and configuration files in actual situations, each type of task generation function is pre-stored for sharing by various task configuration files, thereby eliminating the need to define the specific content of the task generation function in the task configuration file, thereby improving the reusability of the task generation function and the configuration efficiency of the continuous integration task.

[0076] In some optional implementations, a mapping relationship between a task type of a continuous integration task and a task generation function is pre-stored in a preset storage space, and the mapping relationship includes multiple task types and a task generation function corresponding to each task type; then determining the task generation function according to the task type includes: determining the task generation function according to the mapping relationship and the task type.

[0077] For example, the preset storage space stores task generation functions method1, method2, and method3, and also stores mapping relationships between task type A and task generation function method1, mapping relationships between task type B and task generation function method2, and mapping relationships between task type C and task generation function method3. Thus, after parsing the task configuration file and obtaining the task type of the continuous integration task, the task generation function corresponding to the task type can be determined according to the mapping relationship between the task type and the task generation function.

[0078] In some possible implementations, in the process of parsing the task configuration file, the efficiency of determining the task generation function according to the task type is low, which affects the generation efficiency of the continuous integration task. Therefore, in order to further improve the generation efficiency of the continuous integration task, the mapping relationship between the task type and the task generation function can be stored in the form of key-value pair storage. Accordingly, in the present application, the mapping relationship between multiple task types and multiple task generation functions is stored in a hashing manner, and then determining the task generation function according to the task type includes: determining the hash key corresponding to the task type according to the task type; and determining the task generation function according to the hash value corresponding to the hash key.

[0079] Among them, the content of the task generation function can be adaptively configured according to actual needs. For example, it may only include the task script corresponding to the task generation function, or it may include the task script corresponding to the task generation function and the task generation logic. The embodiment of the present application does not limit this.

[0080] For example, for the task generation function method1, the task script and task generation logic of the task generation function are stored in the preset storage space. When parsing the task configuration file of the continuous integration task to obtain the task generation function, the task type is used as the hash key to directly search for the task generation function corresponding to the task type in the hash table, thereby improving the parsing efficiency of the task configuration file and thus improving the generation efficiency of the continuous integration task generation.

[0081] In some possible implementations, the multiple continuous integration tasks generated need to be combined into a continuous integration pipeline so as to serialize and generate multiple continuous integration tasks by running the pipeline. Therefore, in order to realize the serialized generation of multiple continuous integration tasks according to the orchestration needs of the business scenarios, the task execution order of the continuous integration tasks can be defined in the task configuration file, so that the continuous integration tasks can be combined into a continuous integration pipeline according to the task execution order of the continuous integration tasks, and multiple continuous integration tasks can be generated by running the continuous integration pipeline.

[0082] Correspondingly, the task configuration file of the present application includes the task execution order of multiple continuous integration tasks, and the task construction parameters include: task construction parameters corresponding one-to-one to multiple continuous integration tasks; according to the task construction parameters, running the task generation function includes: executing multiple first operations in sequence, and the multiple first operations correspond one-to-one to multiple continuous integration tasks; the first operation includes: according to the task execution order of the continuous integration task, calling the task construction parameters corresponding to the continuous integration task, and running the task generation function based on the called task construction parameters.

[0083] It should be noted that the task execution order parameters can be directly defined in the task configuration file, for example, the task execution order of Task 1-Task 4 is set to 1, 2, 3, 4 respectively, so that according to the task execution order parameters, the task construction parameters corresponding to the continuous integration task are called, and the task generation function is run based on the called task construction parameters to quickly generate multiple continuous integration tasks in a pipeline. The order of the task generation functions in the task configuration file can also be directly used as the task execution order of the continuous integration task. For example, in the configuration file, the order of Task Generation Function 1-Task Generation Function 4 is arranged in the order of Task Generation Function 1-Task Generation Function 4, so the corresponding task execution order of Task 1-Task 4 is 1, 2, 3, 4.

[0084] It should also be noted that after obtaining the function running results of multiple task generation functions, a continuous integration pipeline structure can be generated according to the function running results. The specific format of the pipeline structure needs to be adaptively configured according to the requirements of different build tools. For example, for the build tool tekton, the format of its continuous integration pipeline structure not only includes the task name of each continuous integration task and the task execution order of each continuous integration task, but also includes the resource information and task construction parameters of each continuous integration task. Therefore, it is necessary to write the resource information and task construction parameters of each continuous integration task into the pipeline structure according to the pipeline format.

[0085] Since some task build parameters of different continuous integration tasks may be the same, the build parameters of the continuous integration pipeline can be generated by merging and deduplicating the task build parameters of each continuous integration task, and writing them into the pipeline structure, thereby generating a continuous integration pipeline structure that can be run by the build tool.

[0086] After obtaining the continuous integration pipeline structure, the pipeline structure can be saved in the database for persistent storage, and then deployed to the cluster. By running the pipeline structure, the task scripts of each continuous integration task are executed in sequence according to the task execution order in the pipeline structure, thereby generating a series of continuous integration tasks in the pipeline and completing a continuous integration build.

[0087] In an embodiment of the present application, by pre-configuring the task execution order of the continuous integration task in the task configuration file, the task build parameters can be called in sequence according to the task execution order, and the continuous integration task can be run based on the called task build parameters, so that multiple continuous integration tasks in a continuous integration pipeline can be quickly generated, and customized serialized generation of multiple continuous integration tasks is realized, thereby improving the flexibility of continuous integration task configuration and task generation efficiency.

[0088] In some possible implementations, it is considered that the parameter value of the task construction parameter may be maliciously processed, resulting in the continuous integration task generated according to the task construction parameter being unable to meet the actual continuous integration construction requirements, and may also bring malicious effects to the continuous integration construction. Therefore, by setting a verification function in the task configuration file, the initial task construction parameters are verified, thereby avoiding the situation where the parameter content is incorrect due to malicious tampering, thereby threatening network security, and improving the reliability of the continuous integration task. Correspondingly, parsing the task configuration file of the continuous integration task to obtain the customized task construction parameters includes: parsing the initial task construction parameters contained in the task configuration file; verifying the parameter type and / or parameter field of the initial task construction parameters through a preset verification function; and determining the task construction parameters according to the initial task construction parameters when the verification passes.

[0089] The initial task construction parameters are the parameters in the task configuration file that need to be processed. For example, the initial parameter value of the task construction parameter defined in the task configuration file is used as the initial task construction parameter, and then the parameter type, parameter field and other information are verified through the preset verification function. Only when the format verification passes can the parameter value be used as the parameter value corresponding to the task construction parameter.

[0090] Among them, checking the parameter field may include checking whether the length of the parameter field meets the requirements, whether the content of the parameter field contains unsafe field information, etc., and the embodiment of the present application does not limit this.

[0091] In an embodiment of the present application, the initial construction parameters in the configuration file are verified by a verification function to verify whether the parameter type, field length and other information of the initial construction parameters meet the specifications, thereby effectively improving the reliability of the generated continuous integration task.

[0092] In some possible implementations, when users write task configuration files for continuous integration tasks based on programming languages, they usually use the default configuration language of the build tool, such as shell syntax. However, the expressive power of such languages ​​is limited and they cannot implement some complex processing logic, such as statement judgment and string processing. Therefore, in order to set the processing logic in the task configuration file, the task configuration file can be written based on the domain-specific language (Domain Syntax Language, DSL) in the build tool field, and the parameter processing in the task configuration file can be implemented through the built-in functions corresponding to the domain-specific language.

[0093] DSL is a programming language designed for a specific domain or problem. It usually provides domain-related abstraction or expression capabilities, so that problems in the domain can be described and solved more concisely and clearly. Accordingly, the task configuration file is implemented based on the domain-specific language of the build tool domain; the preset verification function is the built-in function corresponding to the domain-specific language.

[0094] Among them, built-in functions are function functions pre-supported by domain-specific languages, such as string concatenation, data evaluation operations, etc. The specific implementation method of the built-in function can be preset in the interpreter, so that in the configuration file, the user only needs to define the function name of the built-in function and the input parameters of the function to call the built-in function.

[0095] In the embodiment of the present application, by using a domain-specific language to write a task configuration file, the complex processing logic required for continuous integration task generation can be described in a more natural way, thereby improving configuration efficiency. In addition, the built-in function corresponding to the domain-specific language can be directly used in the task configuration file, so that the initial task construction parameters corresponding to the built-in function are subjected to parameter verification processing, so that after the processing is completed, the task construction parameters of the continuous integration task are obtained, which expands the data processing function of the task configuration file and improves the applicability of the task configuration file in the actual continuous integration task generation.

[0096] It should be noted that the initial task construction parameters can also be processed with relevant parameters according to the actual data processing needs, such as parameter calculation processing, which means parsing the task configuration file of the continuous integration task to obtain customized task construction parameters, including: parsing the initial task construction parameters contained in the task configuration file; performing parameter calculation on the initial task construction parameters through a preset calculation function to obtain parameter calculation results; and determining the task construction parameters according to the parameter calculation results.

[0097] Similarly, the task configuration file can be implemented based on a domain-specific language in the construction tool field; then the preset calculation function is a built-in function corresponding to the domain-specific language.

[0098] Exemplarily, the initial task construction parameters include: first-category initial task construction parameters and second-category initial task construction parameters; the built-in functions include: first-category built-in functions and second-category built-in functions; through the first-category built-in functions, parameter verification processing is performed on the first-category initial task construction parameters; through the second-category built-in functions, parameter calculation processing is performed on the second-category initial task construction parameters.

[0099] Specifically, the first category of built-in functions may include functions such as data type judgment and data length acquisition. By performing type judgment on the initial task construction parameters or obtaining the data length corresponding to the initial task construction parameters, the task construction parameters can be verified in time. Therefore, when the parameter verification does not meet the preset rules, such as the data type or data length of the initial task construction parameters does not meet the requirements, the task generation function running operation will not be executed.

[0100] Among them, the second type of built-in functions can include functions such as numerical operations of digital variables, addition, modification, and deletion of data structures such as arrays and hash tables. By performing numerical operations on the initial task construction parameters or performing operations such as addition, modification, and deletion, the corresponding task construction parameters can be obtained after the parameter calculation. For example, for a certain task construction parameter, the required format is an array and contains two task construction sub-parameters. Then, by obtaining the two task construction sub-parameters and calling the relevant built-in functions of array operations, the task construction sub-parameters can be processed into an array form that meets the task construction parameter format requirements.

[0101] It should be noted that the functional categories of the built-in functions in this application are not limited to this, and include all built-in function functions provided by the domain-specific language. For example, the built-in functions of this application may also include a third type of built-in functions, and correspondingly, the task initial parameters may include the third type of initial parameters. Through the third type of built-in functions, string parameter processing can be performed on the third type of initial parameters, for example, string concatenation, string content replacement, string matching, string segmentation and other corresponding operations.

[0102] For another example, the built-in functions in this application can also be used to write custom logic. Exemplarily, by judging the matching results of the parameter variable values ​​in the task configuration file, the type of continuous integration task to be generated is selected according to the matching results, and the embodiments of this application are not limited to this.

[0103] In an embodiment of the present application, different types of initial task construction parameters are processed by using different types of built-in functions, thereby realizing processing functions such as parameter verification and parameter calculation, improving the data processing capability of the task configuration file, and ensuring the availability and effectiveness of the task construction parameters.

[0104] In some possible implementations, the user can adjust the task construction parameters that have been defined in the task configuration file during the process of building a continuous integration task, so as to meet the needs of personalized customization of various continuous integration tasks and further enhance the flexibility of continuous integration task creation. Accordingly, determining the task construction parameters according to the initial task construction parameters includes: displaying the initial task construction parameters; in response to the modification instruction for the initial task construction parameters, modifying the initial task construction parameters, and determining the custom task construction parameters according to the modification result; wherein the instruction type of the parameter modification instruction includes: a new type and a replacement type.

[0105] Among them, the newly added type is used to add new initial task build parameters. As the application scenario changes, new properties of the continuous integration task that need to be configured may be generated. Therefore, through the parameter modification instructions of the newly added type, new initial task build parameters can be configured in the task configuration file to meet the task build requirements.

[0106] Among them, the replacement type is used to modify the initial task construction parameters, for example, to modify the parameter value, parameter type, etc. of the initial task construction parameters, and the embodiment of the present application does not limit this. Similarly, through the parameter modification instruction of the replacement type, the initial task construction parameters in the task configuration file can be updated in time to the actual parameters required for the current continuous integration task generation, thereby improving the adaptability of the task construction parameters.

[0107] In the embodiment of the present application, by adjusting the task construction parameters that have been defined in the task configuration file, the task construction parameters can meet the needs of personalized customization of various tasks, further improving the flexibility of continuous integration task creation.

[0108] For ease of understanding, the following uses an example to describe in detail the technical implementation details in the above embodiment:

[0109] In a related technology, the continuous integration tasks during the continuous integration build are all preset and generated by the build tool. For example, the user initiates the continuous integration build through the front-end page. After receiving the build request, the continuous integration build tool such as tekton will call the application program interface (Application Program Interface, API) of the corresponding back-end program. Then, the back-end program will call the API interface corresponding to the kubernetes (an open source platform for managing containerized application and service clusters) cluster based on its preset build logic, and combine the preset continuous integration tasks in the cluster into a pipeline. Finally, by running the pipeline, the generated continuous integration tasks are executed sequentially. However, in the method of preset continuous integration tasks based on the build tool, only existing continuous integration tasks can be selected, which cannot flexibly meet the actual project business processing needs.

[0110] In order to solve the above problem, a task generation method is proposed in an embodiment of the present application. Figure 2 A schematic diagram of a task generation method provided in an embodiment of the present application is shown. Figure 2 As shown, the following steps are included:

[0111] Step S201: receiving a continuous integration task generation request initiated by a user.

[0112] In this step, the user can write a custom task configuration file of the continuous integration task according to the application scenario of the continuous integration task. Specifically, the task configuration file can be written in a domain-specific language suitable for the build tool, so that the processing logic related to the generation of the continuous integration task can be flexibly defined in the task configuration file according to the domain-specific language.

[0113] The task configuration file contains the configuration information related to the continuous integration task. For example, the task generation function and task construction parameters are defined in the task configuration file.

[0114] The task generation function is used to generate a specific continuous integration task. The initial task script (i.e., the first task script) and the task generation logic of the continuous integration task can be defined in the task generation function. Among them, the task construction parameters are the parameters to be assigned in the initial task script of the task generation function. In different business scenarios, by changing the parameter values ​​of the task construction parameters, a task script after different parameter assignments, i.e., a second task script, can be formed. By running the task generation function, the relevant components of the continuous integration task, such as the second task script, can be combined into a continuous integration task that can be run by the build tool according to the defined task generation logic.

[0115] The parameter value configuration method of the task construction parameter can be customized according to the application needs. For example, for some task construction parameters, the parameter value of the task construction parameter can be directly defined in the task configuration file. For task construction parameters that do not have parameter values ​​defined in the task configuration file, the corresponding parameter value needs to be customized by the user according to the application scenario.

[0116] In addition, you can also declare the resource information of the continuous integration task in the task configuration file, such as the workspace directory, the actual CPU and memory used, mount, image name and other variable information. These variable information are the resource information required in the task structure of the build tool such as tekton. When generating a continuous integration task, you need to write these resource information into the corresponding position of the task structure, such as writing the image name of the image into the spec.steps.image of the tekton task structure.

[0117] In addition, the task configuration file can also include built-in functions corresponding to domain-specific languages. These built-in functions are used to verify and process strings or values, such as addition, subtraction, multiplication, division, and remainder operations on digital variables, or to determine string length, perform string matching, determine character positions, string segmentation, and add, modify, delete, and query data structures such as arrays and hash tables. The built-in functions can be used to verify and evaluate the initial task build parameters of the continuous integration task, so that the parameter values ​​of the task build parameters can be obtained based on the parameter processing results.

[0118] The parameter processing of the initial task construction parameters may include various processing forms, such as parameter verification processing, parameter calculation processing, character string processing, etc.

[0119] For example, for a certain task construction parameter, it needs to be obtained by concatenating the two task initial parameters in the configuration file. Therefore, by calling the string concatenation built-in function, the two task initial parameters can be concatenated to obtain the task construction parameter. For a certain initial task construction parameter, it is necessary to verify that the parameter type and parameter length of its parameter value meet the requirements before it can be used as a task construction parameter.

[0120] At the same time, according to the actual needs of continuous integration task generation, the user can also define other variable information in the task configuration file, for example, variables used for logical judgment, such as judgment statements, loops, etc. These variable information can also be used in combination with built-in functions to implement customized parameter processing logic. In short, the user can define the configuration information related to the continuous integration task in the task configuration file according to the application needs, and the embodiment of the present application does not limit this.

[0121] After the user has written the task configuration file for the continuous integration task, he can initiate a continuous integration task generation request through the front-end page, and pass the generation request to a build tool such as tekton by calling the back-end program API interface of the build tool such as tekton.

[0122] Step S202: Obtain a task configuration file for the continuous integration task.

[0123] After receiving the task generation request sent by the user, the backend program will request the repository through the API based on the request parameters in the task generation request, such as the git repository address and branch parameters, to obtain the latest user-defined continuous integration task configuration file for the current repository and branch.

[0124] Step S203: calling the interpreter to parse the task configuration file of the continuous integration task.

[0125] After obtaining the task configuration file of the continuous integration task, the text content of the task configuration file is used as input to call an interpreter for parsing the task configuration file. The interpreter of the task configuration file can be customized according to the programming language of the task configuration file.

[0126] Exemplarily, for a task configuration file written in a domain-specific language, a dedicated interpreter for parsing the domain-specific language is configured. In the interpreter of the task configuration file, the parsing logic needs to be defined, for example, the parsing logic is defined in the interpreter as a read-eval-print-loop (REPL).

[0127] Step S204: During the parsing process, the task configuration file is subjected to lexical analysis to generate lexical units.

[0128] After the interpreter reads the text content of the input task configuration file through REPL, it calls the lexer to read the source code text of the task configuration file line by line, such as the task generation function and task construction parameters defined in the task configuration file, and uses separators such as spaces and newlines as separators to parse the source code text into lexical units, namely the Token data structure. Token is a data structure that contains data types and data literals. Data types can include illegal characters, termination characters, general literals, integers, strings, floating-point types, as well as operation symbols, brackets, functions, Boolean values, conditional judgments, assignments, returns and other data types. By calling the lexer, the source code text of the task configuration file is cyclically printed as a Token list, and the source code is decomposed into lexical units.

[0129] Step S205: Perform grammatical analysis on the lexical unit to generate an abstract syntax tree.

[0130] After obtaining the token list, the lexical unit is converted into an abstract syntax tree by calling the syntax analyzer, wherein the parsing method of the syntax analyzer can be customized according to the application needs.

[0131] The parser in the embodiment of the present application adopts a top-down operator priority parsing method, namely the Pratt parsing method, which traverses the lexical unit through the two pointers curToken and peekToken, and parses the lexical unit of the Token type into an abstract syntax tree according to the parser. The nodes of the abstract syntax tree can be divided into two types: statements and expressions, where statements can be divided into expression, assignment, return and other statement types, and expressions can be divided into arrays, hash tables, numbers, strings, functions and other expression types. When generating the abstract syntax tree, the processing logic of the symbol priority will also be generated, so that the abstract syntax tree can be evaluated according to the processing logic later.

[0132] When constructing the abstract syntax tree, if the syntax rule is checked to contain an error, the current task configuration file parsing process is terminated, and the error information is returned to the user, prompting the user to modify the corresponding syntax of the configuration file.

[0133] Step S206: Evaluate the abstract syntax tree to obtain a task generation function and customized task construction parameters.

[0134] When evaluating the abstract syntax tree, the resource information, task construction parameters, task generation functions, built-in functions, and other specific evaluation operations defined by the user in the task configuration file, such as numerical calculations, string processing, and function calls, are saved in the data structure of the runtime variables. The runtime variable is a hash table data structure, and for each variable, the variable name, variable type, and its corresponding variable value are saved. The variable value types include integer, string, floating point, Boolean, function, array, hash table, null pointer, etc.

[0135] In particular, the implementation methods of the task generation function and the built-in function can be preset in the interpreter, so that the function code segments corresponding to the task generation function and the built-in function can be directly obtained by searching in the interpreter.

[0136] In an optional implementation, a mapping relationship between multiple task types and task generation functions is stored in the interpreter in a hash manner; parsing the task configuration file of the continuous integration task to obtain the task generation function includes: parsing the task configuration file to obtain the task type of the continuous integration task; determining the hash key corresponding to the task type according to the task type; and determining the task generation function according to the hash value corresponding to the hash key.

[0137] Exemplarily, built-in functions and task generation functions are stored in a hash table named builtins in the interpreter, where the key of the hash table can be the method name of the built-in function or the task type of the task generation function, such as Len, Replace, Find, etc., and the value corresponding to the hash table key is the specific implementation code of the function. For the task generation function, the corresponding code segment of the task generation function is stored in the hash table, such as the first task script, the corresponding code of the task generation logic, etc.

[0138] When obtaining the task generation function or built-in function of the task configuration file, the task type of the task generation function or the function name corresponding to the built-in function is used as the hash key, and the hash value corresponding to the hash key, that is, the function code segment of the task generation function or the built-in function, can be searched in the hash table and saved in the runtime variable.

[0139] Since the built-in function of the embodiment of the present application needs to perform parameter processing on the initial task construction parameters corresponding to the task generation function, during the evaluation process, the corresponding parameter processing operation can be performed by calling the built-in function.

[0140] Specifically, when evaluating, for a built-in function, first determine whether the parameter type and number of the initial task construction parameters of the built-in function meet the rules of the function, where the parameter values ​​of the initial task construction parameters can be obtained from the runtime variables, and then, if they meet the rules, the function code segment of the function will be executed. During the evaluation process, if an error occurs, such as an undeclared literal, an unknown operator, an unsupported operator, or a type mismatch, the corresponding error message will be thrown, the parsing process of the current task configuration file will be terminated, and the user will be prompted. After the evaluation is passed, the parameters after the initial task construction parameters are processed, that is, the task construction parameters, can be obtained and saved in the runtime variables.

[0141] After completing all evaluation operations, you can obtain the relevant configuration content of the continuous integration task in the runtime variables, such as the task generation function, task construction parameters, etc.

[0142] Step S207: according to the task execution order of the continuous integration task, the task construction parameters corresponding to the continuous integration task are called, and the task generation function is executed based on the called task construction parameters to obtain the function execution result.

[0143] In this step, after the task configuration file is parsed, the task generation function will be run in turn according to the task construction parameters according to the task execution order of the continuous integration task to obtain the function running results of multiple task generation functions.

[0144] The task execution order of the continuous integration task can be customized in the task configuration file, or the task generation function corresponding to the continuous integration task can be arranged in a top-to-bottom order as the task execution order of the continuous integration task, which is not limited in the embodiment of the present application.

[0145] Specifically, running the task generation function according to the task construction parameters may include: assigning parameters to the first task script of the task generation function according to the parameter values ​​of the task construction parameters, and processing the first task script after the parameter assignment, that is, the second task script, according to the task generation logic of the task generation function to obtain a complete task structure that can be executed by the construction tool.

[0146] It should be noted that the user can also customize the parameter values ​​of the task construction parameters according to the application scenario. Therefore, after the user configures the customized parameter values ​​of the task construction parameters according to the parameter modification instructions, the task generation function can be run according to the task construction parameters to obtain the function running results.

[0147] Correspondingly, the task generation function is run according to the task construction parameters to obtain the function running result, including: assigning the parameter value of the task construction parameters to the first task script of the task generation function to obtain the second task script; according to the task generation logic of the task generation function, the second task script is written into the corresponding position of the preset task structure to obtain the function running result.

[0148] For example, for a continuous integration task suitable for the build tool tekton:

[0149] First, assign parameters to the first task script corresponding to the task generation function, such as the shell syntax fragment, according to the parameter value of the task construction parameter to obtain the second task script. In this step, the corresponding parameter value will be searched in the runtime variable according to the parameter name of the task construction parameter. If the parameter value of the parameter can be obtained in the runtime variable, the task construction parameter in the first task script, such as $(inputs.params.<variable name>), is replaced with the variable value corresponding to the runtime variable, and the shell syntax fragment parameter value is filled to obtain the second task script.

[0150] Then, according to the task generation logic of the task generation function, the second task script, that is, the shell syntax fragment after parameter assignment, as well as the workspace directory, resource restrictions, mounts, and build container images used obtained from runtime variables, are written into the corresponding position of the preset task structure to generate a complete task structure that can be run by the build tool tekton.

[0151] It should be noted that the parameter values ​​of the task construction parameters required by the first task script can be directly defined through the configuration file or customized by the user inputting the parameter values. Therefore, after parsing the configuration file and obtaining the parameter values ​​of the task construction parameters contained in the runtime variables, for the task construction parameters whose parameter values ​​cannot be obtained from the runtime variables, which are user-defined task construction parameters, the relevant parameter values ​​must be obtained after the user inputs the corresponding parameter values, so as to generate the continuous integration task according to the parameter values ​​of the task construction parameters and the task generation function.

[0152] For example, for the continuous integration task executed by the build tool tekton, since tekton can fill the parameters of the second task script according to the task build parameters in the task structure spec.params, the second task script written into the preset task structure can be filled with the parameter values ​​of the task build parameters input by the user. After the parameter values ​​of the task build parameters input by the user are written into the spec.params of the task structure, when the tekton tool runs the task structure, the second task script can be assigned values ​​to realize the task operation.

[0153] Therefore, for the build tool tekton, after assigning parameters to the first task script according to the parameter values ​​of the task build parameters contained in the runtime variables to obtain the second task script, the second task script can be written into the corresponding position of the task structure, i.e., spec.step.script, according to the task generation logic of the task generation function, and the task build parameters input by the user can be written into the spec.params of the task structure, thereby generating a complete task structure that can be run by the build tool tekton.

[0154] For the continuous integration tasks executed by the build tool Jenkins, since its task structure only contains the task scripts to be run, it is necessary to assign the parameter values ​​of the task build parameters contained in the runtime variables and the parameter values ​​of the task build parameters input by the user to the first task script, and then obtain the second task script, so as to write the second task script after the parameter assignment into the corresponding position of the task structure to generate a complete task structure.

[0155] Step S208: Generate a continuous integration task according to the function running result.

[0156] For the function running results of the multiple task generation functions obtained, in order to realize the serialized generation of multiple continuous tasks, in this step, it is necessary to assemble the multiple function running results (that is, the complete task structure) into a pipeline structure according to the task execution order of the continuous integration task.

[0157] Similarly, the structure of the pipeline also needs to be adaptively set according to the operating requirements of the build tool. For example, for the pipeline of the build tool tekton, in addition to the task names of each generated continuous integration task and its task generation order, it also includes the task build parameters of all tasks. Therefore, after removing and merging the task build parameters of all continuous integration tasks, the build parameters of the pipeline are obtained.

[0158] After obtaining the complete task structure and pipeline structure, the complete task structure and pipeline structure need to be stored in the database, and their corresponding version numbers need to be recorded at the same time.

[0159] Then, the complete task structure and pipeline structure are deployed to the kubernetes cluster by calling the interface. Finally, the continuous integration build is initiated through the construction parameters of the pipeline structure, so that the serialized operation of the continuous integration task is completed by executing the pipeline structure, that is, the sequential generation of multiple continuous integration tasks on the pipeline is realized.

[0160] In an embodiment of the present application, a task configuration file of a continuous integration task written by a user in a domain-specific language is obtained, and then after parsing the task configuration file, a task generation function and task construction parameters are obtained, and then according to the task execution order of the continuous integration task, the task construction parameters are called, and the task generation function is run according to the task construction parameters, and the parameter values ​​of the task construction parameters are filled into the corresponding positions of the task script of the task generation function, and the filled task scripts are assembled into a complete task structure that can be run by the build tool. Finally, by assembling multiple complete task structures into a pipeline structure, the generation of each continuous integration task in the pipeline is achieved by deploying and running the pipeline structure.

[0161] It can be understood that the above-mentioned various method embodiments mentioned in this application can be combined with each other to form a combined embodiment without violating the principle logic. Due to space limitations, this application will not go into details. Those skilled in the art can understand that in the above-mentioned method of the specific implementation method, the specific execution order of each step should be determined by its function and possible internal logic.

[0162] In addition, the present application also provides a task generation device, an electronic device, and a computer-readable storage medium, all of which can be used to implement any task generation method provided by the present application. The corresponding technical solutions and descriptions are referred to in the corresponding records of the method part and will not be repeated here.

[0163] Figure 3 A block diagram of a task generation device provided in an embodiment of the present application.

[0164] Reference Figure 3 , an embodiment of the present application provides a task generation device, the generation device comprising:

[0165] The parsing module 31 is used to parse the task configuration file of the continuous integration task to obtain the task generation function and the customized task construction parameters;

[0166] An operation module 32 is used to run the task generation function according to the task construction parameters to obtain a function operation result;

[0167] The generating module 33 is used to generate a continuous integration task according to the function running result.

[0168] In an optional implementation, the task construction parameters include multiple parameter values, and different parameter values ​​correspond to different application scenarios; running the task generation function according to the task construction parameters includes: selecting a target parameter value that matches the current application scenario from the multiple parameter values; and running the task generation function according to the target parameter value.

[0169] In an optional implementation, parsing the task configuration file of the continuous integration task to obtain the task generation function includes: parsing the task configuration file to obtain the task type of the continuous integration task; and determining the task generation function according to the task type.

[0170] In an optional implementation, the task configuration file includes a task execution order of multiple continuous integration tasks, and the task construction parameters include: task construction parameters corresponding one-to-one to the multiple continuous integration tasks; running the task generation function according to the task construction parameters includes: executing multiple first operations in sequence, and the multiple first operations correspond one-to-one to the multiple continuous integration tasks; the first operation includes: calling the task construction parameters corresponding to the continuous integration task according to the task execution order of the continuous integration task, and running the task generation function based on the called task construction parameters.

[0171] In an optional implementation, parsing the task configuration file of the continuous integration task to obtain customized task construction parameters includes: parsing the initial task construction parameters contained in the task configuration file; verifying the parameter type and / or parameter field of the initial task construction parameters through a preset verification function; and if the verification passes, determining the task construction parameters based on the initial task construction parameters.

[0172] In an optional implementation, determining the task construction parameters based on the initial task construction parameters includes: displaying the initial task construction parameters; modifying the initial task construction parameters in response to a modification instruction for the initial task construction parameters, and determining the task construction parameters based on the modification result; wherein the instruction type of the parameter modification instruction includes: a new type and a replacement type.

[0173] Each module in the above task generation device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0174] Figure 4 A block diagram of an electronic device provided in an embodiment of the present application.

[0175] Reference Figure 4An embodiment of the present application provides an electronic device, which includes: at least one processor 401; at least one memory 402, and one or more I / O interfaces 403, connected between the processor 401 and the memory 402; wherein the memory 402 stores one or more computer programs that can be executed by at least one processor 401, and the one or more computer programs are executed by at least one processor 401 so that the at least one processor 401 can perform the above-mentioned task generation method.

[0176] Each module in the above electronic device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0177] The embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored, wherein the computer program implements the above-mentioned task generation method when executed by the processor / processing core. The computer-readable storage medium can be a volatile or non-volatile computer-readable storage medium.

[0178] An embodiment of the present application also provides a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above-mentioned task generation method.

[0179] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In a hardware implementation, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable storage medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a temporary medium).

[0180] As is known to those of ordinary skill in the art, the term computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable program instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technology, portable compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. In addition, it is known to those of ordinary skill in the art that communication media typically contain computer-readable program instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and may include any information delivery medium.

[0181] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.

[0182] The computer program instructions for performing the operation of the present application can be assembler instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions can be executed completely on a user's computer, partially on a user's computer, executed as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet). In some embodiments, by using the state information of a computer-readable program instruction to personalize an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA) or a programmable logic array (PLA), the electronic circuit can execute a computer-readable program instruction, thereby realizing various aspects of the present application.

[0183] The computer program product described herein may be implemented in hardware, software, or a combination thereof. In one optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK), etc.

[0184] Various aspects of the present application are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present application. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.

[0185] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0186] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0187] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the logical function of the specification. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can also be executed in the opposite order sometimes, depending on the function involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be realized by a dedicated hardware-based system that performs the function or action of the specification, or can be realized by a combination of special-purpose hardware and computer instructions.

[0188] Example embodiments have been disclosed herein, and although specific terms are employed, they are used and should be interpreted only in a general illustrative sense and not for limiting purposes. In some instances, it will be apparent to those skilled in the art that, unless otherwise expressly noted, features, characteristics, and / or elements described in conjunction with a particular embodiment may be used alone or in combination with features, characteristics, and / or elements described in conjunction with other embodiments. Therefore, those skilled in the art will appreciate that various changes in form and detail may be made without departing from the scope of the present application as set forth in the appended claims.

Claims

1. A task generation method, characterized in that: The method comprises: Parse the task configuration file of the continuous integration task to obtain the task generation function and customized task construction parameters; Run the task generation function according to the task construction parameters to obtain the function running result; Generate a continuous integration task according to the function running result.

2. The method according to claim 1, characterized in that The task construction parameters include multiple parameter values, and different parameter values ​​correspond to different application scenarios; and running the task generation function according to the task construction parameters includes: Selecting a target parameter value that matches the current application scenario from the multiple parameter values; The task generation function is executed according to the target parameter value.

3. The method according to claim 1, characterized in that: The task configuration file of the continuous integration task is parsed to obtain the task generation function, which includes: Parsing the task configuration file to obtain the task type of the continuous integration task; The task generation function is determined according to the task type.

4. The method according to claim 1, characterized in that: The task configuration file includes a task execution order of a plurality of continuous integration tasks, the task construction parameters include: task construction parameters corresponding to the plurality of continuous integration tasks one by one; and running the task generation function according to the task construction parameters includes: Execute multiple first operations in sequence, wherein the multiple first operations correspond one-to-one to the multiple continuous integration tasks; the first operations include: calling task construction parameters corresponding to the continuous integration tasks according to the task execution order of the continuous integration tasks, and running the task generation function based on the called task construction parameters.

5. The method according to any one of claims 1 to 4, characterized in that: The task configuration file of the continuous integration task is parsed to obtain the customized task construction parameters, including: Parsing the initial task construction parameters contained in the task configuration file; Verifying the parameter type and / or parameter field of the initial task construction parameter by using a preset verification function; When the verification is passed, the task construction parameters are determined according to the initial task construction parameters.

6. The method according to claim 5, characterized in that Determining the task construction parameters according to the initial task construction parameters includes: Displaying the initial task construction parameters; In response to a modification instruction for the initial task construction parameter, modify the initial task construction parameter, and determine the task construction parameter according to the modification result; The instruction types of the parameter modification instructions include: a new addition type and a replacement type.

7. A task generation device, characterized in that: The device comprises: The parsing module is used to parse the task configuration file of the continuous integration task to obtain the task generation function and customized task construction parameters; An operation module is used to run the task generation function according to the task construction parameters to obtain a function operation result; A generation module is used to generate a continuous integration task according to the function running result.

8. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores one or more computer programs executable by the at least one processor, and the one or more computer programs are executed by the at least one processor to enable the at least one processor to perform the task generation method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the computer program implements the task generation method according to any one of claims 1 to 6.

10. A computer program product, characterized in that The method comprises a computer-readable code or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the task generation method as described in any one of claims 1 to 6.