Detailed Description
Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings in conjunction with the embodiments.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.
In order to facilitate understanding of the technical solutions provided by the present invention, the following related terms are explained.
Simple release: simple publishing would close all services before publishing, stop user access, and then upgrade all services at once. This release strategy is less frequent, since all services are shut down each time a simple release is made, and sufficient testing must be done before release. Simple distribution is not suitable for internet companies because the time interval between two releases is too long, the time from the functional feature proposition to market entry is too long, the response to the market is not sensitive, and the product may be in the wind in a fully competitive market. Each release will also incur economic losses because of the shutdown.
The simple release has the advantages that: because each release is for all services, the release process is simple enough without considering the compatibility of the old and new versions.
Its disadvantages include: in the release process, the service is unavailable; only during low traffic periods, such as nighttime; once a service has a leak, all services need to be rolled back, which is high in cost.
And the back end forwards the release strategy to a corresponding release Handler according to the routing control when executing the release strategy, the simple release Handler encapsulates the strategy service logic, all release applications are traversed, each release application calls a single-service release Handler encapsulated at the bottom layer, and the release is carried out circularly.
Releasing canaries: the release strategy aims to reduce the release risk, and a small part of new versions are tested by using real user traffic to ensure that the software does not have serious problems. In practice, a small percentage of machines, for example 10% of all servers, are released for traffic verification, and then feedback is quickly obtained, and whether to continue releasing or rollback is determined according to the feedback result.
Canaries release the advantages that: in the whole release process, if problems occur, only a few users are affected; the release is safer, and the risk can be reduced.
Its existing disadvantages include: when the release proportion is small, some problems are not easy to expose, and new problems may occur when the flow reaches a certain level.
And the back end forwards the release strategy to a corresponding release Handler according to the routing control when executing the release strategy, the canary release Handler encapsulates the strategy service logic, traverses all release groups and releases all applications in the groups according to the release sequence, and each release application calls the single-service release Handler encapsulated at the bottom layer and circularly releases the single-service release Handler. And after the execution of the single release group is finished, verifying whether the released version is normal or not, and judging whether the release needs to be expanded or not according to user feedback. And if the feedback is in a problem, directly rolling back, and if the feedback is normal, issuing the next issuing group.
In the embodiment of the invention, the simple publishing strategy and the golden sparrow publishing strategy are integrated into the system, and the publishing idea is effectively applied to meet the publishing requirements of each project group, so that the publishing efficiency and quality are ensured, and the loss caused by publishing is reduced. More issuing strategies, such as blue-green issuing and the like, can be expanded subsequently.
The method embodiments provided in the embodiments of the present application may be executed in a mobile terminal, a computer terminal, or a similar computing device. Taking the operation on the mobile terminal as an example, fig. 1 is a hardware structure block diagram of the mobile terminal of the operation continuous delivery implementation method according to the embodiment of the present invention. As shown in fig. 1, the mobile terminal may include one or more processors 102 (only one is shown in fig. 1), the processor 102 may include, but is not limited to, a Processing device such as a Microprocessor (MCU) or a Programmable logic device (FPGA), and amemory 104 for storing data, wherein the mobile terminal may further include atransmission device 106 for communication function and an input/output device 108. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration, and does not limit the structure of the mobile terminal. For example, the mobile terminal may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
Thememory 104 may be used to store computer programs, for example, software programs and modules of application software, such as computer programs corresponding to the sustained delivery implementation method in the embodiment of the present invention, and the processor 102 executes various functional applications and data processing by running the computer programs stored in thememory 104, so as to implement the method described above. Thememory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, thememory 104 may further include memory located remotely from the processor 102, which may be connected to the mobile terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
Thetransmission device 106 is used for receiving or transmitting data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the mobile terminal. In one example, thetransmission device 106 includes a Network adapter (NIC), which can be connected to other Network devices through a base station so as to communicate with the internet. In one example, thetransmission device 106 may be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
Fig. 2 is a diagram of a network architecture of a Master-Agent (Master-Agent) according to an embodiment of the present invention, and an embodiment of the present invention may operate on the network architecture shown in fig. 2, as shown in fig. 2, the network architecture includes: master node (Master), Agent node (Agent) and registry (Consul).
The Agent integrates Spring boot and Google remote procedure call (gPC) frameworks for node service highly customized and developed, needs to be installed on a target execution machine, and can be automatically registered on a designated Consul when the service is started.
Consul can monitor the health state of all registered Agent services, and a service treatment effect is achieved.
The Master is a highly custom-developed Master node service, integrates Spring boot and gPC frameworks, can request Consul to acquire all registered Agent instances through an Application Programming Interface (API), and communicates with the agents through an RPC protocol.
In the embodiment, Consul is used as a service of the registration center, the service of Agent is managed, Master and Agent are decoupled, high cohesion and low coupling are achieved, and the maintainability and the expansibility of the system are improved. The bottom layer of the integrated gPC framework is communicated based on an RPC mode, so that the transmission efficiency and the overall performance of the system are improved.
The Agent in the embodiment supports virtual machine/physical machine deployment and is compatible with Windows and Linux operating systems. With the development of container cloud, the support of such deployment mode is less and less, and the Master-Agent in the invention just makes up the gap, so that the 'original' deployment mode is also added into the DevOps ring.
Fig. 3 is a flowchart of a sustained delivery implementation method according to an embodiment of the present invention, and as shown in fig. 3, the flowchart includes the following steps:
step S302, the main node acquires the registered example of the agent node from the registration center and sends a configuration instruction to the agent node;
step S304, the agent node performs the issuing configuration of the application according to the configuration instruction;
and S306, after the application issuing application is approved, issuing the application through the agent node.
Before step S302 in this embodiment, the method further includes: registering the agent node to the registration center, and monitoring the health state of the agent node by the registration center.
In an exemplary embodiment, the method may further include: the release configuration of the application comprises at least the following fields: a release name, a release path, a start script, and a stop script.
In step S304 of this embodiment, the method may further include: and selecting to configure a simple publishing strategy on the agent nodes or configure a canary publishing strategy on the publishing group, wherein a plurality of agent nodes form the publishing group.
In step S304 of this embodiment, the method may further include: and after receiving the configuration instruction, the proxy node executes a corresponding method of internal encapsulation according to the type of the operating system so as to issue and configure the application.
Before step S306 of this embodiment, the method may further include: submitting an application release application form to a first examination and approval; carrying out final approval after the initial approval is passed, and releasing the application after the final approval is passed; and rejecting the application to issue the application request form when the initial examination and approval or the final examination and approval is not passed.
In an exemplary embodiment, the method may further include: the method executed by the proxy node at least comprises one of the following steps: file operation, system monitoring and command processing.
Through the steps, the release application, the agent instance and the approval process are linked, so that the change and audit time is reduced, the release process is more standardized, and the release risk is also reduced; supporting various issuing strategies such as simple issuing and gold sparrow issuing, a team can select an appropriate issuing strategy according to the characteristics of the system of the team; the data in the release process is collected and analyzed, the release report is generated, and the team can deduce the optimal release frequency according to the monthly release report. Therefore, the problems that the software delivery and release platform is complex in configuration and lacks of an approval process in the related technology can be solved, and the release quality and efficiency are improved.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., a Read-Only Memory/Random Access Memory (ROM/RAM), a magnetic disk, an optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
In this embodiment, a continuous delivery implementation apparatus is further provided, and the apparatus is used to implement the foregoing embodiments and preferred embodiments, and the description of the apparatus is omitted for brevity. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 4 is a block diagram showing the structure of a sustained delivery implementation apparatus according to an embodiment of the present invention, and as shown in fig. 4, the apparatus includes amaster node 10, abroker node 20, and adistribution module 30
Amaster node 10, configured to obtain an instance of a registered proxy node from a registry, and send a configuration instruction to the proxy node;
theagent node 20 is used for issuing and configuring the application according to the configuration instruction;
and theissuing module 30 is configured to issue the application through the proxy node after the application issuing application is approved.
Fig. 5 is a block diagram of a continuous delivery implementation apparatus according to an embodiment of the present invention, and as shown in fig. 5, the apparatus includes aregistration center 40 in addition to all modules shown in fig. 4, and the issuing module includes a configuration unit 31.
Aregistry 40 for monitoring the health status of agent nodes registered with the registry.
The configuration unit 31 is configured to select to configure a simple release policy on the agent node or configure a canary release policy on the release group, where a plurality of agent nodes form the release group.
It should be noted that, the above modules may be implemented by software or hardware, and for the latter, the following may be implemented, but not limited to: the modules are all positioned in the same processor; alternatively, the modules are respectively located in different processors in any combination.
To facilitate understanding of the technical solution provided by the present invention, the integrated gRPC framework is briefly described.
The gRPC is a modern open source high performance RPC framework based on go language for google open source, and can run in any environment. It can efficiently connect services within and across data centers and provide pluggable support to achieve load balancing, tracking, health checking and identity verification. In a gRPC, a client application can invoke methods directly on a server application on another computer as if it were a local object, thereby enabling easier creation of distributed applications and services.
The RPC call is generally divided into four modes, namely one-way RPC, server-side streaming RPC, client-side streaming RPC and two-way streaming PRC, according to whether two ends interact in a streaming manner or not. In the invention, a one-way RPC mode is adopted for interaction, namely, a client sends a request to a server and obtains a response from the server, which is similar to a local function call.
In the embodiment of the invention, the integrated gPC framework is adopted, and the one-way RPC mode is adopted for interaction, so that the Master service and the Agent service can communicate more conveniently.
In addition, in actual use, due to the particularity of the execution machine, a user can require different languages to realize the agents so as to ensure normal operation on the execution machine, and the gRPC is adopted, uses Protocol Buffers to define services, automatically generates familiar client and server stubs for the services of various languages and platforms, can realize cross-language communication, and solves the requirements of the user.
In this embodiment, a Jenkins open source task management framework is not adopted, but a highly custom developed Agent is adopted, and fig. 6 is a schematic diagram of a custom Agent according to an embodiment of the present invention, and a Master-Agent mode is implemented to replace a slave node of Jenkins. The agents of the embodiment are uniformly managed by Consul, and the agents are intelligently managed, so that not only can registered Agent instances be automatically discovered, but also health states of the agents can be monitored.
The Agent is a node service realized based on the integration of a spring boot and a gPC framework, serves as a gPC server, and is compatible with Windows and Linux operating systems. As shown in fig. 6, a series of methods are encapsulated inside the Agent, which mainly include file operation, system monitoring, command processing (e.g., Windows command and Linux command), etc., and when an Agent is requested, the Agent automatically executes a corresponding method according to the type of the operating system, thereby improving the availability and portability of the Agent and enabling a user to use the Agent without considering the operating system.
In the embodiment, when a user starts the Agent at the execution machine, the Agent can be automatically registered in the specified Consul registration center, and the Consul is responsible for managing all Agent instances and monitoring the health state of the Agent instances, so that the manual maintenance of the Agent information is omitted, and the maintenance cost and the error rate are reduced.
In the embodiment, in order to effectively control the Agent use permission and avoid the phenomenon of cross and wrong use of the agents in the use process of the project team, the authorized strategy is adopted, the project team can only use the authorized agents, the unauthorized agents cannot use the project team, the management flow is more standard, the publishing efficiency is improved, and the error rate is reduced.
Fig. 7 is a schematic diagram of a custom Master according to an embodiment of the present invention, in this embodiment, the Master is a Master node service that is implemented based on the integration of a spring boot and a gRPC framework, and serves as a gRPC client to actively send a request to an Agent node to complete service processing.
In this embodiment, simple publishing and golden sparrow publishing are supported, and in order to facilitate adding a new publishing mode and subsequent maintenance, the Master adopts a policy mode during the design of a backend architecture, which aims to decouple the use and definition of an algorithm, and can implement routing to different policy classes for processing according to rules, so as to implement high-cohesion low-coupling, so that a scenario in which different service logics are executed according to different parameter combinations can be solved through the policy mode, such as the routing part of fig. 7.
And during back-end design, each release strategy corresponds to one release plug-in, if a new release strategy exists, only one plug-in class needs to be redefined and realized, and finally the plug-in is registered in a plug-in queue of the route. In order to optimize the bottom-layer execution release, in this embodiment, a bottom-layer Handler is defined, which is dedicated to processing the deployment work of a single Agent node, and each release plug-in unit will complete the execution logic of different release policies based on the Handler.
Based on the architecture design, the following benefits can be brought:
1. the labor cost of subsequent iteration is reduced;
2. the maintainability of the code is improved, the code structure is clearer, each issuing strategy is isolated, the error rate can be reduced when a new issuing strategy is added subsequently, and the influence on the completed strategy is reduced;
3. if the problem occurs, the problem is more conveniently positioned, and the vulnerability can be rapidly solved;
4. high cohesion and low coupling are really realized, business logic is clearer, and the expansibility of the system is improved.
Fig. 8 is a flowchart of a release approval method according to an embodiment of the present invention, as shown in fig. 8, the method includes the following steps:
step S801, filling out an application form.
Specifically, the project team fills out the release application form.
And step S802, submitting for approval.
And step S803, the primary reviewer approves.
Specifically, after the project team submits the approval, the approval process is triggered, and the corresponding node approver is informed to process the approval; firstly, a primary examiner carries out examination and approval, if the examination and approval is rejected, the application form is re-filled, and if the examination and approval is approved, the examination and approval continues;
and step S804, the final auditor approves.
Specifically, the final reviewer performs approval, and if approval is rejected, the application form is re-filled, and if approval is approved, the approval is continued.
In step S805, the distribution is performed.
Specifically, the release application form is finally approved and issued, and the project team can release the release application form, wherein the release application form can be automatically issued after the approval is passed.
In the embodiment, a two-stage approval process is used, which aims to standardize the release process, improve the release success rate and quality, avoid frequent and random release of a project team in a production environment, and effectively reduce the loss of enterprises caused by release failure or release wrong versions.
In this embodiment, the publishing application configuration associates the publishing application with the defined publishing policy and also associates the product library and the product information. The configuration of the release application basically needs only one time of configuration, so that the effects of one-time configuration and multiple use are achieved, and the maintenance cost of the application for a user is reduced.
In this embodiment, when configuring the publishing application, the user can only select an authorized publisher (Agent), and can perform detailed configuration on the publisher, and the main configuration fields include a publishing name, a publishing path, a start script, and a stop script. After the configuration of the issuing machine is completed, the user can walk the issuing process and execute simple issuing.
In this embodiment, the configuration of the issue group is mainly designed for realizing a canary issue strategy, and by setting an issue order for the issue group and then executing canary issue, canaries are issued in sequence according to the issue order, so that a canary issue effect is achieved. And the user can independently start, stop and view logs and other operations on a certain execution machine.
In this embodiment, a metric analysis tool is combined, and based on objective data collected during the operation of the distribution center, the past distribution situation can be analyzed, and the monthly distribution failure success frequency situation is analyzed from the organization level, so as to infer the optimal distribution frequency.
Embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program is arranged to perform the steps of any of the above-mentioned method embodiments when executed.
In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to: various media capable of storing computer programs, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Embodiments of the present invention also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the above method embodiments.
In an exemplary embodiment, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary embodiments, and details of this embodiment are not repeated herein.
It will be apparent to those skilled in the art that the various modules or steps of the invention described above may be implemented using a general purpose computing device, they may be centralized on a single computing device or distributed across a network of computing devices, and they may be implemented using program code executable by the computing devices, such that they may be stored in a memory device and executed by the computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into various integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the principle of the present invention should be included in the protection scope of the present invention.