Method and system for uploading container mirror image to mirror image warehouse based on source code warehouse
Technical Field
The invention relates to the technical field of computer software application, in particular to a method and a system for uploading a container mirror image to a mirror image warehouse based on a source code library.
Background
People have higher and higher requirements on the quality and efficiency of software products and services, and the traditional method of cutting development and operation apart is not suitable for the requirements of modern product and service development. The three factors of agile development, new operation and maintenance technology and market demand oriented to make people think again how to look at software development, the commonalities of the three trends are that the change speed is increased, and the practice of laying aside software functions needed by users for several months and then developing the software functions cannot be accepted. Only when software is developed quickly and efficiently can market demands be met.
DevOps (a combination of Development and Operations, all english) is a collective term for a set of processes, methods and systems for facilitating communication, collaboration and integration between Development (application/software engineering), technical Operations and Quality Assurance (QA) departments. It appears because the software industry is increasingly aware that: in order to deliver software products and services on time, development and operation must work in close cooperation. If a platform or a tool can support the development and operation delivery work and the subsequent environment management work in a unified way, the platform needs a series of continuous integration, continuous delivery, automatic deployment, automatic test monitoring, automatic expansion and contraction and automatic system recovery to improve the deployment efficiency in the development, test, operation and maintenance process, simplify the management of the development, test, operation and maintenance process, reduce the delivery risk and reduce the communication cost and the operation cost.
In summary, the problems faced at present are: how to integrate the development, management and operation of programs into a whole to solve the problems of complex software development, test and operation process and low efficiency at present.
Disclosure of Invention
The technical task of the invention is to provide a method and a system for uploading container images to an image warehouse based on a source code library to solve the problems of complex software development, test and operation processes and low efficiency.
The technical task of the invention is realized by the following modes:
a method for uploading a container mirror image to a mirror image warehouse based on a source code library integrates codes and program submission, compilation, uploading and publishing into a set of flow, and comprises the following steps:
s1, uploading the code to a source code library by the user through the client;
s2, the management component detects the source codes from the source code library and compresses the source codes to generate a source code compressed file;
s3, the management component uploads the source code compressed file to the container component;
s4, the container component compiles the source code compressed file to generate an image file and generates a label, and the label is used for appointing the address of an image warehouse for storing the image file;
s5, the container component uploads the image file to the image repository specified in the label.
Through the steps, the coding, the source code detection, the uploading and the publishing are integrated, and the efficiency of program development, testing and operation is improved.
Further, in step S1, after the user submits the code to the source code library through the client, the source code library returns the source code library address to the client.
Further, in step S2, the step of the management component retrieving the source codes from the source code library and compressing the source codes to generate the source code compressed file includes:
s201, a user sends a source code uploading request and a source code library address to a management component through a client;
s202, the management component calls a source code library according to the source code address and detects a source code from the source code library;
s203, the management component uploads the source codes to a local temporary source code library for storage, and the local temporary source code library returns the address of the local temporary source code library to the management component;
s204, the management component calls a local temporary source code library according to the local temporary source code library address and extracts a source code;
s205, the management component compresses the source codes to generate source code compressed files, the source code compressed files are uploaded to a temporary file warehouse to be stored, and the temporary file warehouse returns a temporary file warehouse address to the management component.
Further, in step S3, the step of uploading, by the management component, the source code compressed file to the container component includes:
s301, the management component sends a request for uploading the source code compressed file to the container component;
s302, the management component calls a temporary file warehouse according to the address of the temporary file warehouse and extracts a source code compressed file;
and S303, the management component uploads the source code compressed file to the container component.
Further, in step S4, the step of compiling the source code compressed file by the container component to generate an image file and generating a label includes:
s401, the management component sends a compiling request to the container component, and the container component returns a container component address to the management component;
s402, the container component compiles the source code compressed file to generate a mirror image file;
s403, the management component sends a label generation request to the container component;
s404, the container component generates a label, wherein the label comprises a mirror image warehouse address, and the mirror image warehouse address is used for appointing a mirror image warehouse for storing mirror image files.
Further, in step S404, the container component returns the mirror repository address in the tag to the management component.
Further, in step S5, the step of uploading the image file to the image repository specified in the label by the container component includes:
s501, the management component sends a request for uploading the mirror image file to the container component;
s502, the container component uploads the mirror image file to a mirror image warehouse specified in the label.
Further, the management component is a management component configured with an active code library address, a container component address and a mirror repository address.
The system comprises a client, a source code library, a management assembly, a local temporary source code library, a temporary file warehouse, a container assembly and a mirror image warehouse, wherein the management assembly is respectively connected with the client, the source code library, the local temporary source code library, the temporary file warehouse and the container assembly; the client is used for compiling codes by a client, the source code library is used for storing codes of a user, the management component is used for detecting source codes and generating a source code compressed file, the local temporary source code library is used for storing the source codes, the temporary file warehouse is used for storing the source code compressed file, the container component is used for compiling the source codes to generate a mirror image file and marking the mirror image file, and the mirror image library is used for storing the mirror image file.
The method and the system for uploading the container mirror image to the mirror image warehouse based on the source code library have the following advantages that: the invention provides a complete set of project solution from the start of program coding to the submission, compilation, uploading and release of the program, is a method for realizing partial modules in the whole DevOps idea, improves the deployment efficiency in the development, test and operation process, simplifies the management in the development, test, operation and maintenance process, reduces the delivery risk, reduces the communication cost and the operation cost, and effectively improves the working efficiency of developers and managers.
Drawings
The invention is further described below with reference to the accompanying drawings.
Fig. 1 is a schematic block diagram of a method for uploading a container image to a mirror image warehouse based on a source code library in embodiment 1;
fig. 2 is a flow chart of a method for uploading a container image to a mirror image repository based on a source code repository in embodiment 1;
fig. 3 is a flow diagram illustrating a process in which a management component detects source codes from a source code repository and compresses the source codes to generate a source code compressed file in the method for uploading a container image to an image repository based on the source code repository in embodiment 1;
fig. 4 is a block flow diagram illustrating uploading of a source code compressed file to a container component by a management component in a method for uploading a container image to a mirror image repository based on a source code repository in embodiment 1;
fig. 5 is a block flow diagram illustrating a process of compiling a source code compressed file to generate an image file and labeling the image file in the method of uploading a container image to an image repository based on a source code repository in embodiment 1.
Detailed Description
The method and system for uploading container images to an image repository based on a source code repository of the present invention are described in detail below with reference to the drawings and the detailed description.
Example 1:
as shown in fig. 1-5, the method for uploading a container mirror image to a mirror image warehouse based on a source code library integrates code and program submission, compilation, uploading and publishing into a set of processes, and comprises the following steps:
s1, after the user finishes coding, the code is uploaded to a source code library through the client, and after the user submits the code to the source code library through the client, the source code library returns the address of the source code library to the client;
s2, the management component detects the source codes from the source code library and compresses the source codes to generate a source code compressed file;
s3, the management component uploads the source code compressed file to the container component;
s4, the container component compiles the source code compressed file to generate an image file and generates a label, and the label is used for appointing the address of an image warehouse for storing the image file;
s5, the container component uploads the image file to the image repository specified in the label.
The invention integrates the version control system, the container management system and the mirror image warehouse system into a whole, and realizes a whole set of project flow from the start of program coding to program submission, compiling, uploading and releasing.
In step S2, the specific steps of the management component retrieving the source codes from the source code library and compressing the source codes to generate the source code compressed file include:
s201, a user sends a source code uploading request and a source code library address to a management component through a client;
s202, the management component calls a source code library according to the source code address and detects a source code from the source code library;
s203, the management component uploads the source codes to a local temporary source code library for storage, and the local temporary source code library returns the address of the local temporary source code library to the management component;
s204, the management component calls a local temporary source code library according to the local temporary source code library address and extracts a source code;
s205, the management component compresses the source codes to generate source code compressed files, the source code compressed files are uploaded to a temporary file warehouse to be stored, and the temporary file warehouse returns a temporary file warehouse address to the management component.
In step S3, the specific step of uploading the source code compressed file to the container component by the management component is:
s301, the management component sends a request for uploading the source code compressed file to the container component;
s302, the management component calls a temporary file warehouse according to the address of the temporary file warehouse and extracts a source code compressed file;
and S303, the management component uploads the source code compressed file to the container component.
In step S4, the specific steps of the container component compiling the source code compressed file to generate the image file and generating the label are:
s401, the management component sends a compiling request to the container component, and the container component returns a container component address to the management component;
s402, the container component compiles the source code compressed file to generate a mirror image file;
s403, the management component sends a label generation request to the container component;
s404, the container component generates a label, wherein the label comprises an image warehouse address, the image warehouse address is used for appointing an image warehouse for storing the image file, and the container component returns the image warehouse address to the management component.
In step S5, the specific step of uploading the image file to the image repository specified in the label by the container component is:
s501, the management component sends a request for uploading the mirror image file to the container component;
s502, the container component uploads the mirror image file to a mirror image warehouse specified in the label.
The management component is configured with an active code library address, a container component address and a mirror image warehouse address.
The invention integrates the code, the source code detection, the compiling, the uploading and the publishing into a whole, and improves the efficiency of program development, testing and operation.
Example 2:
as shown in fig. 1, the system for uploading a container mirror image to a mirror image warehouse based on a source code library of the present invention includes a client, a source code library, a management component, a local temporary source code library, a temporary file warehouse, a container component and a mirror image warehouse, wherein the management component is respectively connected to the client, the source code library, the local temporary source code library, the temporary file warehouse and the container component, the client is connected to the source code library, and the container component is connected to the mirror image warehouse; the client is used for compiling codes by a client, the source code library is used for storing codes of a user, the management component is used for detecting source codes and generating a source code compressed file, the local temporary source code library is used for storing the source codes, the temporary file warehouse is used for storing the source code compressed file, the container component is used for compiling the source codes to generate a mirror image file and marking the mirror image file, and the mirror image library is used for storing the mirror image file.
The system for uploading the container mirror image to the mirror image warehouse based on the source code library can realize the method for uploading the container mirror image to the mirror image warehouse based on the source code library in the embodiment 1.
The present invention can be easily implemented by those skilled in the art from the above detailed description.
It should be understood, however, that the intention is not to limit the invention to the particular embodiments described. On the basis of the disclosed embodiments, a person skilled in the art can combine different technical features at will, thereby implementing different technical solutions. In addition to the technical features described in the specification, the technology is known to those skilled in the art.