Jenkins customized task information efficient acquisition method and system

By introducing the Jenkins task information static API and proxy API, the problem of low efficiency in obtaining Jenkins task information is solved, and efficient and real-time task information display and update are achieved, meeting users' personalized needs and improving the system's customizability and user satisfaction.

CN120631322APending Publication Date: 2025-09-12JIANGSU AUTOMATION RESEARCH INSTITUTE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510738389.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-04
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

In the existing technology, Jenkins task information acquisition efficiency is low, the traditional interface is not intuitive, data acquisition is difficult, the threshold for plug-in development is high, and the speed of information acquisition is slow in large-scale projects, affecting the user experience.

Method used

Introduce the Jenkins task information static API, combine it with the proxy API for parallel access, cache task information, design customized display models and data models, and obtain and update task information through the API.

Benefits of technology

It achieves efficient acquisition and real-time update of Jenkins task information, simplifies data flow, reduces system complexity, meets personalized needs, and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120631322A_ABST
    Figure CN120631322A_ABST
Patent Text Reader

Abstract

The invention provides a Jenkins customized task information efficient obtaining method and system, and the method achieves the quick obtaining and real-time updating of Jenkins task information through customizing a display demand and defining a static API and an agent API. The method specifically comprises the following steps: firstly, defining a static data model and an agent data model which meet display requirements, and a corresponding static API and an agent API; then, the display model accesses the static API through the proxy API to obtain static data model information and refresh and display the static data model information; and then the display model accesses the Jenkins API again through the proxy API, the latest Jenkins task information is obtained in a parallel mode, the proxy data model is updated and fed back to the display model and the static API, so that synchronous updating of the display model and the data model is ensured, and consistency and timeliness of the task information are maintained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and system for efficiently acquiring customized Jenkins task information. Background Art

[0002] Jenkins, a widely used automation server, plays a vital role in software development and continuous integration / continuous delivery (CI / CD) processes. Through its rich plugin ecosystem and flexible task configuration, Jenkins helps development teams automate build, testing, and deployment processes. However, as projects grow in size and complexity, the number and variety of Jenkins tasks also increase, creating challenges in accessing and displaying task information.

[0003] A Jenkins job typically includes multiple stages, such as build, test, and deploy, each of which may involve multiple steps and tools. Information such as the task's execution status, logs, and history is crucial for development and operations teams. Traditional methods for obtaining Jenkins task information rely primarily on Jenkins' built-in web interface. However, the default Jenkins interface's information display is unintuitive, requiring users to switch between different pages to obtain the required information. This manual operation is not only time-consuming and error-prone, but also inefficient in data acquisition. The default Jenkins interface lacks customization capabilities, making it difficult to meet the needs of specific teams. While developing custom Jenkins plugins can enhance the acquisition and display of task information, plugin development requires a certain technical threshold and high maintenance costs. Jenkins also provides an API for manually obtaining task information, but when projects are large and complex, information acquisition is very slow, significantly impacting the user experience. Summary of the Invention

[0004] The purpose of the present invention is to solve the problems raised in the above background technology and provide a method and system for efficiently obtaining customized task information of Jenkins.

[0005] To achieve the purpose of the present invention, the present invention discloses a method for efficiently obtaining customized task information in Jenkins. The method comprises the following steps: Step 1: Determine the display requirements of Jenkins task information and establish a display model; Step 2: Design a static API for Jenkins task information. Step 3: Design the Jenkins agent API; Step 4: Based on the Jenkins task information static API and proxy API, the display model obtains and displays the Jenkins task information.

[0006] Furthermore, step 2 is specifically as follows: Step 2-1: Design a static data model that meets the display requirements in step 1; Step 2-2: Design a static API for Jenkins task information that meets the display requirements in step 1. Step 2-3: Implement the Jenkins task information static API defined in step 2-2 to operate on the static data model.

[0007] Furthermore, step 3 is specifically as follows: Step 3-1. Design a proxy data model that meets the display requirements in step 1; Step 3-2: Design a proxy API that meets the requirements shown in step 1. Step 3-3: Implement the proxy API defined in step 3-2 to operate on the proxy data model.

[0008] Furthermore, step 4 is specifically as follows: Step 4-1. Display model access proxy API; Step 4-2: Use the proxy API to access the Jenkins task information static API. Step 4-3: The proxy API feeds the information in the static data model obtained through the Jenkins task information static API in step 4-2 back to the display model and refreshes the display; Step 4-4: After receiving the information from step 4-3, the display model accesses the proxy API again; Steps 4-5: The agent API accesses the Jenkins API to obtain the Jenkins task information required for the display model and updates the agent data model. Step 4-6: The proxy API feeds the proxy data model updated in step 4-4 back to the display model to update the display; Step 4-7: The proxy API feeds the proxy data model updated in step 4-4 back to the Jenkins task information static API to update the static data model. Furthermore, steps 4-5 are specifically as follows: Step 4-5-1: The proxy API accesses the Jenkins API in parallel, traverses all Jenkins tasks, and obtains Jenkins task information.

[0009] Compared with the existing technology, the significant improvements of the present invention are: 1) the introduction of a static API for Jenkins task information, caching task information, which can efficiently obtain task information and accelerate the creation and display of display models; 2) the proxy API accesses the Jenkins API in parallel to obtain the latest task information, and updates the static API and display model to ensure the accuracy and timeliness of the information; 3) task information is customized through the API, which is easy to expand and maintain, and convenient for integration with other systems; 4) the present invention provides an efficient, flexible, real-time, easy to expand and maintain Jenkins task information acquisition method, which can effectively solve the problems existing in the existing technology and meet the user's needs for quickly obtaining Jenkins task information.

[0010] In order to more clearly illustrate the functional characteristics and structural parameters of the present invention, further description is given below with reference to the accompanying drawings and specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings: Figure 1 This is a schematic diagram of the overall framework of the method for efficiently obtaining customized task information in Jenkins. DETAILED DESCRIPTION

[0012] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0013] This embodiment provides a method for efficiently obtaining customized Jenkins task information. The method realizes the rapid acquisition and real-time update of Jenkins task information by customizing display requirements and defining static APIs and proxy APIs. Specifically, it includes: first defining a static data model and a proxy data model that meet the display requirements, as well as the corresponding static APIs and proxy APIs; then the display model accesses the static API through the proxy API to obtain the static data model information and refresh the display; then the display model accesses the Jenkins API again through the proxy API to obtain the latest Jenkins task information in parallel, updates the proxy data model and feeds it back to the display model and static API, thereby ensuring the synchronous update of the display model and the data model, and maintaining the consistency and timeliness of the task information. Specifically, it includes the following steps: Step 1. Customize the display requirements of Jenkins task information; Step 2: Define the static API for Jenkins task information. Step 3. Define the Jenkins agent API; Step 4: Get and display Jenkins task information.

[0014] Furthermore, step 2 is specifically as follows: Step 2-1, define a static data model that meets the display requirements in step 1; Step 2-2, define the Jenkins task information static API that meets the display requirements in step 1; Step 2-3: Implement the Jenkins task information static API defined in step 2-2 to operate on the static data model.

[0015] Furthermore, step 3 is specifically as follows: Step 3-1, define the proxy data model that meets the display requirements in step 1; Step 3-2: Define the proxy API that meets the requirements shown in step 1. Step 3-3: Implement the proxy API defined in step 3-2 to operate on the proxy data model.

[0016] Furthermore, step 4 is specifically as follows: Step 4-1. Display model access proxy API; Step 4-2: Use the proxy API to access the Jenkins task information static API. Step 4-3: The proxy API feeds the information in the static data model obtained through the Jenkins task information static API in step 4-2 back to the display model and refreshes the display; Step 4-4: After receiving the information from step 4-3, the display model accesses the proxy API again; Steps 4-5: The agent API accesses the Jenkins API to obtain the Jenkins task information required for the display model and updates the agent data model. Step 4-6: The proxy API feeds the proxy data model updated in step 4-4 back to the display model to update the display; Step 4-7: The proxy API feeds the proxy data model updated in step 4-4 back to the Jenkins task information static API to update the static data model. Furthermore, steps 4-5 are specifically as follows: Step 4-5-1: The proxy API accesses the Jenkins API in parallel, traverses all Jenkins tasks, and obtains Jenkins task information.

[0017] like Figure 1 As shown, the model first interacts with the Jenkins task information static API through the proxy API to obtain information from the static data model. This information is quickly fed back to the display model to display Jenkins task details in real time. After the display model receives the information from the static data model, it will operate again through the proxy API. At this time, the proxy API directly communicates with the Jenkins API to obtain the latest task data from the Jenkins service. This latest data is used to update the proxy data model. Updates to the proxy data model will be synchronously reflected in the display model and the static data model to ensure that both can be updated in a timely manner to maintain the accuracy and timeliness of Jenkins task information. Example An embodiment of a method for efficiently obtaining customized Jenkins task information includes the following steps: S1. Customize the display requirements for Jenkins task information. In this embodiment, define and obtain group information and project information for all Jenkins tasks. Group information includes group name, projects within the group, and project groups within the group; project information includes project name, project type, branch information, and build information.

[0018] S2. Define the static API for Jenkins task information; S2.1. Define a static data model that meets the display requirements in S1. In this embodiment, the data structure is defined as follows; type StaticModel struct { Groups []GroupItem `json:"groups"` Projects []ProjectItem `json:"projects"` } type GroupItem struct { Name string `json:"groupName"` Projects []ProjectItem `json:"projects"` Groups []GroupItem `json:"groups"` } type ProjectItem struct { ProjectName string `json:"projectName"` Branches []BranchItem `json:"branches"` ProjectType string `json:"projectType"` Builds []BuildItem `json:"builds"` } type BranchItem struct { BranchName string `json:"branchName"` Builds []BuildItem `json:"builds"` Color string `json:"color"` JobType string `json:"jobType"` BuildNumber int64 `json:"buildNumber"` FullName string `json:"fullName"` } type BuildItem struct { BuildNumber int64 `json:"buildNumber"` Result string `json:"result"` Timestamp string `json:"timestamp"` JobType string `json:"jobType"` } S2.2. Define a static API for Jenkins task information that meets the display requirements in S1. In this embodiment, define the function as follows: func CreateStaticData(model string); The CreateStaticData function is used to create a static data model. Its parameter model is the serialized string of the proxy data model.

[0019] func GetStaticData() string; The GetStaticData function is used to return the serialized string of the static data model.

[0020] func UpdateStaticData(model string); The UpdataStaticData function is used to update the static data model. Its parameter model is the serialized string of the proxy data model.

[0021] S2.3. Implement the Jenkins task information static API defined in S2.2 to operate on the static data model. In this embodiment, the three functions in S2.2 are implemented to improve the Jenkins task information static processing function.

[0022] S3. Define the Jenkins agent API.

[0023] S3.1. Define the proxy data model that meets the display requirements in S1. Define the data structure as follows: type ProxyModel struct { Groups []GroupItem `json:"groups"` Projects []ProjectItem `json:"projects"` } In this embodiment, the proxy data model is kept consistent with the static data model.

[0024] S3.2, define the proxy API that meets the display requirements in S1; func GetData(type int) string; The GetData function is used to obtain Jenkins custom task information. In this example, the parameter type is used to identify the access object. When type = 0, it accesses the Jenkins task information static API through the proxy API to obtain the static data model. When type = 1, it accesses the Jenkins API through the proxy API to obtain task information on the current Jenkins server. The task information is serialized into a string and fed back to the display model.

[0025] func CreateProxyData(data string); The CreateProxyData function is used to create a proxy data model. Its parameter is the string returned by the Jenkins API.

[0026] func UpdateProxyData(data string); The UpdataProxyData function is used to update the proxy data model. Its parameter is the string returned by the Jenkins API.

[0027] S3.3. Implement the proxy API defined in S3.2 to operate on the proxy data model. In this embodiment, the three functions in S3.2 are implemented.

[0028] S4. Get and display Jenkins task information.

[0029] S4.1. Display model accesses proxy API. In this embodiment, the display model calls the GetData function in the proxy API, and the parameter type=0 is passed in. S4.2. The proxy API accesses the Jenkins task information static API. In this embodiment, the proxy API calls the GetStaticData function in the static data model. S4.3. The proxy API feeds the information obtained by the GetStaticData function in S4.2 back to the display model and refreshes the display. S4.4. After receiving the information in step 4.3, the display model calls the GetData function in the proxy API again, passing in type=1 as the parameter; S4.5. The proxy API accesses the Jenkins API to obtain the Jenkins task information required for the display model and calls the UpdateProxyData function to update the proxy data model. S4-6, the proxy API feeds the proxy data model updated in S4.5 back to the display model to update the display; S4-7. The proxy API calls the UpdateStaticData function in the Jenkins task information static API, feeds the serialized data in S4.5 back to the Jenkins task information static API, and updates the static data model.

[0030] Furthermore, S4-5 is specifically as follows: S4.5.1. The proxy API accesses the Jenkins API in parallel, traverses all Jenkins tasks, and obtains Jenkins task information. In this embodiment, the concurrent implementation code using the Go language is as follows: var wg sync.WaitGroup var mu sync.Mutex for _, job := range jobs { wg.Add(1) go func() { defer wg.Done() jobData, err := checkJobType(ctx, job) if err != nil { os.Exit(1) } mu.Lock() switch jobData.(type) { case entities.GroupItem: tree.Groups = append(tree.Groups, jobData.(entities.GroupItem)) case entities.ProjectItem: tree.Projects = append(tree.Projects, jobData.(entities.ProjectItem)) default: } mu.Unlock() }() } wg.Wait() In the checkJobType function, the Jenkins task information is obtained.

[0031] This embodiment also provides a Jenkins customized task information efficient acquisition system, including: The display model obtains and displays Jenkins task information based on the Jenkins task information static API and proxy API; Jenkins task information static API design module, used to design Jenkins task information static API Jenkins agent API design module, design Jenkins agent API.

[0032] This embodiment also provides an electronic device, including: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the described method.

[0033] This embodiment further provides a computer-readable medium having a computer program stored thereon, which implements the method described above when the program is executed by a processor.

[0034] This method achieves the following goals: 1) improves the efficiency of acquiring Jenkins task information, enabling it to quickly respond to user display needs; 2) simplifies the data acquisition process, reduces system complexity, and ensures that users can obtain the latest task status; 3) through customized methods, meets the personalized needs of different users for displaying Jenkins task information. In summary, this invention optimizes the management and display process of Jenkins task information, improves the efficiency and quality of information processing, and enhances the system's customizability and user satisfaction.

[0035] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus.

[0036] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.

Claims

1. A method for efficiently obtaining customized task information of Jenkins, characterized in that: The following steps are involved: Step 1: Determine the display requirements for Jenkins task information and establish a display model; Step 2: Design a static API for Jenkins task information. Step 3: Design the Jenkins agent API; Step 4: Based on the Jenkins task information static API and proxy API, the display model obtains and displays the Jenkins task information.

2. A Jenkins customized task information efficient acquisition method according to claim 1, characterized in that: The task information includes group information and project information. The group information includes group name, projects within the group, and project groups within the group; the project information includes project name, project type, branch information, and build information.

3. A method for efficiently obtaining customized Jenkins task information according to claim 1, characterized in that: Step 2 is as follows: Step 2-1: Design a static data model that meets the display requirements in step 1; Step 2-2: Design a static API for Jenkins task information that meets the display requirements in step 1.

4. A method for efficiently obtaining customized Jenkins task information according to claim 3, characterized in that: Step 3 is as follows: Step 3-1. Design a proxy data model that meets the display requirements in step 1; Step 3-2. Design a proxy API that meets the requirements shown in step 1.

5. A method for efficiently obtaining customized Jenkins task information according to claim 4, characterized in that: Step 4 is as follows: Step 4-1. Display model access proxy API; Step 4-2: Use the proxy API to access the Jenkins task information static API. Step 4-3: The proxy API feeds the information in the static data model obtained through the Jenkins task information static API in step 4-2 back to the display model and refreshes the display; Step 4-4: After receiving the information from step 4-3, the display model accesses the proxy API again; Steps 4-5: The agent API accesses the Jenkins API to obtain the Jenkins task information required for the display model and update the agent data model; Step 4-6: The proxy API feeds the proxy data model updated in step 4-4 back to the display model to update the display; Step 4-7: The agent API feeds back the agent data model updated in step 4-4 to the Jenkins task information static API to update the static data model.

6. A method for efficiently obtaining customized Jenkins task information according to claim 5, characterized in that: Step 4-5 is as follows: Step 4-5-1. The proxy API accesses the Jenkins API in parallel, traverses all Jenkins tasks, and obtains Jenkins task information.

7. A Jenkins customized task information efficient acquisition system, characterized by: include: The display model obtains and displays Jenkins task information based on the Jenkins task information static API and proxy API; Jenkins task information static API design module, used to design Jenkins task information static API; Jenkins agent API design module, design Jenkins agent API.

8. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.

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