Assembly line running state storage method and device, equipment and medium

Through the combination of cache queues and Redis databases, the number of times the Jenkins pipeline reads and writes to relational databases is reduced, and the problem of pipeline operation status storage on database I/O pressure is solved, and the system performance and response speed is improved.

CN118981504APending Publication Date: 2024-11-19SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD

Patent Information

Application Number
CN202411227300.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-03
Publication Date
2024-11-19

AI Technical Summary

Technical Problem

The frequent database read and write operations in the Jenkins pipeline in the traditional method leads to excessive I/O pressure on relational databases, affecting system performance and response speed.

Method used

The cache queue stores the metadata of the Jenkins pipeline, and uses the Redis database to store and query the real-time running state, reduces the number of reads and writes to the relational database, and updates the data synchronously using preset time.

Benefits of technology

It significantly reduces the I/O pressure on relational databases, improves the overall performance and response speed of the system, and quickly responds to frequent state update requests through Redis databases, and optimizes the response speed of monitoring and debugging.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118981504A_ABST
    Figure CN118981504A_ABST
Patent Text Reader

Abstract

The invention discloses an assembly line running state storage method and device, equipment and a medium, is applied to a back end, and relates to the field of software development, the method comprises the following steps: after a Jenkins assembly line starts execution, storing metadata corresponding to the Jenkins assembly line, querying an assembly line real-time running state and a node real-time running state based on the metadata, and returning a query result; synchronizing the real-time running state of the node and the real-time running state of the assembly line to a front end for display; updating the real-time running state of the assembly line and the real-time running state of the node to a Redis database according to a query result, and judging the real-time running state of the assembly line; and updating the Redis database according to a judgment result, obtaining an updated Redis database, and synchronizing the running data in the updated Redis database to the relational database based on preset time so as to complete storage of the running state. According to the invention, the operation state of the assembly line is stored.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of software development, and in particular to a pipeline operation status storage method, device, equipment and medium. Background Art

[0002] In the modern software development process, CI (Continuous Integration) and CD (Continuous Deployment) have become key practices to ensure software quality and speed up delivery. Complex build, test and deployment processes are defined and managed through pipeline scripts. For example, the Jenkins (a continuous integration tool) pipeline organizes the various steps in the entire software development life cycle into an automated process, including code inspection, building, unit testing, integration testing, deployment, etc. Each step is usually called a node. During the execution of the Jenkins pipeline, monitoring and recording the running status of each node is crucial for debugging and optimizing the build process. This status information includes the start time, end time, and running status (such as running, success, failure, etc.) of the node. The traditional method is to store this status information in a relational database (such as MySQL). However, due to the high frequency and real-time nature of the Jenkins pipeline, frequent database read and write operations will cause excessive I / O (Input / Output) pressure on the relational database, thereby affecting the overall performance and response speed of the system.

[0003] In summary, how to reduce the I / O pressure on relational databases and improve the overall performance and response speed of the system is an urgent problem to be solved. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a pipeline operation status storage method, device, equipment and medium, which can reduce the I / O pressure on the relational database and improve the overall performance and response speed of the system. The specific scheme is as follows:

[0005] In a first aspect, the present application discloses a pipeline operation status storage method, which is applied to a backend, and includes:

[0006] After the Jenkins pipeline starts executing, the metadata corresponding to the Jenkins pipeline is stored in the cache queue, and the target application programming interface built in Jenkins is called to query the corresponding pipeline real-time running status and node real-time running status based on the metadata in the cache queue, and the corresponding query results are returned;

[0007] Synchronize the real-time running status of the node and the real-time running status of the pipeline to the front end so as to display the real-time running status of the node and the real-time running status of the pipeline on the front end page;

[0008] According to the query result, the real-time running status of the pipeline and the real-time running status of the node are updated to the Redis database, and the real-time running status of the pipeline is judged to obtain the corresponding judgment result;

[0009] According to the judgment result, the running data in the Redis database is updated accordingly, the updated Redis database is obtained, and the running data in the updated Redis database is synchronized to the relational database based on the preset time to complete the storage of the running status of the Jenkins pipeline.

[0010] Optionally, storing the metadata corresponding to the Jenkins pipeline in a cache queue, and calling a target application programming interface built in Jenkins to query the corresponding pipeline real-time running status and node real-time running status based on the metadata in the cache queue, including:

[0011] The metadata corresponding to the Jenkins pipeline is stored in the cache queue, and the metadata of the running Jenkins pipeline is read from the cache queue in a regular loop;

[0012] The target application programming interface built into Jenkins is called according to the pipeline ID and the running node ID in the metadata to query the real-time running status of the pipeline and the real-time running status of the node.

[0013] Optionally, after calling the target application programming interface built in Jenkins to query the corresponding pipeline real-time running status and node real-time running status based on the metadata in the cache queue, it also includes:

[0014] If data anomalies occur in the real-time running status of the pipeline and the real-time running status of the node during the running status query process, the operation is directly stopped and the next query is waited for.

[0015] Optionally, the updating the operation data in the Redis database accordingly according to the judgment result includes:

[0016] If the real-time running status of the pipeline is the running end status, the Jenkins pipeline is removed from the cache queue, and the query result is parsed. The running data in the Redis database is updated accordingly according to the corresponding parsing result, and the real-time running status of the pipeline and the real-time running status of the node corresponding to the Jenkins pipeline in the relational database are updated based on the parsing result.

[0017] Optionally, the updating the operation data in the Redis database accordingly according to the judgment result includes:

[0018] If the real-time running status of the pipeline is in the running state, the query result is parsed, and the running data in the Redis database is updated accordingly according to the corresponding parsing result.

[0019] Optionally, the pipeline operation status storage method further includes:

[0020] If the current page of the front end has an initialization operation or a change operation, the front end calls the pipeline-status interface to query the real-time running status of the node and the real-time running status of the pipeline of the target Jenkins pipeline that meets the preset conditions, so that the current page is rendered based on the real-time running status of the node and the real-time running status of the pipeline of the target Jenkins pipeline;

[0021] After the page rendering is completed, the Jenkins pipeline that is running on the current page is obtained through the front-end at a regular interval, and the pipeline-running interface is called to obtain the running status data of the running Jenkins pipeline, and it is determined whether the running status data is consistent with the page data corresponding to the current page;

[0022] If they are inconsistent, it is determined that there is a Jenkins pipeline started from other pages, and the page data corresponding to the current page is synchronized with the running status data through the front end, and the pipeline-status interface is called to query the real-time running status of the node and the real-time running status of the Jenkins pipeline corresponding to the current page, and the page data is refreshed using the queried data;

[0023] If they are consistent, the page data is refreshed based on the running status data through the front end.

[0024] Optionally, the pipeline operation status storage method further includes:

[0025] During the execution of the Jenkins pipeline, if a retry or termination operation occurs, querying the metadata in the cache queue;

[0026] Based on the metadata, query the target information of the retry node from the Redis database, and call the target Jenkins plug-in interface according to the target information to query the running status data corresponding to the retry node;

[0027] The Redis database and the relational database are updated based on the operating status data.

[0028] In a second aspect, the present application discloses a pipeline operation status storage device, which is applied to a backend, and includes:

[0029] The running status query module is used to store the metadata corresponding to the Jenkins pipeline through the cache queue after the Jenkins pipeline starts to execute, call the target application programming interface built in Jenkins to query the corresponding pipeline real-time running status and node real-time running status based on the metadata in the cache queue, and return the corresponding query results;

[0030] An operation status synchronization module is used to synchronize the real-time operation status of the node and the real-time operation status of the pipeline to the front end, so as to display the real-time operation status of the node and the real-time operation status of the pipeline on the front end page;

[0031] An operation status judgment module is used to update the real-time operation status of the pipeline and the real-time operation status of the node to the Redis database according to the query result, and judge the real-time operation status of the pipeline to obtain a corresponding judgment result;

[0032] The operation status storage module is used to update the operation data in the Redis database accordingly according to the judgment result, obtain the updated Redis database, and synchronize the operation data in the updated Redis database to the relational database based on the preset time to complete the storage of the operation status of the Jenkins pipeline.

[0033] In a third aspect, the present application discloses an electronic device, comprising:

[0034] Memory, used to store computer programs;

[0035] The processor is used to execute the computer program to implement the steps of the aforementioned pipeline operation status storage method.

[0036] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the steps of the aforementioned pipeline operation status storage method are implemented.

[0037] When storing the real-time running status of the pipeline, the present application first stores the metadata corresponding to the Jenkins pipeline through the cache queue after the Jenkins pipeline starts to execute, calls the target application programming interface built in Jenkins to query the corresponding real-time running status of the pipeline and the real-time running status of the node based on the metadata in the cache queue, and returns the corresponding query result; synchronizes the real-time running status of the node and the real-time running status of the pipeline to the front end so that the real-time running status of the node and the real-time running status of the pipeline can be displayed on the front-end page; updates the real-time running status of the pipeline and the real-time running status of the node to the Redis database according to the query result, judges the real-time running status of the pipeline, and obtains the corresponding judgment result; updates the running data in the Redis database according to the judgment result, obtains the updated Redis database, and synchronizes the running data in the updated Redis database to the relational database based on the preset time to complete the storage of the running status of the Jenkins pipeline. It can be seen that this application utilizes the advantages of Redis database's fast reading and writing speed and its ability to quickly respond to frequent status update requests, stores the frequently updated real-time operation status of the pipeline and the real-time operation status of the node in the Redis database, and uses the Redis database to update the relational database based on the preset time, thereby avoiding updating the relational database every time the real-time operation status of the node and the real-time operation status of the Jenkins pipeline are updated, significantly reducing the number of read and write times for the relational database, alleviating the I / O pressure on the relational database, and improving the overall performance and response speed of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0039] Figure 1 A flow chart of a pipeline operation status storage method disclosed in this application;

[0040] Figure 2 A flow chart of the operation status of a front-end refresh pipeline disclosed in this application;

[0041] Figure 3 A user interface disclosed in this application displays a flow chart of the pipeline operation status;

[0042] Figure 4 An interface call signaling diagram for obtaining the operation status of a pipeline disclosed in this application;

[0043] Figure 5 A flowchart of a specific pipeline operation status storage method disclosed in this application;

[0044] Figure 6 This is a schematic diagram of the structure of a pipeline operation status storage device disclosed in this application;

[0045] Figure 7 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION

[0046] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0047] At present, pipelines are usually needed to define and manage complex build, test and deployment processes in the software development process. For example, Jenkins pipelines can be used as a continuous integration tool to organize the various steps in the entire software development life cycle into an automated process, including code inspection, building, unit testing, integration testing, deployment, etc. Each step is usually referred to as a node. During the execution of the Jenkins pipeline, monitoring and recording the running status of each node is crucial for debugging and optimizing the build process. These status information include the start time, end time, and running status (such as running, success, failure, etc.) of the node. The traditional method is to store this status information in a relational database (such as MySQL). However, due to the high frequency and real-time nature of the Jenkins pipeline, frequent database read and write operations will cause excessive I / O pressure on the relational database, thereby affecting the overall performance and response speed of the system. In order to solve the above technical problems, the present application discloses a pipeline running status storage method, device, equipment and medium, which can reduce the I / O pressure on the relational database and improve the overall performance and response speed of the system.

[0048] See also Figure 1 As shown, an embodiment of the present invention discloses a pipeline operation status storage method, which is applied to the back end and includes:

[0049] Step S11, after the Jenkins pipeline starts to execute, the metadata corresponding to the Jenkins pipeline is stored through the cache queue, and the target application programming interface built into Jenkins is called to query the corresponding pipeline real-time running status and node real-time running status based on the metadata in the cache queue, and return the corresponding query results.

[0050] In this embodiment, in the continuous integration and continuous deployment (CI / CD) process, the Jenkins pipeline usually includes one or more nodes. If the Jenkins pipeline is started from a stopped state, it is necessary to splice parameters to call the Jenkins plug-in interface to start the pipeline, and store the metadata of the pipeline in the pipeline cache, waiting to read the synchronization pipeline status information. After the pipeline starts to execute, it will start running in the order of node creation. After the Jenkins pipeline starts to execute, the backend stores the metadata corresponding to the Jenkins pipeline in the cache queue. The metadata corresponding to the Jenkins pipeline includes the pipeline ID (Identity document) and the running node ID of the pipeline. When calling the built-in target application programming interface in Jenkins for query, the real-time running status of the corresponding pipeline is queried based on the pipeline ID in the metadata in the cache queue, and the real-time running status of the node is queried based on the running node ID in the metadata. Since the real-time running status of the pipeline and the real-time running status of the node of the Jenkins pipeline are refreshed at a high frequency, in order to update the real-time running status of the pipeline and the real-time running status of the node in time, the metadata of the running Jenkins pipeline can be read from the cache queue in a timed loop based on the preset time interval, and then the target application programming interface built into Jenkins is called according to the pipeline ID and running node ID in the metadata to query the real-time running status of the pipeline and the real-time running status of the node.

[0051] In this embodiment, the target application programming interface built in Jenkins uses the metadata corresponding to the Jenkins pipeline to query the real-time running status of the pipeline and the real-time running status of the node, and then generates corresponding query results based on the queried real-time running status of the pipeline and the real-time running status of the node, and returns the query results to the backend so that the backend can parse the query results returned by the target application interface, thereby obtaining the real-time running status of the pipeline and the real-time running status of the node of the Jenkins pipeline. It is understandable that if a data exception occurs during the process of calling the target application programming interface to query the real-time running status of the pipeline and the real-time running status of the node, the operation is stopped directly and the next query is waited for. In other words, this application calls the Jenkins interface to query the current node and the pipeline status according to the pipeline ID and the running node ID in the metadata. If an exception occurs here, the processing is stopped and the query is continued when the data is read next time.

[0052] Step S12: synchronizing the real-time running status of the node and the real-time running status of the pipeline to the front end so as to display the real-time running status of the node and the real-time running status of the pipeline on the front end page.

[0053] In this embodiment, the application needs to synchronize the node running status of Jenkins and the running results of the entire pipeline to the business platform, that is, the backend synchronizes the queried real-time running status of the node and the real-time running status of the pipeline to the front end, such as Figure 2As shown, when the front end displays the real-time running status of the node and the real-time running status of the pipeline, if the current page of the front end has an initialization operation or a change operation, the real-time running status of the node and the real-time running status of the pipeline of the target Jenkins pipeline that meets the preset conditions is queried by calling the pipeline-status (pipeline status) interface, so that the current page is rendered based on the real-time running status of the node and the real-time running status of the pipeline of the target Jenkins pipeline; after the page rendering is completed, the Jenkins pipeline that is running on the current page is obtained by the front end at a fixed time, and the pipeline-running (pipeline running) interface is called to obtain the running status data of the running Jenkins pipeline, and it is determined whether the running status data is consistent with the page data corresponding to the current page; if not, it is determined that there is a Jenkins pipeline started from other pages, and the page data corresponding to the current page is synchronized with the running status data through the front end, and the pipeline-status interface is called to query the real-time running status of the node and the real-time running status of the pipeline of the Jenkins pipeline corresponding to the current page, and the page data is refreshed using the queried data; if consistent, the page data is refreshed based on the running status data through the front end. Specifically, after the front-end page is initialized or modified, the pipeline-status interface is called. The interface queries the pipeline data and running status that meet the current query conditions and returns. After the front-end renders the page according to the returned data, it periodically obtains the running pipeline of the current page and calls the pipeline-running interface to refresh the running status. Because functions such as account authorization may not be started on this page, it is necessary to determine the difference between the interface return value and the page data. When there is a difference, it means that a pipeline is started from a non-current page and needs to be synchronized. Then call the pipeline-status interface to refresh all data. If there is no difference, refresh the running node status normally.

[0054] For the above pipeline-status interface and pipeline-running interface, such as Figure 3As shown, the interface pipeline-status can obtain all data, including the metadata and status data of the Jenkins pipeline, query all metadata information and end-of-run status data in the relational database, query the Redis database to obtain the real-time running status of the running pipeline and the real-time running status of the node, and hand over the queried data to the front-end for display. The interface pipeline-running can obtain runtime status data. This interface obtains the running status to be displayed from Redis according to the pipeline ID. If the corresponding running status data does not exist in Redis, it means that the pipeline has ended and exceeded the remaining expiration time, and obtains the missing running status data from the relational database. The 10-second remaining expiration time set when updating the Redis database is essentially to reduce the occurrence of such situations by delaying data deletion, thereby reducing query requests to the relational database. In addition, Figure 4 As shown, if the pipeline that the user interface wants to display is running, the interface pipeline-running is called to access the relational database to obtain the basic information of the pipeline, such as metadata, and then the basic information of the pipeline is used to obtain all the status data of the pipeline from the Redis database; if the pipeline that the user interface wants to display has ended, the interface pipeline-status is called to obtain all the data of the pipeline from the relational database.

[0055] Step S13: update the real-time running status of the pipeline and the real-time running status of the node to the Redis database according to the query result, and judge the real-time running status of the pipeline to obtain the corresponding judgment result.

[0056] In this embodiment, after the backend obtains the query results, it parses the query results to obtain the real-time running status of the pipeline and the real-time running status of the node, and then uses the real-time running status of the pipeline and the real-time running status of the node obtained by the analysis to refresh the Redis database, and judges whether the pipeline is running based on the real-time running status of the pipeline to obtain the judgment result, and performs subsequent operations based on the judgment result. As a high-performance key-value database, Redis can handle a large number of read and write operations with sub-millisecond delays. By using Redis to store and obtain node status during the execution of the pipeline, the system can reflect changes in node status more promptly, significantly improving the response speed of monitoring and debugging. At the same time, Redis's high availability and distributed characteristics enable it to adapt to large-scale and high-concurrency environments, further improving the reliability and scalability of the system, and can be easily extended to other CI / CD tools and scenarios.

[0057] Step S14: update the operation data in the Redis database accordingly according to the judgment result, obtain the updated Redis database, and synchronize the operation data in the updated Redis database to the relational database based on the preset time to complete the storage of the operation status of the Jenkins pipeline.

[0058] In this embodiment, if the real-time running state of the pipeline is the running end state, the metadata corresponding to the Jenkins pipeline is removed from the cache queue to avoid querying the real-time running state of the pipeline and the real-time running state of the node again in the subsequent query process, and then the query results are parsed. The real-time running state of the pipeline and the real-time running state of the node are the final results. The running data in the relational database and the Redis database can be directly updated according to the real-time running state of the pipeline and the real-time running state of the node obtained by parsing. In a specific embodiment, if the pipeline has ended running, all data corresponding to the Jenkins pipeline in the Redis database can be deleted after 10 seconds or other preset remaining expiration time, thereby releasing memory resources and ensuring that the data in the Redis database always maintains the latest and most relevant state. If the real-time running state of the pipeline is in the running state, it means that the pipeline state will also change, and the query results are parsed. According to the corresponding parsing results, the running data in the Redis database is updated accordingly, and the running data in the updated Redis database is synchronized to the relational database based on the preset time to complete the storage of the running state of the Jenkins pipeline. By synchronizing the running data in batches based on the preset time, the number of write operations to the relational database can be reduced, thereby further optimizing the system performance.

[0059] During the execution of the Jenkins pipeline, if a retry or termination operation occurs, the metadata in the cache queue is queried, the target information of the retry node is queried from the Redis database based on the metadata, the target Jenkins plug-in interface is called according to the target information to query the running status data corresponding to the retry node, and the Redis database and the relational database are updated based on the running status data. At the same time, a timed task or event-driven method can be used to monitor the changes in the node status in Redis, and trigger the corresponding processing logic, such as notification, alarm, etc., when a retry or termination operation occurs. In other words, during the execution of the pipeline, if operations such as retry or termination occur, query the pipeline metadata, query the retry node information from redis according to the metadata, call the Jenkins plug-in interface to terminate or retry the interface, update the data in the relational database after the result is returned, and synchronously update the running status in redis, and return the processing result. In addition, when starting the pipeline from the stopped state, it is necessary to splice the parameters to call the Jenkins plug-in interface to start the pipeline, and store the metadata of the pipeline in the pipeline cache, waiting to read the synchronous pipeline status information.

[0060] It can be seen that this application utilizes the advantages of Redis database's fast reading and writing speed and its ability to quickly respond to frequent status update requests, stores the frequently updated real-time operation status of the pipeline and the real-time operation status of the node in the Redis database, and uses the Redis database to update the relational database based on the preset time, thereby avoiding updating the relational database every time the real-time operation status of the node and the real-time operation status of the Jenkins pipeline are updated, significantly reducing the number of read and write times for the relational database, alleviating the I / O pressure on the relational database, and improving the overall performance and response speed of the system.

[0061] Based on the previous embodiment, it can be seen that the present application provides a method for storing the operation status of an assembly line. Next, a specific process for storing the operation status of an assembly line will be described in detail.

[0062] like Figure 5As shown in the figure, when the user starts to execute a pipeline, the backend adds the metadata of the pipeline to the cache queue in the cache pool, and then executes the operation of querying the pipeline metadata asynchronously in the cache pool through the built-in application programming interface of the Jenkins pipeline based on the preset time and obtaining the real-time running status of the pipeline and the real-time running status of the node of the pipeline according to the metadata. After the application programming interface obtains the real-time running status of the pipeline and the real-time running status of the node of the pipeline, the backend refreshes the real-time running status of the pipeline and the real-time running status of the node of the pipeline to the Redis database, and based on the running status of the pipeline, the running status of the pipeline is updated. The state is stored. If the pipeline operation is completed, that is, the data returned by the interface is the final operation result, the metadata corresponding to the Jenkins pipeline is removed from the cache queue to avoid querying the real-time operation state of the pipeline and the real-time operation state of the node of the pipeline again in the subsequent query process, and then the query result is parsed. The real-time operation state of the pipeline and the real-time operation state of the node at this time are the final results. The operation data in the relational database and the Redis database can be directly updated according to the real-time operation state of the pipeline and the real-time operation state of the node obtained by parsing, and the operation data in redis is updated and the remaining expiration time is set, and the single process processing is completed. The historical node status data in Redis is regularly cleaned up according to the remaining expiration time to avoid occupying too much memory resources and ensure that the data in Redis always keeps the latest and most relevant state. If the pipeline is still running, it means that the pipeline state will change. The query result is parsed, and the operation data in the Redis database is updated accordingly according to the corresponding parsing result, and the operation data in the updated Redis database is synchronized to the relational database based on the preset time to complete the storage of the operation state of the Jenkins pipeline. By synchronizing the running data in batches based on the preset time, the number of write operations to the relational database can be reduced, thereby further optimizing the system performance.

[0063] It can be seen that this application releases memory resources by deleting all data corresponding to the pipeline in the Redis database based on the remaining expiration time after the pipeline runs, and the status data of the pipeline can still be obtained from the Redis database within the expiration time, delaying data deletion and reducing query requests to the relational database; for the status information of the pipeline in operation, the status information in the Redis database is synchronized to the relational database in batches based on the preset time through transaction processing, ensuring the consistency and integrity of the data. The use of batch synchronization can reduce the number of database write operations, thereby further optimizing system performance.

[0064] See also Figure 6As shown, the present application discloses a pipeline operation status storage device, which is applied to the back end and includes:

[0065] The running status query module 11 is used to store the metadata corresponding to the Jenkins pipeline through the cache queue after the Jenkins pipeline starts to execute, call the target application programming interface built in Jenkins to query the corresponding pipeline real-time running status and node real-time running status based on the metadata in the cache queue, and return the corresponding query results;

[0066] The operation status synchronization module 12 is used to synchronize the real-time operation status of the node and the real-time operation status of the pipeline to the front end, so as to display the real-time operation status of the node and the real-time operation status of the pipeline on the front end page;

[0067] The operation status judgment module 13 is used to update the real-time operation status of the pipeline and the real-time operation status of the node to the Redis database according to the query result, and judge the real-time operation status of the pipeline to obtain the corresponding judgment result;

[0068] The operation status storage module 14 is used to update the operation data in the Redis database accordingly according to the judgment result, obtain the updated Redis database, and synchronize the operation data in the updated Redis database to the relational database based on the preset time to complete the storage of the operation status of the Jenkins pipeline.

[0069] It can be seen that this application utilizes the advantages of Redis database's fast reading and writing speed and its ability to quickly respond to frequent status update requests, stores the frequently updated real-time operation status of the pipeline and the real-time operation status of the node in the Redis database, and uses the Redis database to update the relational database based on the preset time, thereby avoiding updating the relational database every time the real-time operation status of the node and the real-time operation status of the Jenkins pipeline are updated, significantly reducing the number of read and write times for the relational database, alleviating the I / O pressure on the relational database, and improving the overall performance and response speed of the system.

[0070] In a specific embodiment, the operation status query module 11 may specifically include:

[0071] A metadata reading unit, used to store the metadata corresponding to the Jenkins pipeline through the cache queue, and read the metadata of the running Jenkins pipeline from the cache queue in a regular loop;

[0072] The running status reading unit is used to call the target application programming interface built into Jenkins according to the pipeline ID and the running node ID in the metadata to query the real-time running status of the pipeline and the real-time running status of the node.

[0073] In a specific embodiment, the pipeline operation status storage device may further include:

[0074] The data abnormality operation module is used to directly stop the operation and wait for the next query if data abnormality occurs in the real-time operation status of the pipeline and the real-time operation status of the node during the operation status query process.

[0075] In a specific embodiment, the operation status storage module 14 may specifically include:

[0076] The run end operation unit is used to remove the Jenkins pipeline from the cache queue if the real-time running status of the pipeline is the run end status, and parse the query result, and update the running data in the Redis database accordingly according to the corresponding parsing result, and update the real-time running status of the pipeline and the real-time running status of the node corresponding to the Jenkins pipeline in the relational database based on the parsing result.

[0077] In a specific embodiment, the operation status storage module 14 may specifically include:

[0078] The running operation unit is used to parse the query result if the real-time running state of the pipeline is the running state, and update the running data in the Redis database accordingly according to the corresponding parsing result.

[0079] In a specific embodiment, the device may further include:

[0080] A page rendering module, which is used to call the pipeline-status interface through the front end to query the real-time running status of the node and the real-time running status of the target Jenkins pipeline that meets the preset conditions if there is an initialization operation or a change operation on the current page of the front end, so that the current page is rendered based on the real-time running status of the node and the real-time running status of the pipeline of the target Jenkins pipeline;

[0081] A data judgment module is used to obtain the Jenkins pipeline that is running on the current page through the front end at a fixed time after the page rendering is completed, and to call the pipeline-running interface to obtain the running status data of the running Jenkins pipeline, and to determine whether the running status data is consistent with the page data corresponding to the current page;

[0082] The first data refresh module is used to determine that there is a Jenkins pipeline started from other pages if there is inconsistency, synchronize the page data corresponding to the current page with the running status data through the front end, call the pipeline-status interface to query the real-time running status of the node and the real-time running status of the Jenkins pipeline corresponding to the current page, and use the queried data to refresh the page data;

[0083] The second data refresh module is used to refresh the page data based on the running status data through the front end if they are consistent.

[0084] In a specific embodiment, the device may further include:

[0085] A metadata query module, used to query the metadata in the cache queue if a retry or termination operation occurs during the execution of the Jenkins pipeline;

[0086] A running status data query module is used to query the target information of the retry node from the Redis database based on the metadata, and call the target Jenkins plug-in interface to query the running status data corresponding to the retry node according to the target information;

[0087] An operation status update module is used to update the Redis database and the relational database based on the operation status data.

[0088] Furthermore, the present application also discloses an electronic device. Figure 7 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.

[0089] Figure 7A schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the pipeline operation status storage method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.

[0090] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0091] In addition, the memory 22 as a carrier for resource storage may be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon may include an operating system 221, a computer program 222, etc., and the storage method may be temporary storage or permanent storage.

[0092] The operating system 221 is used to manage and control the hardware devices and computer program 222 on the electronic device 20, and can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the pipeline operation status storage method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.

[0093] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the pipeline operation status storage method disclosed above is implemented. For the specific steps of the method, reference may be made to the corresponding contents disclosed in the above embodiments, and no further description will be given here.

[0094] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0095] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0096] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0097] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0098] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of ​​the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for storing pipeline operation status, characterized in that: Applied to the backend, including: After the Jenkins pipeline starts executing, the metadata corresponding to the Jenkins pipeline is stored in the cache queue, and the target application programming interface built in Jenkins is called to query the corresponding pipeline real-time running status and node real-time running status based on the metadata in the cache queue, and the corresponding query results are returned; Synchronize the real-time running status of the node and the real-time running status of the pipeline to the front end so as to display the real-time running status of the node and the real-time running status of the pipeline on the front end page; According to the query result, the real-time running status of the pipeline and the real-time running status of the node are updated to the Redis database, and the real-time running status of the pipeline is judged to obtain the corresponding judgment result; According to the judgment result, the running data in the Redis database is updated accordingly, the updated Redis database is obtained, and the running data in the updated Redis database is synchronized to the relational database based on the preset time to complete the storage of the running status of the Jenkins pipeline.

2. The method for storing the pipeline operation status according to claim 1, characterized in that: The method stores the metadata corresponding to the Jenkins pipeline through a cache queue, and calls a target application programming interface built in Jenkins to query the corresponding pipeline real-time running status and node real-time running status based on the metadata in the cache queue, including: The metadata corresponding to the Jenkins pipeline is stored in the cache queue, and the metadata of the running Jenkins pipeline is read from the cache queue in a regular loop; The target application programming interface built into Jenkins is called according to the pipeline ID and the running node ID in the metadata to query the real-time running status of the pipeline and the real-time running status of the node.

3. The method for storing the pipeline operation status according to claim 1, characterized in that: After calling the target application programming interface built in Jenkins to query the corresponding pipeline real-time running status and node real-time running status based on the metadata in the cache queue, it also includes: If data anomalies occur in the real-time running status of the pipeline and the real-time running status of the node during the running status query process, the operation is directly stopped and the next query is waited for.

4. The method for storing the pipeline operation status according to claim 1, characterized in that: The updating of the operation data in the Redis database according to the judgment result includes: If the real-time running status of the pipeline is the running end status, the Jenkins pipeline is removed from the cache queue, and the query result is parsed. The running data in the Redis database is updated accordingly according to the corresponding parsing result, and the real-time running status of the pipeline and the real-time running status of the node corresponding to the Jenkins pipeline in the relational database are updated based on the parsing result.

5. The method for storing the pipeline operation status according to claim 1, characterized in that: The updating of the operation data in the Redis database according to the judgment result includes: If the real-time running status of the pipeline is in the running state, the query result is parsed, and the running data in the Redis database is updated accordingly according to the corresponding parsing result.

6. The method for storing the pipeline operation status according to claim 1, characterized in that: Also includes: If the current page of the front end has an initialization operation or a change operation, the front end calls the pipeline-status interface to query the real-time running status of the node and the real-time running status of the pipeline of the target Jenkins pipeline that meets the preset conditions, so that the current page is rendered based on the real-time running status of the node and the real-time running status of the pipeline of the target Jenkins pipeline; After the page rendering is completed, the Jenkins pipeline that is running on the current page is obtained through the front-end at a regular interval, and the pipeline-running interface is called to obtain the running status data of the running Jenkins pipeline, and it is determined whether the running status data is consistent with the page data corresponding to the current page; If they are inconsistent, it is determined that there is a Jenkins pipeline started from other pages, and the page data corresponding to the current page is synchronized with the running status data through the front end, and the pipeline-status interface is called to query the real-time running status of the node and the real-time running status of the Jenkins pipeline corresponding to the current page, and the page data is refreshed using the queried data; If they are consistent, the page data is refreshed based on the running status data through the front end.

7. The method for storing the pipeline operation status according to any one of claims 1 to 6, characterized in that: Also includes: During the execution of the Jenkins pipeline, if a retry or termination operation occurs, querying the metadata in the cache queue; Based on the metadata, query the target information of the retry node from the Redis database, and call the target Jenkins plug-in interface according to the target information to query the running status data corresponding to the retry node; The Redis database and the relational database are updated based on the operating status data.

8. A pipeline operation status storage device, characterized in that: Applied to the backend, including: The running status query module is used to store the metadata corresponding to the Jenkins pipeline through the cache queue after the Jenkins pipeline starts to execute, call the target application programming interface built in Jenkins to query the corresponding pipeline real-time running status and node real-time running status based on the metadata in the cache queue, and return the corresponding query results; An operation status synchronization module is used to synchronize the real-time operation status of the node and the real-time operation status of the pipeline to the front end, so as to display the real-time operation status of the node and the real-time operation status of the pipeline on the front end page; An operation status judgment module is used to update the real-time operation status of the pipeline and the real-time operation status of the node to the Redis database according to the query result, and judge the real-time operation status of the pipeline to obtain a corresponding judgment result; The operation status storage module is used to update the operation data in the Redis database accordingly according to the judgment result, obtain the updated Redis database, and synchronize the operation data in the updated Redis database to the relational database based on the preset time to complete the storage of the operation status of the Jenkins pipeline.

9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the steps of the pipeline operation status storage method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: Used to store computer programs; wherein, when the computer program is executed by a processor, the steps of the pipeline operation status storage method as described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Attendance data processing method and device, server and storage medium

    CN113034715A

  • Method for improving assembly line node state synchronization speed

    CN114217928A

  • Method for maintaining running state of DevOps platform assembly line based on Jenkins

    CN114217965A

  • Method, system and device for synchronizing running state of Jenkins assembly line

    CN115630109A

Cited By

  • Query request processing method and device, electronic equipment, medium and program product

    CN120631941A