A cloud-oriented software construction environment reuse method

By initializing the software build environment library in the continuous integration service, storing the operating system container image and software package list, and utilizing image matching and snapshot technology, the problem of frequent downloading and installation is solved, improving efficiency and reducing costs.

CN119883237BActive Publication Date: 2025-09-19INST OF SOFTWARE - CHINESE ACAD OF SCI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311391362.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-25
Publication Date
2025-09-19
Estimated Expiration
2043-10-25

AI Technical Summary

Technical Problem

Existing continuous integration services require frequent downloading and installation of software packages during each build, resulting in large computing, network, and time overhead, low efficiency, and high cost.

Method used

By initializing the software build environment library, storing commonly used operating system container images and software package lists, and using image matching and snapshot technology to download and install software packages one by one, image management is optimized to reduce repeated builds, thus forming a software build environment warehouse.

Benefits of technology

It improves the efficiency of continuous integration services, reduces computing and time overhead, reduces network resource consumption, and reduces the cost of continuous integration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119883237B_ABST
    Figure CN119883237B_ABST
Patent Text Reader

Abstract

The present invention provides a cloud-oriented software build environment reuse method, which relates to the field of software build and continuous integration. For continuous integration services deployed on the cloud, a software build environment library is constructed to store hierarchical software build environments, and a quickly reusable software build environment is provided. By reusing the software build environment, the computing, network and time overheads of software build environment preparation are reduced as much as possible, thereby improving the efficiency of continuous integration services and reducing the cost of continuous integration services.
Need to check novelty before this filing date? Find Prior Art

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 builds are the process of converting a software project's source code into a software system that can be installed (deployed), run, and executed. Software builds require a build environment, which provides the necessary dependencies, such as an operating system, a compiler for compiling source code, scanning and testing software, and third-party software for project reuse.

[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 each developer in 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 technologies and services, many vendors have developed continuous integration services. By deploying continuous integration systems in the cloud, they provide cloud-based continuous integration support for software projects. Typical continuous integration services currently include GitHub Actions, Travis CI, and CircleCI.

[0005] Continuous integration services typically 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 according to project needs to improve the build environment. Frequent continuous integration requires a large number of build environment improvements, 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 environments, improve the efficiency of continuous integration services, and reduce the cost of continuous integration services.

[0008] The technical solutions adopted by the present invention to solve the above technical problems are 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 in the software build environment library that matches the current pointer position. 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 as 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 at the head of the list of installed software packages, the operating system image required by the software project is selected and instantiated into a container. The software packages after the pointer are downloaded and installed one by one in the container. After each software package is downloaded and installed, a container snapshot image is packaged and the installed software packages in the container snapshot image are recorded.

[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, the software build environment library is initialized in step (1), including 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, the construction environment container image description file in step (1) records the operating system and the installed software package set based on the construction environment container image.

[0020] Preferably, the environment container image description file constructed in step (1) adopts 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 repository. Compared to 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 a diverse build environment that is more closely aligned with project construction requirements and is in a state of direct or near direct use, greatly improving the efficiency of continuous integration and reducing the cost of continuous integration. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 This is 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 of 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 software build environments, and description files that describe the operating systems and installed software packages based on these images.

[0031] Preferably, Docker container technology is used to store Docker container images in the library.

[0032] Preferably, use the following JSON format document 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 in the software project build script.

[0038] For different types of software projects, the software packages to be installed are extracted based on 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 yet 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 installation software packages, jump to step 5.

[0040] The matching method is as follows: take the software package pointed to by the pointer and all the software packages before it as a target software package set, traverse the build environment container image description file, and 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 base image container and improve the build environment: Select the operating system image required for the software project and instantiate it into a container. In the container, download and install the software packages after the pointer location one by one. 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 fewest counts until there is enough storage space.

[0044] Experimental test:

[0045] Experimental setup: 10 recently built and successfully built software packages were selected on the openEuler build platform, including the source code 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 in one round, and record the time Tt_a consumed by each package;

[0048] (2) Use this method to build the B version of the 10 software packages in a new round, 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 the 10 software packages from the build records of the original build platform;

[0050] (4) Compare the “relative time difference” 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, they are not intended to limit the present invention. Any appropriate modification or equivalent substitution of the technical solution of the present invention by a person skilled in the art should be included in the protection scope of the present invention. The protection scope of the present invention shall be based on that 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 in the software build environment library that matches the current pointer position. 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 as 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 at the head of the list of installed software packages, the operating system image required by the software project is selected and instantiated into a container. The software packages after the pointer are downloaded and installed one by one in the container. After each software package is downloaded and installed, a container snapshot image is packaged and the installed software packages in the container snapshot image are recorded. (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, 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 with one or more software packages installed based on the operating system image.

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 environment container image description file built in step (1) uses JSON format.

7. The cloud-oriented software construction environment reuse method according to claim 1, wherein: 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 RPM type software projects, 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, wherein: 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

  • Automatic continuous integration method and system in cloud native scene

    CN115878124A

  • Computer-automated software release and deployment architecture

    US11093227B1