Mirror image construction method and device based on Jenkins

By using Kubernetes cluster capabilities in Jenkins, Pod nodes are automatically created for image construction, which solves the security problems caused by Docker container kernel sharing and data interference problems caused by concurrent construction, and achieves the security and high reliability of image construction.

CN119806723APending Publication Date: 2025-04-11CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411781397.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

In Jenkins, the internal processes of the Docker container run on the same operating system kernel, causing the host security to be affected. In concurrent scenarios, different image constructions will interfere with each other, and the security of image construction cannot be guaranteed.

Method used

By leveraging Jenkins and Kubernetes cluster capabilities, Jenkins image construction tasks are generated and mirrored construction tasks are performed in the Pod nodes that automatically create the basic image in the Kubernetes cluster, thereby achieving security and isolation of mirrored construction.

Benefits of technology

The image construction is completed through the Kubernetes cluster, which enables the image construction to be separated from the Docker stand-alone environment, ensures the security of image construction, avoids data interference in concurrent scenarios, and improves the reliability of image construction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119806723A_ABST
    Figure CN119806723A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and discloses a Jenkins-based mirror image construction method and device, which are applied to a DevOps platform, the Jenkins-based mirror image construction method comprises the following steps: the DevOps platform pulls target construction task data, the target construction task data comprises a task template and a task file, the task template is generated by the DevOps platform, the task file is generated by the DevOps platform, and the target construction task data comprises the task template and the task file; different task templates correspond to construction tasks; generating a mirror image construction task based on the target construction task data; and based on the mirror image construction task, calling a Kubernetes plug-in of Jenkins to construct a basic mirror image Pod node, and generating a target mirror image in the basic mirror image Pod node. According to the invention, the problem of security of mirror image construction can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a Jenkins-based image building method and device. Background Art

[0002] Jenkins is an open source software project. It is a continuous integration tool developed based on Java. It aims to provide an open and easy-to-use software platform to make continuous integration of software possible. After the DevOps platform integrates the Jenkins component, it uses the pipeline function of Jenkins itself to complete the continuous integration and continuous deployment of applications.

[0003] In Jenkins, image building generally requires the help of Docker, which can be isolated through containers. However, since the internal processes of the Docker container are all running on the same operating system kernel, it will affect the security of the host machine. At the same time, in concurrent scenarios, different image builds will interfere with each other's data, and the security of image building cannot be guaranteed. Summary of the invention

[0004] In view of this, the present invention provides a mirror image building method and device based on Jenkins to solve the problem of mirror image building security.

[0005] In the first aspect, the present invention provides a Jenkins-based image building method, which is applied to a DevOps platform. The Jenkins-based image building method includes: the DevOps platform pulls target building task data, the target building task data includes a task template and a task file, the task template is generated by the DevOps platform, and different task templates correspond to building tasks; based on the target building task data, an image building task is generated; based on the image building task, a Kubernetes plug-in of Jenkins is called to build a basic image Pod node, and a target image is generated in the basic image Pod node.

[0006] In this implementation, by leveraging the capabilities of Jenkins and Kubernetes clusters, a Jenkins image build task is generated based on the task file and the base image, and based on the task file input by the user and the image build template provided by the platform. When executing the image build, a Pod of the base image is automatically created in the Kubernetes cluster, and the Jenkins image build task is executed in the Pod to finally complete the image build. This application can complete the image build through the Kubernetes cluster, making the image build out of the Docker stand-alone environment, ensuring the security of the image build, and has important practical value.

[0007] In an optional implementation, the task file includes a package file and a custom Dockerfile file, and before pulling the target build task data, it also includes: the DevOps platform builds or receives the package file from the target user; the DevOps platform receives the custom Dockerfile file from the target user; and stores the package file and the custom Dockerfile file in an object storage unit.

[0008] In an optional implementation, based on the image building task, calling the Kubernetes plug-in of Jenkins to build a base image Pod node, and generating a target image in the base image Pod node includes: configuring a task template on the Kubernetes plug-in of Jenkins, and calling the Kubernetes plug-in of Jenkins to build a base image Pod node based on the Kaniko image, where the task template is a Kaniko image template; and generating a target image in the base image Pod node based on the task file.

[0009] In an optional implementation, based on the image building task, calling the Kubernetes plug-in of Jenkins to build a basic image Pod node, and before generating the target image in the basic image Pod node, it also includes: the DevOps platform deploys the Jenkins service in the Kubernetes cluster, and installs and configures the Kubernetes plug-in and automatic scaling Slave related configurations in Jenkins.

[0010] In an optional implementation, the Jenkins-based image building method further includes: the DevOps platform synchronously stores the target image in a public image repository or a user-purchased image repository.

[0011] In the second aspect, the present invention provides an image building device based on Jenkins, which includes: a pulling module, used to pull target building task data, the target building task data includes a task template and a task file, the task template is generated by a DevOps platform, and different task templates correspond to building tasks; a generation module, used to generate an image building task based on the target building task data; an execution module, used to call the Kubernetes plug-in of Jenkins to build a basic image Pod node based on the image building task, and generate a target image in the basic image Pod node.

[0012] In an optional embodiment, the Jenkins-based image building device also includes: an acquisition module, used to build or receive a package file from a target user, and receive a custom Dockerfile file from a target user; and an image source storage module, used to store the package file and the custom Dockerfile file in an object storage unit.

[0013] In an optional implementation, the generation module is also used to configure the task template on the Kubernetes plug-in of Jenkins, and call the Kubernetes plug-in of Jenkins to build a basic image Pod node based on the Kaniko image, and the task template is the Kaniko image template; based on the task file, the target image is generated in the basic image Pod node.

[0014] In an optional implementation, the device further includes: a deployment module, which is used to deploy the Jenkins service in the Kubernetes cluster, and install and configure the Kubernetes plug-in and automatic scaling Slave related configuration in Jenkins.

[0015] In an optional implementation, the Jenkins-based image building device further includes: an image storage module, which is used to synchronously store the target image in a public image repository or a user-purchased image repository. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0017] Figure 1 is a flow chart of a mirror building method based on Jenkins according to an embodiment of the present invention;

[0018] Figure 2 is a flowchart of another image building method based on Jenkins according to an embodiment of the present invention;

[0019] Figure 3 It is a schematic diagram of calling Jenkins to generate a target image according to an embodiment of the present invention;

[0020] Figure 4 It is a structural block diagram of an image building device based on Jenkins according to an embodiment of the present invention;

[0021] Figure 5It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0022] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are 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 those skilled in the art without creative work are within the scope of protection of the present invention.

[0023] DevOps (a combination of Development and Operations) is a collective term for a set of processes, methods, and systems that facilitate communication, collaboration, and integration between development (application / software engineering), technical operations, and quality assurance (QA) departments.

[0024] Kubernetes cluster deployment can be applied in DevOps platform. In the process of Kubernetes cluster deployment, the user's application needs to be packaged into an image and pushed to the image warehouse before Kubernetes cluster deployment can be performed. DevOps platform usually uses Jenkins for continuous interaction and continuous deployment. In the image building stage of continuous deployment, Docker is usually used to complete the image building. However, due to the shortcomings of Docker system architecture, the image building process affects the security of the host machine and there is interference between multiple images when they are built and released.

[0025] Therefore, this application proposes a Jenkins-based image building method that can break away from the Docker stand-alone building environment, solve the impact of mutual interference during concurrent image building, and improve the security of image building.

[0026] According to an embodiment of the present invention, an embodiment of an image building method based on Jenkins is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0027] In this embodiment, a Jenkins-based image building method is provided, which can be used for the above-mentioned DevOps platform. Figure 1 is a flowchart of a method for building an image based on Jenkins according to an embodiment of the present invention. It should be noted that if there are substantially the same results, this embodiment is not based on Figure 1 The process sequence shown is limited. Figure 1 As shown, the process includes the following steps:

[0028] Step S101, the DevOps platform pulls the target build task data.

[0029] The DevOps platform pulls the target build task data from the object storage unit to identify the current image build task.

[0030] The target construction task data includes task templates and task files.

[0031] Among them, the task template is generated by the DevOps platform, and different task templates correspond to construction tasks.

[0032] The task file includes the data source file for building the image and the personalized Dockerfile file.

[0033] Step S102: Generate an image building task based on the target building task data.

[0034] Generate an image build task based on the task template and task file. The image build task is used to guide Jenkins to perform the corresponding image build task.

[0035] Step S103, based on the image building task, call the Kubernetes plug-in of Jenkins to build a basic image Pod node, and generate a target image in the basic image Pod node.

[0036] Identify the task template in the image building task, call the Kubernetes plug-in of Jenkins to automatically generate the basic image Pod node, pull the data source file and personalized Dockerfile file from the object storage unit, and generate the target image corresponding to the target task in the basic image Pod node.

[0037] It can be understood that when there are multiple image building tasks, the task templates in the multiple image building tasks are identified respectively, the Kubernetes plug-in of Jenkins is called to automatically generate multiple corresponding basic image Pod nodes, the corresponding data source files and personalized Dockerfile files are pulled from the object storage unit, and the target image corresponding to the target task is generated in the corresponding basic image Pod node. Using the above method, multiple image files are generated in multiple Pod nodes.

[0038] The image building method based on Jenkins provided in this embodiment, by leveraging the capabilities of Jenkins and Kubernetes clusters, generates a Jenkins image building task based on the task file and the basic image, and based on the task file input by the user and the image building template provided by the platform. When executing the image building, a Pod of the basic image is automatically created in the Kubernetes cluster, and the Jenkins image building task is executed in the Pod to finally complete the image building. This application can complete the image building through the Kubernetes cluster, so that the image building is separated from the Docker stand-alone environment, and the image building security is guaranteed, which has important practical value.

[0039] In this embodiment, a Jenkins-based image building method is provided, which can be used for the above-mentioned DevOps platform. Figure 2 is a flowchart of another image building method based on Jenkins according to an embodiment of the present invention. It should be noted that if there are substantially the same results, this embodiment is not based on Figure 2 The process sequence shown is limited. Figure 2 As shown, the process includes the following steps:

[0040] Step S201: store the program package file and the custom Dockerfile file in an object storage unit.

[0041] The DevOps platform obtains the package files that serve as the image building source and the customized Dockerfile files that meet the user's personalized needs and stores them in the object storage unit.

[0042] Among them, Dockerfile is a text file that contains a series of instructions for building an image. The instructions of Dockerfile follow a specific format, and each instruction creates a new layer in the image building process. The Dockerfile file specifies information such as the base image, environment variables, working directory, dependency installation commands, port exposure, etc.

[0043] Specifically, in one implementation, the DevOps platform obtains the source data of the image building by uploading the program package file package by the user. In another implementation, the DevOps platform obtains the source data of the image building by building the program package file package.

[0044] Specifically, the DevOps platform provides a custom Dockerfile entry to the user, and obtains the user's custom Dockerfile file from the custom Dockerfile entry to meet the user's personalized needs.

[0045] Store the package files and custom Dockerfile files separately in object storage units.

[0046] Among them, the source of the image source is flexible and reliable, supports user uploading or generating from source code through the platform, supports object storage and storage, and ensures the security of the image source.

[0047] Step S202, pulling target construction task data.

[0048] Pull the target task template, package file, and custom Dockerfile file from the object storage unit.

[0049] Among them, the task template is generated by the DevOps platform, and different task templates correspond to construction tasks.

[0050] The target task template is to configure the Kubernetes Pod template for Jenkins. These templates define how Jenkins creates slave Pods for executing tasks. You can specify the required container image, resource requests (CPU, memory), volume mounts, etc.

[0051] Step S203: Generate an image building task based on the target building task data.

[0052] Combine the target task template, package file and custom Dockerfile file to generate an image build task. The image build task is used to instruct Jenkins to generate the corresponding image file.

[0053] Step S204, based on the image building task, call the Kubernetes plug-in of Jenkins to build a basic image Pod node, and generate a target image in the basic image Pod node.

[0054] See also Figure 3 , Figure 3 1 is a schematic diagram of calling Jenkins to generate a target image according to an embodiment of the present invention. Figure 3 As shown in the figure, Jenkins uses Kubernetes cluster management and scheduling tasks to achieve automated deployment and continuous integration / continuous deployment (CI / CD) processes.

[0055] Figure 3 In the figure, Jenkins is on the left and the Kubernetes cluster is on the right. Figure 3 Implement the interaction process between Jenkins and Kubernetes clusters.

[0056] Specifically, Jenkins sends a request to the Kubernetes cluster by calling an API (API Call). After receiving the request, the Kubernetes cluster starts multiple Pod nodes (three Pod nodes are shown in the figure). The Kubernetes cluster communicates with Jenkins through the JNLP (Jenkins Node Launcher Protocol) protocol to execute the corresponding tasks.

[0057] Specifically, the above step S204 includes:

[0058] Step S2041, the DevOps platform deploys the Jenkins service in the Kubernetes cluster, and installs and configures the Kubernetes plug-in and automatic scaling Slave related configuration in Jenkins.

[0059] like Figure 3 As shown in the figure, deploy the Jenkins service on the Kubernetes cluster, install the Kubernetes plug-in in Jenkins, and implement real-time scaling of Jenkins Slave nodes to execute tasks.

[0060] Step S2042, configure the task template on the Kubernetes plug-in of Jenkins, and call the Kubernetes plug-in of Jenkins to build a basic image Pod node based on the Kaniko image.

[0061] In Kubernetes, Pod is the smallest deployable unit, which contains one or more containers. Each container runs based on a specific image. One or more containers share the network namespace and storage volume.

[0062] Specifically, define the YAML file of the Pod. In Kubernetes, Pods can be defined by YAML files. The YAML file contains the configuration information of the Pod, including the image used, the startup command of the container, environment variables, etc. Among them, the kubectl command line tool can be used to create and manage Pods. For example, create a Pod, view the Pod status, view Pod details, etc.

[0063] Configure the task template on the Kubernetes plug-in of Jenkins. The platform provides automatic elastic scaling of JenkinsSlave nodes and calls the Kubernetes interface to pull the image template of the task template to build the basic image Pod node.

[0064] In one implementation, the task template is a Kaniko image template, and a Kubernetes interface is called to pull the image template of the task template to build a basic image Pod node based on the Kaniko image.

[0065] Step S2043: Generate a target image in the base image Pod node based on the task file.

[0066] Pull the package file and custom Dockerfile file from the object storage unit and generate the target image in the base image Pod node.

[0067] Among them, image building is safe and reliable. The entire image building process is executed in the Pod, and the Pod is destroyed immediately after execution. There is no impact of concurrent image building interfering with each other.

[0068] Step S205: Synchronize and store the target image in a public image repository or a user-purchased image repository.

[0069] Upload the generated target image to the public image repository provided by the DevOps platform or the user's self-purchased image repository to meet the diversified storage needs of the target image.

[0070] Among them, there are various ways to store images, supporting the public image warehouse provided by the platform and the image warehouse purchased by users to meet the diverse needs of users.

[0071] The image building method based on Jenkins provided in this embodiment, based on the Jenkins image building task pipeline template provided by the DevOps platform, uses Jenkins and Kubernetes cluster capabilities to deploy the Jenkins cluster using Kubernetes clustering, and configures the automatic scaling Slave related configuration, uploads the product package selected by the user to the object storage unit, and customizes the Dockerfile file according to the user, and uploads it to the object storage unit. Generate a Jenkins image building task based on the product package, Dockerfile file and the image building template provided by the platform. When executing the image building, a Pod based on Kaniko is automatically created in the Kubernetes cluster, and the Jenkins image building task is executed in the Pod, and the image building is finally completed. This application can complete the image building through the Kubernetes cluster, so that the image building is separated from the Docker stand-alone environment, solves the influence of mutual interference during concurrent image building, and ensures the safety of image building, which has important practical value.

[0072] This application uses Jenkins' Kubernetes plug-in, Kubernetes cluster capabilities, and object storage capabilities to automatically generate a Pod based on the Kaniko image as the foothold for image building when the user executes the image building. With the isolation capability of the Pod, the interference caused by concurrent image building is resolved, and the Docker stand-alone building environment is separated to ensure the security of Jenkins image building. This achieves separation from the Docker stand-alone building environment and resolves the interference caused by concurrent image building. The scenario where there are multiple tenants with the same source code dependencies.

[0073] In this embodiment, a mirror image building device based on Jenkins is also provided, which is used to implement the above embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0074] This embodiment provides a mirror image building device based on Jenkins. Figure 4 is a structural block diagram of an image building device based on Jenkins according to an embodiment of the present invention, such as Figure 4 As shown, the image building device based on Jenkins includes:

[0075] The pulling module 401 is used to pull the target construction task data. The target construction task data includes a task template and a task file. The task template is generated by the DevOps platform. Different task templates correspond to construction tasks.

[0076] The generation module 402 is used to generate an image building task based on the target building task data.

[0077] The execution module 403 is used to call the Kubernetes plug-in of Jenkins to build a basic image Pod node based on the image building task, and generate a target image in the basic image Pod node.

[0078] In some optional implementations, the image building device based on Jenkins further includes:

[0079] The acquisition module 404 is used to build or receive a package file from a target user, and receive a custom Dockerfile file from a target user.

[0080] The image source storage module 405 is used to store the program package file and the custom Dockerfile file in the object storage unit.

[0081] In some optional implementations, the generating module 402 includes:

[0082] The first generation unit is used to configure a task template on the Kubernetes plug-in of Jenkins, and call the Kubernetes plug-in of Jenkins to build a basic image Pod node based on the Kaniko image, where the task template is the Kaniko image template.

[0083] The second generation unit is used to generate a target image in a basic image Pod node based on the task file.

[0084] In some optional implementations, the image building device based on Jenkins further includes:

[0085] The deployment module 406 is used to deploy the Jenkins service in the Kubernetes cluster, and install and configure the Kubernetes plug-in and the automatic scaling Slave related configuration in Jenkins.

[0086] In some optional implementations, the image building device based on Jenkins further includes:

[0087] The image storage module 407 is used to synchronously store the target image in a public image repository or a user-purchased image repository.

[0088] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0089] The Jenkins-based image building device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0090] The embodiment of the present invention also provides a computer device having the above Figure 4 The image building device based on Jenkins is shown.

[0091] See also Figure 5 , Figure 5 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 5As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 5 A processor 10 is taken as an example.

[0092] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0093] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.

[0094] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0095] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0096] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 5 The example of connecting through bus is taken in the following.

[0097] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.

[0098] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0099] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0100] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A mirror building method based on Jenkins, characterized in that: Applied to the DevOps platform, the method includes: The DevOps platform pulls target construction task data, wherein the target construction task data includes a task template and a task file, wherein the task template is generated by the DevOps platform, and different task templates correspond to construction tasks; Generate an image building task based on the target building task data; Based on the image building task, the Kubernetes plug-in of Jenkins is called to build a basic image Pod node, and a target image is generated in the basic image Pod node.

2. The image building method based on Jenkins according to claim 1, characterized in that: The task file includes a package file and a custom Dockerfile file, and before pulling the target build task data, it also includes: The DevOps platform builds or receives a package file from a target user; The DevOps platform receives a custom Dockerfile file from the target user; The program package file and the custom Dockerfile file are stored in an object storage unit.

3. The image building method based on Jenkins according to claim 1 is characterized in that: The step of calling the Kubernetes plug-in of Jenkins to build a basic image Pod node based on the image building task, and generating a target image in the basic image Pod node includes: The task template is configured on the Kubernetes plug-in of the Jenkins, and the Kubernetes plug-in of the Jenkins is called to build a basic image Pod node based on the Kaniko image, where the task template is a Kaniko image template; The target image is generated in the base image Pod node based on the task file.

4. The image building method based on Jenkins according to claim 3 is characterized in that: The method further includes: based on the image building task, calling the Kubernetes plug-in of Jenkins to build a basic image Pod node, and generating a target image in the basic image Pod node: The DevOps platform deploys the Jenkins service in the Kubernetes cluster, and installs and configures the Kubernetes plug-in and automatic scaling Slave related configuration in the Jenkins.

5. The image building method based on Jenkins according to claim 1, characterized in that: The method further comprises: The DevOps platform synchronously stores the target image in a public image repository or a user-purchased image repository.

6. A mirror image building device based on Jenkins, characterized in that: The device comprises: A pulling module, used to pull target build task data, wherein the target build task data includes a task template and a task file, wherein the task template is generated by the DevOps platform, and different task templates correspond to build tasks; A generation module, used to generate an image building task based on the target building task data; The execution module is used to call the Kubernetes plug-in of Jenkins to build a basic image Pod node based on the image building task, and generate a target image in the basic image Pod node.

7. The image building device based on Jenkins according to claim 6, characterized in that: The device also includes: An acquisition module is used to build or receive a package file from a target user, and receive a custom Dockerfile file from the target user; The image source storage module is used to store the program package file and the custom Dockerfile file in an object storage unit.

8. The image building device based on Jenkins according to claim 6, characterized in that: The generation module is further used to configure the task template on the Kubernetes plug-in of the Jenkins, and call the Kubernetes plug-in of Jenkins to build a basic image Pod node based on the Kaniko image, where the task template is a Kaniko image template; The target image is generated in the base image Pod node based on the task file.

9. The image building device based on Jenkins according to claim 8, characterized in that: The device also includes: The deployment module is used to deploy the Jenkins service in the Kubernetes cluster, and install and configure the Kubernetes plug-in and automatic scaling Slave related configuration in the Jenkins.

10. The image building device based on Jenkins according to claim 6, characterized in that: The device also includes: The image storage module is used to synchronously store the target image in a public image warehouse or a user-purchased image warehouse.