Disclosure of Invention
The embodiment of the application provides a method, a system, computer equipment and a storage medium for pipeline deployment of images, so as to at least solve the problem in the related art that how to ensure that the producer of the images deployed by a cloud computing platform is a pipeline.
In a first aspect, an embodiment of the present application provides a method for pipeline deployment mirroring, where the method includes:
the method comprises the steps that an interceptor obtains first mirror image layer information sent by a production line, wherein the production line generates the first mirror image layer information according to a mirror image uploaded to a container mirror image warehouse;
the interceptor intercepts a request instruction of a cloud computing platform for requesting the container mirror image warehouse to acquire a mirror image;
the interceptor acquires second mirror image layer information corresponding to the request instruction from the container mirror image warehouse;
the interceptor compares the first mirror layer information with the second mirror layer information:
and under the condition that the first mirror image layer information is the same as the second mirror image layer information, the cloud computing platform starts to pull the mirror image for installation and deployment, and under the condition that the first mirror image layer information is different from the second mirror image layer information, the interceptor feeds back mirror image acquisition failure information to the cloud computing platform.
In some embodiments, the pipeline generating the first mirror layer information from the mirror uploaded to the container mirror store comprises: the assembly line comprises a Jenkins assembly line, codes are compiled by the Jenkins assembly line, Docker mirror images are constructed, the Docker mirror images are packaged and pushed to the container mirror image warehouse, and the first mirror image layer information is generated.
In some embodiments, the first mirror layer information and the second mirror layer information each include a mirror layer list recording base information of each layer of the mirror and a digest encrypted by sha 256.
In a second aspect, an embodiment of the present application provides a system for pipeline deployment mirroring, where the system includes a pipeline, an interceptor, and a container mirroring warehouse;
the method comprises the steps that an interceptor obtains first mirror image layer information sent by a production line, wherein the production line generates the first mirror image layer information according to a mirror image uploaded to a container mirror image warehouse;
the interceptor intercepts a request instruction of a cloud computing platform for requesting the container mirror image warehouse to acquire a mirror image;
the interceptor acquires second mirror image layer information corresponding to the request instruction from the container mirror image warehouse;
the interceptor compares the first mirror layer information with the second mirror layer information:
and under the condition that the first mirror image layer information is the same as the second mirror image layer information, the cloud computing platform starts to pull the mirror image for installation and deployment, and under the condition that the first mirror image layer information is different from the second mirror image layer information, the interceptor feeds back mirror image acquisition failure information to the cloud computing platform.
In some embodiments, the pipeline generating the first mirror layer information from the mirror uploaded to the container mirror store comprises: the assembly line comprises a Jenkins assembly line, codes are compiled by the Jenkins assembly line, Docker mirror images are constructed, the Docker mirror images are packaged and pushed to the container mirror image warehouse, and the first mirror image layer information is generated.
In some embodiments, the first mirror layer information and the second mirror layer information obtained by the interceptor each include a mirror layer list, and the mirror layer list records base information of each layer of the mirror and a digest encrypted by sha 256.
In a third aspect, an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor executes the computer program to implement the method for pipeline deployment mirroring as described in the first aspect.
In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the method for pipeline deployment mirroring as described in the first aspect above.
Compared with the related art, the method, the system, the computer equipment and the storage medium for deploying the mirror images in the production line provided by the embodiment of the application acquire the first mirror image layer information sent by the production line through the interceptor, wherein the production line generates the first mirror image layer information according to the mirror images uploaded to the container mirror image warehouse; the interceptor intercepts a request instruction of the cloud computing platform for requesting the container mirror image warehouse to acquire a mirror image, acquires second mirror image layer information corresponding to the request instruction from the container mirror image warehouse, compares the first mirror image layer information with the second mirror image layer information, and starts to pull the mirror image for installation and deployment under the condition that the first mirror image layer information is the same as the second mirror image layer information.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments provided in the present application without any inventive step are within the scope of protection of the present application.
It is obvious that the drawings in the following description are only examples or embodiments of the present application, and that it is also possible for a person skilled in the art to apply the present application to other similar contexts on the basis of these drawings without inventive effort. Moreover, it should be appreciated that in the development of any such actual implementation, as in any engineering or design project, numerous implementation-specific decisions must be made to achieve the developers' specific goals, such as compliance with system-related and business-related constraints, which may vary from one implementation to another.
Reference in the specification to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the specification. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of ordinary skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments without conflict.
Unless defined otherwise, technical or scientific terms referred to herein shall have the ordinary meaning as understood by those of ordinary skill in the art to which this application belongs. Reference to "a," "an," "the," and similar words throughout this application are not to be construed as limiting in number, and may refer to the singular or the plural. The present application is directed to the use of the terms "including," "comprising," "having," and any variations thereof, which are intended to cover non-exclusive inclusions; for example, a process, method, system, article, or apparatus that comprises a list of steps or modules (elements) is not limited to the listed steps or elements, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus. Reference to "connected," "coupled," and the like in this application is not intended to be limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The term "plurality" as referred to herein means two or more. "and/or" describes an association relationship of associated objects, meaning that three relationships may exist, for example, "A and/or B" may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. Reference herein to the terms "first," "second," "third," and the like, are merely to distinguish similar objects and do not denote a particular ordering for the objects.
The pipeline deployment mirror method provided in the embodiment of the present application may be applied to an application environment of a privatized mirror warehouse as shown in fig. 1, where fig. 1 is a schematic view of an application environment of the pipeline deployment mirror method according to the embodiment of the present application, and as shown in fig. 1, a terminal 11 and a server 12 communicate with each other through a network. A pipeline and an interceptor are deployed in the terminal 11, a cloud computing platform and a container mirror image warehouse are deployed in the server 12, and the interceptor acquires first mirror image layer information sent by the pipeline; the interceptor intercepts a request instruction of requesting the container mirror image warehouse to acquire a mirror image from the cloud computing platform; the interceptor acquires second mirror image layer information corresponding to the request instruction from the container mirror image warehouse; the interceptor compares the first mirror layer information with the second mirror layer information; under the condition that the first mirror image layer information is the same as the second mirror image layer information, the cloud computing platform starts to pull the mirror image for installation and deployment, and under the condition that the first mirror image layer information is different from the second mirror image layer information, the interceptor feeds back mirror image acquisition failure information to the cloud computing platform; the terminal 11 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices, and the server 12 may be implemented by an independent server or a server cluster composed of a plurality of servers.
In the related art, fig. 2 is a schematic diagram of an operation timing sequence according to a mirror image deployment method in the related art, as shown in fig. 2, a user compiles a code to generate a mirror image and uploads the mirror image to a container mirror image warehouse, and a cloud computing platform sends an instruction to the container mirror image warehouse to request to acquire the mirror image in the container mirror image warehouse. The cloud computing platform pulls the mirror image in the container mirror image warehouse for deployment and release;
because the user, the container mirror image warehouse and the cloud computing platform are directly communicated, as shown in the operation steps shown in fig. 2, the user uploads the compiled mirror image to the container mirror image warehouse, the cloud computing platform can directly pull the mirror image through the container mirror image warehouse for deployment and release, and the production and deployment of the mirror image are not screened at all, so that the mirror image producer for deployment and release of the cloud computing platform cannot be ensured to be a corresponding production line.
An embodiment of the present application provides a pipeline deployment mirroring system, where the system is configured to implement the foregoing embodiment, fig. 3 is a block diagram of a structure of the pipeline deployment mirroring system according to the embodiment of the present application, and as shown in fig. 3, the system includes a pipeline 31, a container mirror warehouse 32, an interceptor 33, and a cloud computing platform 34;
the interceptor 33 obtains first mirror layer information sent by the pipeline 31, wherein the pipeline 31 generates the first mirror layer information according to the mirror image uploaded to the container mirror repository 32;
the interceptor 33 intercepts a request instruction of the cloud computing platform 34 requesting the container mirror repository 32 to acquire a mirror;
the interceptor 33 acquires the second mirror layer information corresponding to the request instruction from the container mirror repository 32;
the interceptor 33 compares the first mirror layer information with the second mirror layer information:
under the condition that the first mirror layer information and the second mirror layer information are the same, the cloud computing platform 34 starts to pull the mirror for installation and deployment, and under the condition that the first mirror layer information and the second mirror layer information are different, the interceptor 33 feeds back mirror acquisition failure information to the cloud computing platform 34.
In some of these embodiments, the pipeline 31 generating the first mirror layer information from the mirror uploaded to the container mirror store 32 includes: the assembly line comprises a Jenkins assembly line, codes are compiled by the Jenkins assembly line, Docker images are built, the Docker images are packaged and pushed to the container image warehouse 32, and first image layer information is generated.
In some embodiments, the first mirror layer information and the second mirror layer information obtained by the interceptor 33 each include a mirror layer list, and the mirror layer list records the basic information of each layer of the mirror and the digest encrypted by the sha 256.
In the system in this embodiment of the application, the interceptor 33 acquires the first mirror layer information sent by the pipeline 31, the interceptor 33 intercepts a request instruction that the cloud computing platform 34 requests the container mirror repository 32 to acquire a mirror, acquires the second mirror layer information corresponding to the request instruction from the container mirror repository 32, and compares the first mirror layer information and the second mirror layer information, thereby ensuring that a mirror producer deployed by the cloud computing platform 34 is the corresponding pipeline 31.
An embodiment of the present application provides a pipeline deployment mirroring method, fig. 4 is an operation timing diagram of a pipeline 31 deployment mirroring method according to an embodiment of the present application, and as shown in fig. 4, the method may be divided into two stages, namely a production stage and a deployment issue stage;
the production stage comprises: the pipeline 31 compiles codes to generate a packaged mirror image, uploads the packaged mirror image to the container mirror image warehouse 32, generates first mirror image layer information according to the mirror image uploaded to the container mirror image warehouse 32, and sends the first mirror image layer information to the interceptor 33;
a deployment and release stage: the interceptor 33 intercepts a request instruction of the cloud computing platform 34 requesting the container mirror repository 32 to acquire a mirror image, acquires second mirror image layer information corresponding to the request instruction from the container mirror repository 32, compares the first mirror image layer information with the second mirror image layer information, the cloud computing platform 34 starts to pull the mirror image for installation and deployment under the condition that the first mirror image layer information is the same as the second mirror image layer information, and the interceptor 33 feeds back mirror image acquisition failure information to the cloud computing platform 34 under the condition that the first mirror image layer information is different from the second mirror image layer information.
The first mirror layer information sent by the pipeline 31 is acquired through the interceptor 33, the interceptor 33 intercepts a request instruction of the cloud computing platform 34 for requesting the container mirror warehouse 32 to acquire a mirror, the second mirror layer information corresponding to the request instruction is acquired from the container mirror warehouse 32, and the first mirror layer information and the second mirror layer information are compared, so that the mirror producer deployed by the cloud computing platform 34 is ensured to be the corresponding pipeline 31.
Preferably, the generating of the first mirror layer information by the pipeline 31 according to the mirror uploaded to the container mirror store 32 includes: the assembly line comprises a Jenkins assembly line, codes are compiled by the Jenkins assembly line, Docker images are built, the Docker images are packaged and pushed to the container image warehouse 32, and first image layer information is generated.
Preferably, the first mirror layer information and the second mirror layer information each include a mirror layer list recording base information of each layer of the mirror and a digest encrypted by sha 256.
By describing and explaining the embodiments of the present application in conjunction with specific applications, fig. 5 is a flowchart illustrating steps of a method for deploying mirroring in a pipeline 31 according to an embodiment of the present application, and as shown in fig. 5, the embodiment includes the following steps:
s502, compiling the pipeline 31(Jenkins pipeline) to construct a mirror image;
s504, the pipeline 31(Jenkins pipeline) pushes the mirror image to the container mirror image warehouse 32;
s506, the pipeline 31(Jenkins pipeline) sends the mirrored layer list (recording the basic information of each layer of the mirror and the digest encrypted by the sha 256) of the mirror to the interceptor 33;
s508, the interceptor 33 intercepts a request instruction of the cloud computing platform 34 for requesting the container mirror image warehouse 32 to acquire a mirror image;
s510, the interceptor 33 acquires a mirror layer list (recording the basic information of each layer of the mirror and the digest encrypted by sha 256) corresponding to the request instruction from the container mirror repository 32;
s512, the interceptor 33 compares the mirror layer list of the pipeline 31 with the mirror layer list of the container mirror warehouse 32;
s514, if the comparison is successful, the cloud computing platform 34 starts to pull the mirror image for installation and deployment;
s516, if the comparison fails, the interceptor 33 feeds back the mirror image acquisition failure information to the cloud computing platform 34.
In the preferred embodiment, through steps S502 to S516, the problem that the mirror image deployed by the cloud computing platform 34 cannot ensure that the producer is the pipeline 31 is solved, and the mirror image deployed by the cloud computing platform 34 is ensured that the producer is the corresponding pipeline 31.
It should be noted that the steps illustrated in the above-described flow diagrams or in the flow diagrams of the figures may be performed in a computer system, such as a set of computer-executable instructions, and that, although a logical order is illustrated in the flow diagrams, in some cases, the steps illustrated or described may be performed in an order different than here.
In an embodiment, fig. 6 is a schematic internal structure diagram of an electronic device according to an embodiment of the present application, and as shown in fig. 6, there is provided an electronic device, which may be a server, and its internal structure diagram may be as shown in fig. 6. The electronic device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the electronic device is configured to provide computing and control capabilities. The memory of the electronic equipment comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the electronic device is used for storing data. The network interface of the electronic device is used for connecting and communicating with an external terminal through a network. The computer program when executed by a processor implements a method of pipeline deployment mirroring.
Those skilled in the art will appreciate that the configuration shown in fig. 6 is a block diagram of only a portion of the configuration associated with the present application, and does not constitute a limitation on the electronic device to which the present application is applied, and a particular electronic device may include more or less components than those shown in the drawings, or may combine certain components, or have a different arrangement of components.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
It should be understood by those skilled in the art that various features of the above-described embodiments can be combined in any combination, and for the sake of brevity, all possible combinations of features in the above-described embodiments are not described in detail, but rather, all combinations of features which are not inconsistent with each other should be construed as being within the scope of the present disclosure.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.