View and task management method based on software development and related equipment
By using the Python library to automatically manage views and tasks in Jenkins tools, the traditional time-consuming and error-prone problems are solved, and efficient management of Jenkins views and tasks is achieved, and work efficiency is improved.
Patent Information
- Application Number
- CN202510109286.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-23
- Publication Date
- 2025-05-27
AI Technical Summary
During software development and testing, the large number of views and tasks generated by Jenkins tools lead to increased management costs and increased server pressure. Traditional manual operations are time-consuming and error-prone, requiring automated solutions.
Using a software development-based view and task management method, access Jenkins services through the Python library, obtain and manage views and task lists, and locate and batch modify XML format view and task configuration information.
Through automated processing, it reduces misoperation, saves time, supports multiple processing needs for views and tasks, makes management more flexible and convenient, and improves overall work efficiency.
Smart Images

Figure CN120045179A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software development, and in particular to a view and task management method and related devices based on software development. Background Art
[0002] In the fields of software development and testing, Jenkins is widely used as a continuous integration tool. It realizes operations such as code pulling, compilation, and distribution by creating views and tasks. However, over time, the accumulation of a large number of views and tasks has led to an increase in management costs and pressure on the server. To alleviate these burdens, it is necessary to effectively organize and manage the views and tasks of Jenkins, such as batch deletion, parameter modification, etc. Traditional manual operations are not only time-consuming but also error-prone. Therefore, an automated solution has become urgent. Summary of the Invention
[0003] The technical problem to be solved by the present invention is: to provide a view and task management method and related devices based on software development, aiming to improve the management efficiency of views and tasks generated during the software development and testing processes.
[0004] To solve the above technical problem, the technical solution adopted by the present invention is: a view and task management method based on software development, including the steps of:
[0005] S10. Obtain all view lists and task lists generated during the software development process, and there is an association relationship between the views in the view list and the tasks in the task list;
[0006] S20. Obtain the view configuration information in XML format and the task configuration information in XML format according to the view names respectively;
[0007] S30. Locate the key tag positions of the view configuration information in XML format and the task configuration information in XML format respectively;
[0008] S40. Perform batch modification at the key tag positions of the view configuration information in XML format and the task configuration information in XML format.
[0009] Further, step S10 specifically includes:
[0010] S11. Connect to the Jenkins service through the python library jenkins;
[0011] S12. Obtain all views through the first function of the jenkins library to form all view lists;
[0012] S13. Obtain all tasks through the second function of the jenkins library to form all task lists.
[0013] Further, step S20 specifically includes:
[0014] S21. Call the third function of the jenkins library with the specified view name as a parameter to obtain the task list under the specified view;
[0015] S22. Call the fourth function of the jenkins library with the view name as a parameter to obtain the specified view configuration;
[0016] S23. Call the fifth function of the jenkins library with the task name as a parameter to obtain the task configuration.
[0017] Further, step S30 specifically includes:
[0018] Use the sixth function to respectively locate the key tag positions of the view configuration information in XML format and the task configuration information in XML format.
[0019] Further, step S40 specifically includes:
[0020] Batch add, modify, and delete sub-tags and tag contents at the key tag positions of the view configuration information in XML format and the task configuration information in XML format.
[0021] Further, the view and task management method based on software development further includes:
[0022] S50. Update the view configuration and task configuration.
[0023] Further, step S50 specifically includes:
[0024] S51. Call the seventh function of the jenkins library with the view name and the XML text of the latest view configuration information as parameters to update the view configuration;
[0025] S52. Call the eighth function of the jenkins library with the task name and the XML text of the latest task configuration information as parameters to update the task configuration.
[0026] The present invention also provides a view and task management device based on software development, including:
[0027] A view and task acquisition module, configured to acquire all view lists and task lists generated during the software development process, and there is an association relationship between the views in the view list and the tasks in the task list;
[0028] A configuration information acquisition module, configured to respectively acquire the view configuration information in XML format and the task configuration information in XML format according to the view name;
[0029] A label position locating module is used to respectively locate the key label positions of view configuration information in XML format and task configuration information in XML format;
[0030] A label batch modification module is used to perform batch modification at the key label positions of view configuration information in XML format and task configuration information in XML format.
[0031] The present invention also provides a computer device, which includes a memory and a processor. A computer program is stored on the memory, and when the processor executes the computer program, the view and task management method based on software development as described above is implemented.
[0032] The present invention also provides a storage medium, which stores a computer program. When the computer program is executed by a processor, the view and task management method based on software development as described above can be implemented.
[0033] The beneficial effects of the present invention are as follows: Code automation processing replaces manual configuration, greatly reducing misoperations and saving time. It supports various processing requirements for views and tasks, making management more flexible and convenient. Since the solution is written in Python, it has good scalability and maintainability, facilitating subsequent function expansion and problem correction. The XML file operation function written in Python realizes the efficient management of Jenkins views and tasks, improving the overall work efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The specific structure of the present invention is described in detail below with reference to the drawings.
[0035] Figure 1 It is a flowchart of the view and task management method based on software development according to an embodiment of the present invention;
[0036] Figure 2 It is a flowchart of view and task acquisition according to an embodiment of the present invention;
[0037] Figure 3 It is a flowchart of configuration information acquisition according to an embodiment of the present invention;
[0038] Figure 4 It is a flowchart of configuration update according to an embodiment of the present invention;
[0039] Figure 5 It is a block diagram of the view and task management device based on software development according to an embodiment of the present invention;
[0040] Figure 6 It is a schematic block diagram of the computer device according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0041] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0042] It should be understood that when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.
[0043] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in this specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an", and "the" are intended to include the plural forms.
[0044] It should be further understood that the term " / and" used in this specification of the present invention and the appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0045] As Figure 1 shown, the first embodiment of the present invention is: A view and task management method based on software development, including the steps of:
[0046] S10. Obtain all view lists and task lists generated during the software development process, and there is an association relationship between the views in the view list and the tasks in the task list.
[0047] As Figure 2 shown, in a specific embodiment, step S10 specifically includes:
[0048] S11. Access the Jenkins service through the Python library jenkins.
[0049] S12. Obtain all views through the first function of the jenkins library to form all view lists.
[0050] In this embodiment, the first function is the built-in function get_views() of the jenkins library.
[0051] S13. Obtain all tasks through the second function of the jenkins library to form all task lists.
[0052] In this embodiment, the second function is the built-in function get_all_jobs() of the jenkins library.
[0053] S20. Obtain the view configuration information in XML format and the task configuration information in XML format respectively according to the view name.
[0054] As Figure 3 shown, in a specific embodiment, step S20 specifically includes:
[0055] S21. Call the third function of the jenkins library with the specified view name as a parameter to obtain the task list under the specified view.
[0056] In this embodiment, the third function is the built-in function get_jobs(view_name = kws["viewname"]) of the jenkins library to obtain the task list under the specified view.
[0057] S22. Call the fourth function of the jenkins library with the view name as a parameter to obtain the specified view configuration.
[0058] In this embodiment, the fourth function is the built-in function get_view_config(viewname) of the jenkins library to obtain the specified view configuration.
[0059] S23. Call the fifth function of the jenkins library with the task name as a parameter to obtain the task configuration.
[0060] In this embodiment, call the built-in function get_job_config(jobname) of the jenkins library with the task name as a parameter to obtain the task configuration.
[0061] S30. Locate the key tag positions of the view configuration information in XML format and the task configuration information in XML format respectively.
[0062] In a specific embodiment, step S30 specifically includes:
[0063] Locate the key tag positions of the view configuration information in XML format and the task configuration information in XML format respectively through the sixth function.
[0064] In this embodiment, since both the view configuration information and the task configuration information are in XML format, the key tag position of the XML text can be located through the rindex("tag") function.
[0065] S40. Make batch modifications at the key tag positions of the view configuration information in XML format and the task configuration information in XML format.
[0066] In a specific embodiment, step S40 specifically includes:
[0067] Batch add, modify, and delete sub-tags and tag content at the key tag positions of the view configuration information in XML format and the task configuration information in XML format.
[0068] In this embodiment, it is possible to batch add, modify, and delete sub-tags and tag content at the key tag positions of the view configuration information and the task configuration information. After re-integrating the XML text according to the above requirements, the latest XML text is obtained.
[0069] In a specific embodiment, the view and task management method based on software development further includes:
[0070] S50. Update the view configuration and the task configuration.
[0071] As Figure 4 shown, in a specific embodiment, step S50 specifically includes:
[0072] S51. Call the seventh function of the jenkins library with the view name and the XML text of the latest view configuration information as parameters to update the view configuration.
[0073] In this embodiment, call the seventh function with the view name and the latest XML text as parameters. The seventh function is the built-in function reconfig_view(view_name,view_config_xml) of the jenkins library to update the view configuration, so as to achieve the purpose of quickly managing tasks.
[0074] S52. Call the eighth function of the jenkins library with the task name and the XML text of the latest task configuration information as parameters to update the task configuration.
[0075] In this embodiment, call the eighth function with the task name and the latest XML text as parameters. The eighth function is the built-in function reconfig_job(job_name,job_config_xml) of the jenkins library to update the task configuration, so as to achieve the purpose of quickly managing views.
[0076] The above embodiment replaces manual configuration with code automation processing, greatly reducing misoperations and saving time. It supports various processing requirements for views and tasks, making management more flexible and convenient. Since the solution is written in Python, it has good scalability and maintainability, facilitating subsequent function expansion and problem correction. The XML file operation function written in Python realizes the efficient management of Jenkins views and tasks, improving the overall work efficiency.
[0077] As shown Figure 5 in the figure, the present invention also provides a view and task management device based on software development, including:
[0078] A view and task acquisition module 10, configured to acquire all view lists and task lists generated during the software development process, and there is an association relationship between the views in the view list and the tasks in the task list;
[0079] A configuration information acquisition module 20, configured to acquire view configuration information in XML format and task configuration information in XML format respectively according to the view name;
[0080] A label position positioning module 30, configured to respectively locate the key label positions of the view configuration information in XML format and the task configuration information in XML format;
[0081] A label batch modification module 40, configured to perform batch modification at the key label positions of the view configuration information in XML format and the task configuration information in XML format.
[0082] In a specific embodiment, the view and task acquisition module 10 is specifically configured to:
[0083] Access the Jenkins service through the Python library jenkins;
[0084] Obtain all views through the first function of the jenkins library to form all view lists;
[0085] Obtain all tasks through the second function of the jenkins library to form all task lists.
[0086] In a specific embodiment, the configuration information acquisition module 20 is specifically configured to:
[0087] Call the third function of the jenkins library with the specified view name as a parameter to obtain the task list under the specified view;
[0088] Call the fourth function of the jenkins library with the view name as a parameter to obtain the specified view configuration;
[0089] Call the fifth function of the jenkins library with the task name as a parameter to obtain the task configuration.
[0090] In a specific embodiment, the label position positioning module 30 is specifically configured to:
[0091] Respectively locate the key label positions of the view configuration information in XML format and the task configuration information in XML format through the sixth function.
[0092] In a specific embodiment, the label batch modification module 40 is specifically configured to:
[0093] Batch add, modify, and delete sub - labels and label contents at the key label positions of the view configuration information in XML format and the task configuration information in XML format.
[0094] In a specific embodiment, the view and task management device based on software development further includes:
[0095] A configuration update module 50, configured to update the view configuration and the task configuration.
[0096] In a specific embodiment, the configuration update module 50 is specifically configured to:
[0097] Call the seventh function of the jenkins library with the view name and the XML text of the latest view configuration information as parameters to update the view configuration;
[0098] Call the eighth function of the jenkins library with the task name and the XML text of the latest task configuration information as parameters to update the task configuration.
[0099] It should be noted that those skilled in the art can clearly understand that the specific implementation processes of the above - mentioned view and task management device based on software development and each unit can refer to the corresponding descriptions in the foregoing method embodiments. For the sake of convenience and brevity of description, they will not be elaborated herein.
[0100] The above - mentioned view and task management device based on software development can be implemented in the form of a computer program, and this computer program can run on a computer device as shown in Figure 6 shown.
[0101] Please refer to Figure 6 , Figure 6 which is a schematic block diagram of a computer device provided by an embodiment of the present application. The computer device 500 can be a terminal or a server. Among them, the terminal can be an electronic device with a communication function such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant, and a wearable device. The server can be an independent server or a server cluster composed of multiple servers.
[0102] Refer to Figure 6 , the computer device 500 includes a processor 502, a memory, and a network interface 505 connected through a system bus 501. Among them, the memory can include a non - volatile storage medium 503 and an internal memory 504.
[0103] The non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032. The computer program 5032 includes program instructions that, when executed, enable the processor 502 to execute a view and task management method based on software development.
[0104] The processor 502 is used to provide computing and control capabilities to support the operation of the entire computer device 500.
[0105] The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, it enables the processor 502 to execute a view and task management method based on software development.
[0106] The network interface 505 is used for network communication with other devices. Those skilled in the art can understand that Figure 6 the structure shown in is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device 500 to which the solution of this application is applied. The specific computer device 500 may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0107] Among them, the processor 502 is used to run the computer program 5032 stored in the memory to implement the view and task management method based on software development as described above.
[0108] It should be understood that in the embodiment of this application, the processor 502 may be a central processing unit (CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0109] Those of ordinary skill in the art can understand that all or part of the processes in the methods of implementing the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program includes program instructions, and the computer program can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the embodiments of the above methods.
[0110] Therefore, the present invention also provides a storage medium. The storage medium can be a computer-readable storage medium. The storage medium stores a computer program, where the computer program includes program instructions. When the program instructions are executed by a processor, the processor executes the view and task management method based on software development as described above.
[0111] The storage medium can be various computer-readable storage media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disc, etc., which can store program codes.
[0112] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0113] In several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of each unit is only a logical function division, and there can be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0114] The steps in the method embodiments of the present invention can be adjusted, combined, and deleted according to actual needs. The units in the device embodiments of the present invention can be combined, divided, and deleted according to actual needs. In addition, the functional units in each embodiment of the present invention can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.
[0115] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a terminal, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention.
[0116] As described above, the above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of various equivalent modifications or substitutions, and these modifications or substitutions should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A view and task management method based on software development, characterized in that: Includes steps: S10, obtaining all view lists and task lists generated during the software development process, wherein the views in the view list are associated with the tasks in the task list; S20, obtaining view configuration information in XML format and task configuration information in XML format respectively according to the view name; S30, locating the key tag positions of the view configuration information in XML format and the task configuration information in XML format respectively; S40. Batch modify key tag positions of the view configuration information in XML format and the task configuration information in XML format.
2. The view and task management method based on software development as claimed in claim 1, characterized in that: Step S10 specifically includes: S11. Access the Jenkins service through the Python library Jenkins; S12. Obtain all views through the first function of the jenkins library to form a list of all views; S13. Obtain all tasks through the second function of the Jenkins library to form a list of all tasks.
3. The view and task management method based on software development as claimed in claim 1, characterized in that: Step S20 specifically includes: S21, calling the third function of the jenkins library with the specified view name as a parameter to obtain the task list under the specified view; S22, calling the fourth function of the jenkins library with the view name as a parameter to obtain the specified view configuration; S23. Call the fifth function of the jenkins library with the task name as a parameter to obtain the task configuration.
4. The view and task management method based on software development as claimed in claim 1, characterized in that: Step S30 specifically includes: The sixth function locates the key tag positions of the view configuration information in XML format and the task configuration information in XML format respectively.
5. The view and task management method based on software development as claimed in claim 1, characterized in that: Step S40 specifically includes: Batch add, modify and delete sub-tags and tag contents in key tag positions of XML-formatted view configuration information and XML-formatted task configuration information.
6. The view and task management method based on software development as claimed in claim 1, characterized in that: Also includes: S50: Update the view configuration and task configuration.
7. The view and task management method based on software development as claimed in claim 6, characterized in that: Step S50 specifically includes: S51, calling the seventh function of the Jenkins library to update the view configuration with the view name and the XML text of the latest view configuration information as parameters; S52: call the eighth function of the jenkins library to update the task configuration with the task name and the XML text of the latest task configuration information as parameters.
8. A view and task management device based on software development, characterized in that: include: A view and task acquisition module is used to acquire all view lists and task lists generated during the software development process, where the views in the view list are associated with the tasks in the task list; A configuration information acquisition module is used to acquire view configuration information in XML format and task configuration information in XML format according to the view name; The tag position positioning module is used to locate the key tag positions of the view configuration information in XML format and the task configuration information in XML format respectively; The tag batch modification module is used to batch modify the key tag positions of the view configuration information in XML format and the task configuration information in XML format.
9. A computer device, characterized in that: The computer device includes a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the view and task management method based on software development according to any one of claims 1 to 7 is implemented.
10. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the view and task management method based on software development as described in any one of claims 1 to 7 can be implemented.