Cloud-oriented software construction environment multiplexing method
By initializing the software to build the environment library and instantiating the container image according to the needs, the inefficiency and high cost of software construction environment preparation in the existing continuous integration service is solved, efficient software construction environment reuse is achieved, and the overhead of continuous integration service is reduced.
Patent Information
- Application Number
- CN202311391362.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-25
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2043-10-25
AI Technical Summary
Existing continuous integration services are inefficient and costly when preparing for software construction environments.
By initializing the software to build an environment library, store commonly used operating system container images, and instantiate the images according to the construction requirements of the software project, download and install software packages one by one, form a container snapshot mirror, record installed software packages, and optimize image management to reduce storage usage.
It realizes the reuse of the software construction environment, reduces the computing, network and time overhead of the construction environment preparation, improves the efficiency of continuous integration services, and reduces costs.
Smart Images

Figure CN119883237A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of software construction and continuous integration, and in particular to a cloud-oriented software construction environment reuse method. Background Art
[0002] Software build refers to converting the source code of a software project into a software system that can be installed (deployed) and run. Software build requires a software build environment, which provides the dependencies required for software build, such as operating system, compiler for compiling source code, scanning and testing software, third-party software for project reuse, etc.
[0003] Continuous integration is an important software development practice. It verifies whether the code completed by developers meets expectations by frequently merging the code completed by developers of the software project and building the merged code. The continuous integration system is a development tool software that supports the above process.
[0004] With the rapid development of cloud computing technology and services, many vendors have developed continuous integration services, which provide cloud-based continuous integration support for software projects by deploying continuous integration systems on the cloud. Typical continuous integration services include GitHub Actions, Travis CI, and CircleCI.
[0005] Continuous integration services usually use containers to host software build environments, but existing continuous integration services only provide basic container images. Each time a build is executed, a series of software packages need to be downloaded and installed to improve the build environment according to project needs. Frequent continuous integration requires a large number of executions to improve the build environment, resulting in a lot of computing, network and time overhead, making continuous integration services inefficient and costly. Summary of the invention
[0006] The technical problems to be solved by the present invention are:
[0007] How to reduce the computing, network and time overhead of software build environment preparation as much as possible through the reuse of software build environment, improve the efficiency of continuous integration services and reduce the cost of continuous integration services.
[0008] The technical solution adopted by the present invention to solve the above technical problems is as follows:
[0009] A cloud-oriented software construction environment reuse method includes the following steps:
[0010] (1) Initialize the software build environment library and store commonly used operating system container images in the library;
[0011] (2) Obtain a list of software packages to be installed when the software project is built, and set a pointer to the end of the list of software packages;
[0012] (3) Determine whether there is an image matching the current pointer position in the software build environment library. If there is no matching image and the pointer has not yet moved to the head of the list of software packages to be installed, move the pointer forward and make another determination;
[0013] (4) If a matching image exists, instantiate the image into a container, and download and install the software packages after the pointer location in the container one by one; after each software package is downloaded and installed, package a container snapshot image and record the installed software packages in the container snapshot image;
[0014] (5) If there is no matching image and the pointer is already at the head of the list of installed software packages, select the operating system image required by the software project and instantiate it into a container, and download and install the software packages after the pointer in the container one by one; after each software package is downloaded and installed, package a container snapshot image and record the installed software packages in the container snapshot image;
[0015] (6) Record the number of times the images in the software build environment library have been instantiated as containers in the recent period and sort the images; when storage space is insufficient, delete the images starting with the ones with the least number of times until there is enough storage space.
[0016] Preferably, in step (1), initializing the software build environment library includes storing the build environment container image and the build environment container image description file.
[0017] Preferably, the construction environment container image in step (1) carries a software construction environment, specifically an operating system image, or an image with one or more software packages installed based on the operating system image.
[0018] Preferably, storing the build environment container image in step (1) includes: using Docker container technology to store the Docker container image in a library.
[0019] Preferably, in step (1), the build environment container image description file records the operating system and installed software package set based on the build environment container image.
[0020] Preferably, the environment container image description file constructed in step (1) is in JSON format.
[0021] Preferably, the method for obtaining the list of software packages to be installed when the software project is built in step (2) is: using a queue structure to store the software packages to be installed, and adding the software packages to the queue in sequence according to the order declared in the software project build script.
[0022] Preferably, in step (2), for different types of software projects, the software package to be installed is extracted according to the build script syntax and format specific to the type of software project.
[0023] Preferably, in step (2), for an RPM type software project, the software package to be installed is extracted from the BuildRequires and Requires fields.
[0024] Preferably, the method for determining whether there is a matching image in step (3) is: taking the software package pointed to by the pointer and all software packages before the software package as a target software package set, traversing the build environment container image description file; if the software set installed in the build environment container image is exactly the same as the target software package set, then the image matches, that is, there is a matching image; otherwise, there is no matching image.
[0025] Compared with the prior art, the present invention has the following positive effects:
[0026] The present invention continuously collects and constructs frequently used software build environments in a hierarchical manner to form a software build environment warehouse. Compared with existing software continuous integration services that only provide basic software build environment images (usually operating system images, or images containing programming language compilers or interpreters), the present invention can provide software projects with diversified build environments that are closer to project construction requirements and are in a state of being directly usable or close to being directly usable, greatly improving the efficiency of continuous integration and reducing the cost of continuous integration. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 A flowchart of the steps of a cloud-oriented software construction environment reuse method of the present invention. DETAILED DESCRIPTION
[0028] In order to make the various technical features and advantages or technical effects in the above technical solutions of the present invention more obvious and easy to understand, they are described in detail below with reference to the accompanying drawings.
[0029] like Figure 1 As shown, an embodiment of the present invention discloses a cloud-oriented software construction environment reuse method, comprising the following steps:
[0030] Step 1: Initialize the software build environment library: The software build environment library is used to store container images that carry the software build environment, and description files that describe the operating systems and installed software packages based on these images.
[0031] Preferably, the Docker container technology is used to store the Docker container image in the library.
[0032] Preferably, the following JSON format document is used as the software build environment container image description file:
[0033]
[0034] Store commonly used operating system container images in the library.
[0035] Preferably, store Ubuntu images consistent with GitHub Actions, namely Ubuntu 22.04 and Ubuntu 20.04.
[0036] Step 2: Create a list of packages to be installed: Get the list of packages to be installed when the software project is built, and set a pointer to the end of the package list;
[0037] Preferably, a queue structure is used to store the software packages to be installed, and the software packages are added to the queue in sequence according to the order declared by the software project build script.
[0038] For different types of software projects, the software packages to be installed are extracted according to the build script syntax and format specific to the type of software project. Preferably, for RPM type software projects, the software packages to be installed are extracted from the BuildRequires and Requires fields.
[0039] Step 3: Search for software build environment images: Determine whether there is an image matching the current pointer position in the software build environment library. If so, jump to step 4; if not, and the pointer has not moved to the head of the list of software packages to be installed, move the pointer forward and perform step 3 again; if not, and the pointer is already at the head of the list of software packages to be installed, jump to step 5.
[0040] The matching method is as follows: the software package pointed to by the pointer and all software packages before the software package are taken as a target software package set, and the build environment container image description file is traversed. If the software set installed in the build environment container image is exactly the same as the target software package set, the image matches.
[0041] Step 4: Select a matching image container and improve the build environment: Instantiate the image as a container, and download and install the software packages after the pointer location one by one in the container. After downloading and installing each software package, package a container snapshot image and record the installed software packages in the image.
[0042] Step 5: Select the basic image containerization and improve the build environment: Select the operating system image required for the software project and instantiate it into a container. Download and install the software packages after the pointer location one by one in the container. After downloading and installing each software package, package a container snapshot image and record the installed software packages in the image.
[0043] Step 6: Image management: Record the number of times the images in the software build environment library have been instantiated as containers in the recent period, sort the images, and when storage space is insufficient, delete the images starting with the ones with the least number of times until there is enough storage space.
[0044] Experimental test:
[0045] Experimental setup: Select 10 software packages that have been built recently and successfully on the openEuler build platform, including the source packages of the current version (version B) and the previous version (version A);
[0046] Experimental steps:
[0047] (1) Use this method to build version A of 10 software packages and record the time Tt_a consumed by each package;
[0048] (2) Use this method to build a new round of version B of 10 software packages, and record the time Tt_b consumed by each package;
[0049] (3) Obtain the build times To_a and To_b of version A and version B of 10 software packages from the build records of the original build platform;
[0050] (4) Compare the “relative time differences” of the 10 software packages:
[0051] (To_a-To_b) / To_a and (Tt_a-Tt_b) / Tt_a;
[0052] Experimental results: Using the method of the present invention, the relative time differences of all software packages are positive and greater than the relative time differences on the original construction platform. The experimental results show that the method of the present invention is effective.
[0053] Although the present invention has been disclosed as above by way of embodiments, it is not intended to limit the present invention. Appropriate modifications or equivalent substitutions of the technical solutions of the present invention made by ordinary technicians in the field should be included in the protection scope of the present invention. The protection scope of the present invention shall be based on what is defined in the claims.
Claims
1. A cloud-oriented software construction environment reuse method, characterized in that: The following steps are involved: (1) Initialize the software build environment library and store commonly used operating system container images in the library; (2) Obtain a list of software packages to be installed when the software project is built, and set a pointer to the end of the list of software packages; (3) Determine whether there is an image matching the current pointer position in the software build environment library. If there is no matching image and the pointer has not yet moved to the head of the list of software packages to be installed, move the pointer forward and make another determination; (4) If a matching image exists, instantiate the image into a container, and download and install the software packages after the pointer location in the container one by one; after each software package is downloaded and installed, package a container snapshot image and record the installed software packages in the container snapshot image; (5) If there is no matching image and the pointer is already at the head of the list of installed software packages, select the operating system image required by the software project and instantiate it into a container, and download and install the software packages after the pointer in the container one by one; after each software package is downloaded and installed, package a container snapshot image and record the installed software packages in the container snapshot image; (6) Record the number of times that images in the software build environment library have been instantiated as containers in the recent period of time and sort the images; When storage space is insufficient, images with the fewest counts are deleted starting from the last image until storage space is sufficient.
2. The cloud-oriented software construction environment reuse method according to claim 1, characterized in that: In step (1), the software build environment library is initialized, including storing the build environment container image and the build environment container image description file.
3. The cloud-oriented software construction environment reuse method according to claim 2, characterized in that: In step (1), the environment container image is constructed to carry the software construction environment, specifically an operating system image, or an image based on the operating system image with one or more software packages installed.
4. The cloud-oriented software construction environment reuse method according to claim 2, characterized in that: Storing the build environment container image in step (1) includes: using Docker container technology to store the Docker container image in a library.
5. The cloud-oriented software construction environment reuse method according to claim 2, characterized in that: In step (1), the build environment container image description file records the operating system and installed software package set based on the build environment container image.
6. The cloud-oriented software construction environment reuse method according to claim 5, characterized in that: The build environment container image description file in step (1) uses the JSON format.
7. The cloud-oriented software construction environment reuse method according to claim 1, characterized in that: The method for obtaining the list of software packages to be installed when the software project is built in step (2) is: using a queue structure to store the software packages to be installed, and adding the software packages to the queue in sequence according to the order declared in the software project build script.
8. The cloud-oriented software construction environment reuse method according to claim 7, characterized in that: In step (2), for different types of software projects, the software package to be installed is extracted according to the build script syntax and format specific to the type of software project.
9. The cloud-oriented software construction environment reuse method according to claim 8, characterized in that: In step (2), for an RPM type software project, the software package to be installed is extracted from the BuildRequires and Requires fields.
10. The cloud-oriented software construction environment reuse method according to claim 1, characterized in that: The method for determining whether there is a matching image in step (3) is as follows: taking the software package pointed to by the pointer and all software packages before the software package as a target software package set, traversing the build environment container image description file; if the software set installed in the build environment container image is exactly the same as the target software package set, then the image matches, that is, there is a matching image; otherwise, there is no matching image.
Citation Information
Patent Citations
Application integration and release method and system based on container cloud
CN109614138A
Mirror image construction and loading method based on mirror image loading in container environment
CN112685134A
Automatic continuous integration method and system in cloud native scene
CN115878124A
Computer-automated software release and deployment architecture
US11093227B1