Mirror image file construction method and device, storage medium and electronic device

By using a continuous integration platform and automated pipeline tasks with specified pipeline scripts, the problem of low image file building efficiency was solved, and efficient image file building was achieved.

CN116501747BActive Publication Date: 2026-02-03BEIJING SHANMA ZHIJIAN TECH CO LTD +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310451399.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-24
Publication Date
2026-02-03
Estimated Expiration
2043-04-24

AI Technical Summary

Technical Problem

The existing methods for building image files require manual execution, resulting in low efficiency.

Method used

The system receives image file build instructions from a specified device in the continuous integration platform, and builds the image file using a target update script according to the pipeline task of the specified pipeline script. This includes executing the target update script in the runtime environment of the source image file and performing compression processing after exiting the runtime environment.

Benefits of technology

This reduces reliance on manual intervention and improves the efficiency of image file building.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116501747B_ABST
    Figure CN116501747B_ABST
Patent Text Reader

Abstract

The application discloses a mirror file construction method and device, a storage medium and an electronic device, and is applied to a smart device. The method comprises the following steps: receiving a mirror file construction instruction through a specified device in a continuous integration platform, wherein the mirror file construction instruction is used for instructing to use a target update script to perform mirror file construction according to a pipeline task corresponding to a specified pipeline script; in response to the mirror file construction instruction, the following construction steps are performed according to the pipeline task corresponding to the specified pipeline script, and a constructed mirror file is obtained: executing the target update script in a running environment of a source mirror file to update the source mirror file in the running environment of the source mirror file, wherein the source mirror file is a mirror file of a specified operating system, and the target update script is an update script obtained by the continuous integration platform from a script hosting platform; and after exiting the running environment of the source mirror file, performing compression processing on the updated source mirror file to obtain a target mirror file.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of smart home, and in particular, to a mirror file construction method and device, a storage medium and an electronic device. BACKGROUND

[0002] At present, with the rapid development of Internet technology, for the server operating system, it is often necessary to customize the mirror to meet the actual production needs of each enterprise. In the prior art, the customization of the mirror of the corresponding operating system is usually completed by decompressing, configuring and recompressing the compressed read-only file system corresponding to the operating system.

[0003] However, the above-mentioned mirror file construction method generally needs to manually perform the construction operation on the compressed read-only file system. The construction process requires high professional degree of the operator, and the manual operation is time-consuming and inefficient.

[0004] Therefore, the mirror file construction method in the related art has the problem of low efficiency of mirror file construction due to the need for manual execution. SUMMARY

[0005] The mirror file construction method and device, the storage medium and the electronic device provided in the embodiments of the present application at least solve the problem of low efficiency of mirror file construction due to the need for manual execution in the related art mirror file construction method.

[0006] According to an aspect of an embodiment of the present application, a mirror file construction method is provided, applied to a smart device, comprising: receiving a mirror file construction instruction through a designated device in a continuous integration platform, wherein the mirror file construction instruction is used to instruct to use a target update script to perform mirror file construction according to a pipeline task corresponding to a designated pipeline script; in response to the mirror file construction instruction, performing the following construction steps according to the pipeline task corresponding to the designated pipeline script to obtain a constructed mirror file: executing the target update script in a running environment of a source mirror file to update the source mirror file in the running environment of the source mirror file, wherein the source mirror file is a mirror file of a designated operating system, and the target update script is an update script obtained by the continuous integration platform from a script hosting platform; after exiting the running environment of the source mirror file, compressing the updated source mirror file to obtain a target mirror file.

[0007] According to another aspect of the embodiments of the present application, a mirror file construction apparatus applied to a smart device is further provided, comprising: a receiving unit configured to receive a mirror file construction instruction through a designated device in a continuous integration platform, wherein the mirror file construction instruction is configured to instruct to perform mirror file construction using a target update script according to a pipeline task corresponding to a designated pipeline script; and an executing unit configured to, in response to the mirror file construction instruction, perform the following construction steps according to the pipeline task corresponding to the designated pipeline script to obtain a constructed mirror file: executing the target update script in a running environment of a source mirror file to update the source mirror file in the running environment of the source mirror file, wherein the source mirror file is a mirror file of a designated operating system, and the target update script is an update script obtained by the continuous integration platform from a script hosting platform; and after exiting the running environment of the source mirror file, performing compression processing on the updated source mirror file to obtain a target mirror file.

[0008] According to still another aspect of the embodiments of the present application, a computer readable storage medium having a computer program stored therein is further provided, wherein the computer program is configured to execute the mirror file construction method when running.

[0009] According to still another aspect of the embodiments of the present application, an electronic device is further provided, comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, wherein the processor executes the mirror file construction method through the computer program.

[0010] In this embodiment, a method is adopted to determine the source image and customized script according to the image file build instruction and build the target image file. The image file build instruction is received through a designated device in the continuous integration platform. This instruction instructs the image file to be built using a target update script according to the pipeline task corresponding to the specified pipeline script. In response to the image file build instruction, the following build steps are executed according to the pipeline task corresponding to the specified pipeline script to obtain the built image file: The target update script is executed in the runtime environment of the source image file to update the source image file within that environment. The source image file is an image file of a specified operating system, and the target update script is an update script obtained by the continuous integration platform from a script hosting platform. After exiting the runtime environment of the source image file, the updated source image file is compressed to obtain the target image file. Since the target image file can be built directly according to the image file build instruction in the runtime environment of the corresponding source image file using the corresponding target update script, the reliance on manual intervention is reduced, thus improving the efficiency of image file building. This solves the problem of low efficiency in image file building methods in related technologies due to the need for manual execution. Attached Figure Description

[0011] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0012] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0013] Figure 1 This is a schematic diagram of the hardware environment for a method of constructing an image file according to an embodiment of this application;

[0014] Figure 2 This is a flowchart illustrating an optional method for constructing an image file according to an embodiment of this application;

[0015] Figure 3 This is a flowchart illustrating another optional method for constructing an image file according to an embodiment of this application;

[0016] Figure 4 This is a structural block diagram of an optional image file building apparatus according to an embodiment of this application;

[0017] Figure 5This is a structural block diagram of an optional electronic device according to an embodiment of this application. Detailed Implementation

[0018] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0019] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0020] According to one aspect of the embodiments of this application, a method for constructing an image file is provided. Optionally, in this embodiment, the above-described method for constructing an image file can be applied to, for example... Figure 1 The hardware environment shown consists of terminal device 102 and server 104. For example... Figure 1 As shown, server 104 is connected to terminal device 102 via a network and can be used to provide services (such as application services) to the terminal or clients installed on the terminal. A database can be set up on the server or independently of the server to provide data storage services for server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data processing services for server 104.

[0021] The aforementioned network may include, but is not limited to, at least one of the following: wired network, wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network, metropolitan area network, local area network. The aforementioned wireless network may include, but is not limited to, at least one of the following: Wi-Fi, Bluetooth. The terminal device 102 may not be limited to devices such as PCs, mobile phones, tablets, etc.

[0022] The image file construction method of this application embodiment can be executed by server 104. Taking the execution of the image file construction method of this embodiment by server 104 as an example, Figure 2 This is a flowchart illustrating an optional method for constructing an image file according to an embodiment of this application, as shown below. Figure 2 As shown, the process of this method may include the following steps:

[0023] Step S202: Receive image file build instructions through a designated device in the continuous integration platform. The image file build instructions are used to instruct the image file to be built using the target update script according to the pipeline task corresponding to the designated pipeline script.

[0024] The image file construction method in this embodiment can be applied to scenarios involving the construction of operating system image files. Here, the operating system can be an underlying platform providing internet application services, i.e., a server operating system, such as Ubuntu (Linux, a computer operating system primarily for desktop applications) based on the ARM (Advanced RISC Machine, a 32-bit reduced instruction set processor architecture) architecture. Since different enterprises have different operating system requirements, official operating systems often struggle to meet the actual production needs of various enterprises in all aspects. Therefore, it is often necessary to customize the operating system image.

[0025] Taking the ARM-based Ubuntu operating system as an example, customizing an Ubuntu image typically involves using the Squashfs file system (a compressed read-only file system based on the Linux kernel). The image file is then customized through decompression, configuration, and compression. This customization process usually requires manual decompression of the Squashfs file system, entering its chroot (change root, i.e., changing the root directory referenced by programs during execution) environment, installing or modifying the image requirements within this environment, and then compressing and packaging the file system to obtain the image file, thus completing the Ubuntu operating system customization. However, this method has a high technical threshold, requires a high level of expertise, and is difficult to customize. Furthermore, manual operation is time-consuming, prone to errors, and costly, resulting in low overall efficiency.

[0026] To at least address some of the aforementioned issues, this embodiment leverages the functionality of a continuous integration platform to automate the image customization process through pre-written custom scripts and pipeline tasks. When building an image file, only manual selection of the image file customization script and source image file is required; the continuous integration platform then executes the image file build by reading the corresponding build instructions. Here, the image file build instructions can instruct the pipeline tasks corresponding to the specified pipeline script to use the target update script for image file building. The continuous integration platform can be the Jenkins platform (an open-source software project). The specified pipeline script can be a script used in the Jenkins platform's Pipeline (i.e., a workflow framework running on Jenkins), specifically the Jenkins Pipelinescript. Through the Jenkins Pipeline, tasks that originally ran independently on one or more nodes can be connected to achieve complex workflow orchestration and visualization that is difficult for a single task to complete. The source image file can be an image file of a specified operating system. The specified operating system can be the operating system to be customized, such as the aforementioned ARM-based Ubuntu operating system.

[0027] In a continuous integration platform, a pipeline script for building image files can be pre-written to determine the pipeline tasks for building image files, including but not limited to decompressing the source image, entering the chroot environment, performing installation or modification operations on the source image file in the chroot environment, and compressing and packaging the file system after exiting the chroot environment.

[0028] When writing a specified pipeline script, you need to first specify the machine (i.e., the device) that will execute the pipeline task corresponding to the specified pipeline script. The specified device will then perform the pipeline task according to the specified pipeline script.

[0029] Optionally, the image file build instruction may include information such as the name of the target update script, the name of the source image file, and the name of the target image file. The target update script may be one of a pre-defined set of update scripts used for image building, and may be stored in a script platform with script management capabilities. The source image file may be an image file corresponding to files in the operating system, and can be updated and modified. The target image file may be an image file obtained by updating the source image file according to the target update script.

[0030] The image file build command can be triggered by the platform executing the image file build after receiving information such as the name of the target update script, the name of the source image file, and the name of the target image file. The names of the target update script, the source image file, and the target image file can be manually entered by the platform executing the image file build.

[0031] Step S204: In response to the image file build instruction, execute the following build steps according to the pipeline task corresponding to the specified pipeline script to obtain the built image file:

[0032] Execute the target update script in the runtime environment of the source image file to update the source image file in the runtime environment of the source image file. The source image file is the image file of the specified operating system, and the target update script is the update script obtained by the continuous integration platform from the script hosting platform.

[0033] After exiting the runtime environment of the source image file, the updated source image file is compressed to obtain the target image file.

[0034] Upon receiving the image file build instruction, the aforementioned designated device can execute the corresponding build steps according to the pipeline task corresponding to the specified pipeline script. These build steps may include: executing the target update script in the runtime environment of the source image file to update the source image file within that environment; and compressing the updated source image file after exiting the runtime environment to obtain the target image file. Here, the target update script is the update script obtained by the continuous integration platform from the script hosting platform, and may include, but is not limited to, commands for configuring, modifying, and upgrading the source image. The script hosting platform can be a platform for script management and storage, such as GitLab (an open-source project for repository management systems).

[0035] Alternatively, the integration between the continuous integration platform and the script hosting platform can be achieved by creating credentials for the script hosting platform within the continuous integration platform. These credentials can be authentication keys between the platforms.

[0036] Based on the received image file build instructions, the name of the source image file can be determined first, and then the source image file can be obtained to update it within its runtime environment. Here, the target update script can be pulled from a scripting platform with script management capabilities. The runtime environment of the source image file can be a virtual environment, such as chroot, which can be used to modify the running directories of the current process and its child processes. By creating and initializing a directory to have the same directory structure as the operating system, applications can run within this directory, and the process of loading files and libraries from this directory can be isolated from the original operating system directory.

[0037] Executing the target update script in the runtime environment of the source image file can mean updating the source image file according to the contents of the target update script in the runtime environment of the source image file.

[0038] After executing the target update script, you can exit the runtime environment of the source image file and compress the updated image file so that it can be sent to the corresponding storage.

[0039] Optionally, the obtained target image file can be named according to the name of the target image file contained in the image file build instruction.

[0040] Through steps S202 to S204 above, an image file building instruction is received through a designated device in the continuous integration platform. This instruction instructs the use of a target update script to build the image file according to the pipeline task corresponding to the specified pipeline script. In response to the image file building instruction, the following building steps are executed according to the pipeline task corresponding to the specified pipeline script to obtain the built image file: The target update script is executed in the runtime environment of the source image file to update the source image file within that environment. The source image file is an image file of a specified operating system, and the target update script is an update script obtained by the continuous integration platform from a script hosting platform. After exiting the runtime environment of the source image file, the updated source image file is compressed to obtain the target image file. This solves the problem of low efficiency in image file building methods in related technologies due to the need for manual execution, thus improving the efficiency of image file building.

[0041] In one exemplary embodiment, after receiving the image file build instruction via a designated device in the continuous integration platform, the above method further includes:

[0042] S11, extract the image file version identifier and target script identifier from the image file build instruction. The image file version identifier is used to identify the file version of the source image file used to build the image file, and the target script identifier is used to identify the update script used to build the image file.

[0043] S12, Based on the image file version identifier, select the image file that matches the file version identified by the image file version identifier from a set of image files to obtain the source image file;

[0044] S13: Retrieve the update script that matches the target script identifier from the script hosting platform to obtain the target update script.

[0045] To improve the efficiency of image file building, the image file build command can include an image file version identifier and a target script identifier. Upon receiving the image file build command, the image file version identifier and target script identifier can be directly extracted from it. Here, the image file version identifier can be used to identify the file version of the source image file used for image file building; it can be the name of the aforementioned source image file. The target script identifier can be used to identify the update script used for image file building; it can be the name of the aforementioned target update script.

[0046] Based on the extracted image file version identifier, the image file that matches the file version identified by the image file version identifier can be selected from a set of image files; that is, the source image file. Here, the set of image files can be a set of image files downloaded from the official website and stored in the corresponding storage file that can be used for image building.

[0047] The script hosting platform can store pre-written update scripts for image building, tailored to actual needs. Based on the extracted target script identifier, the update script matching the target script identifier can be retrieved from the script hosting platform to obtain the target update script. Here, the update scripts stored in the script hosting platform can include update scripts for image files corresponding to different operating systems, or update scripts for different image files corresponding to the same operating system.

[0048] In this embodiment, by extracting the image file version identifier and target script identifier from the image file build instruction, the corresponding source image file and update script can be determined. This can avoid the failure of image file build due to errors in the transmission of image file version and target script, and at the same time, it can improve the efficiency of image build.

[0049] In one exemplary embodiment, before receiving image file build instructions via a designated device in the continuous integration platform, the above method further includes:

[0050] S21, in response to the input operation detected by the script configuration interface of the continuous integration platform, obtain the configuration information entered by the input operation, wherein the configuration information includes device information, image file version identifier and target script identifier for specifying the device for executing the pipeline task corresponding to the specified pipeline script;

[0051] S22, in response to the detected build instruction operation, send the image file build instruction to the designated device, wherein the build instruction operation is used to trigger the image file build, and the image file build instruction carries the image file version identifier and the target script identifier.

[0052] When building an image file, configuration information corresponding to the image file can be entered through the script configuration interface of the continuous integration platform. In this embodiment, in response to the input operation detected through the script configuration interface of the continuous integration platform, the configuration information entered through the input operation can be obtained. Here, the configuration information may include device information for specifying the device that executes the pipeline task corresponding to the specified pipeline script, the image file version identifier of the source image file used for image building, and the target script identifier required for building the image file.

[0053] After the configuration information is entered, in response to the detected build instruction operation, an image file build command can be sent to the specified device. Here, the build instruction operation can be used to trigger the image file build. The image file build command can carry an image file version identifier and a target script identifier. Furthermore, the image file version identifier and target script identifier carried in the image file build command can be determined based on the aforementioned configuration information.

[0054] This embodiment simplifies the manual execution process in image file building by allowing users to input configuration information in the script configuration interface of the continuous integration platform to trigger image file building, thereby improving the efficiency of image file building.

[0055] In one exemplary embodiment, after exiting the runtime environment of the source image file, the updated source image file is compressed to obtain the target image file, including:

[0056] S31. After exiting the runtime environment of the source image file, the updated source image file is compressed according to the target image name indicated by the image file building instruction to obtain the target image file. The file name of the target image file is called the target image name.

[0057] To avoid confusion between the source and updated image files when compressing the updated source image file, after exiting the source image file's runtime environment, the updated source image file can be compressed according to the target image name specified in the image file build instruction to obtain the target image file. That is, the compressed target image file should be named after the target image name.

[0058] In this embodiment, the updated source image file is compressed according to the target image name to obtain the target image file, which can improve the recognition efficiency of the target image file.

[0059] In one exemplary embodiment, after exiting the runtime environment of the source image file, the updated source image file is compressed to obtain the target image file, including:

[0060] S41. After exiting the runtime environment of the source image file, the root file system corresponding to the runtime environment of the source image file is compressed to obtain the target image file, wherein the root file system includes the updated source image file.

[0061] Since the root file system includes the directories and critical files necessary for Linux startup, compression can be performed directly on the root file system when compressing the image file. In this embodiment, after exiting the runtime environment of the source image file, the root file system corresponding to the runtime environment of the source image file may include the updated source image file. The aforementioned compression of the updated source image file can be performed on the root file system corresponding to the runtime environment of the source image file.

[0062] In this embodiment, by compressing the root file system corresponding to the runtime environment of the source image file to obtain the target image file, the compression efficiency can be improved.

[0063] In one exemplary embodiment, after performing the following build steps according to the pipeline task represented by the specified pipeline script to obtain the built image file, the above method further includes:

[0064] S51, through a preset message notification interface, a mirror file build response message is sent to a group chat robot in an instant messaging application. The group chat robot is a robot in the target group of the instant messaging application. The group chat robot sends the mirror file build response message to the object in the target group. The mirror file build response message is used to indicate the build result of the mirror file build using the target update script according to the pipeline task corresponding to the specified pipeline script.

[0065] To improve the timeliness of obtaining build results, in this embodiment, a pre-defined message notification interface can be used to send the image file build response message to a group chat bot in an instant messaging application. The group chat bot then forwards the image file build response message to objects in a target group. Here, the instant messaging application can be WeChat, and the group chat bot can be a bot in the target group of the instant messaging application. The target group may include objects related to the image file build (e.g., developers). The image file build response message can be used to indicate the build result of the image file build performed according to the pipeline task corresponding to the specified pipeline script using the target update script.

[0066] Optionally, the above-mentioned sending of the image file to the group chat robot in the instant messaging application via the preset message notification interface can be a task in the pipeline task represented by the specified pipeline script, which can be implemented by writing code associated with the instant messaging application in the specified pipeline script.

[0067] In this embodiment, the image building results are sent to the group chat robot in the instant messaging application through a preset message notification interface, eliminating the need for manual real-time monitoring of the image building results. This reduces labor costs and improves the timeliness of obtaining image results.

[0068] In one exemplary embodiment, after performing the following build steps according to the pipeline task represented by the specified pipeline script to obtain the built image file, the above method further includes:

[0069] S61, by calling the object storage interface of the target cloud storage server, uploads the target image file to the object storage space of the target cloud storage server for storage.

[0070] The constructed image file can be stored by calling the object storage interface of the target cloud storage server to upload the target image file to the object storage space of the target cloud storage server. Here, the object storage interface can be an interface for storing object data, the object data can be the image file, and the object storage interface can be an API interface. The target cloud storage server can be the Alibaba Cloud platform.

[0071] Alternatively, for a customized image, it can be downloaded, decompressed, and run manually from the object storage space, or the aforementioned continuous integration platform can be used to automatically execute pipeline tasks similar to those for obtaining the source image, thereby completing the automatic download, decompression, and running of the image from the object storage space.

[0072] This embodiment demonstrates how to reduce manual labor costs and improve image storage efficiency by calling the object storage interface of the target cloud storage server to complete the storage operation of the target image file.

[0073] The method for building image files in this application embodiment is explained below with reference to optional examples. In this optional example, the continuous integration platform is the Jenkins platform, the specified pipeline script is the Jenkins Pipeline script file, and the script hosting platform is the GitLab platform.

[0074] This optional example provides a method for automating the customization of an ARM-based Ubuntu operating system using GitLab and Jenkins. By writing a Jenkins Pipeline script file to define the code execution flow, the code (i.e., the image configuration script) is pulled from the GitLab management platform. Clicking "trigger" initiates the automated image customization process. This automates the operating system customization, reduces the difficulty of image customization, saves time, and improves efficiency. Simultaneously, it also enhances the efficiency of image installation, user workflows, and productivity.

[0075] like Figure 3 As shown, the process of building the image file in this optional example may include the following steps:

[0076] Step 1: Log in to the Jenkins platform, select Pipeline, and enter the pipeline task.

[0077] Step 2: Enter 3 parameters: source image version, image content update script name, and target image version (i.e., target image name).

[0078] Step 3: Jenkins begins building the target image.

[0079] The build process includes the following steps:

[0080] Print image customization information, that is, print out the name of the customized image and the name of the image content update script;

[0081] Log in to the machine where the image is customized and decompress the base image (i.e., the source image);

[0082] After the image is decompressed, enter the chroot environment of that image;

[0083] Based on the input image custom script name, pull the corresponding custom script from the GitLab platform;

[0084] Execute the script to update the image content;

[0085] Exit the chroot environment of this image;

[0086] Reconfigure and compress the root file system to generate a custom image based on the input custom image name.

[0087] Step 4: Send a notification message about the build results.

[0088] Step 5: Upload the target image to Alibaba Cloud Object Storage.

[0089] This optional example can shorten the time required for custom image creation, reduce the difficulty of customizing Ubuntu images for ARM architecture, and improve work and production efficiency. At the same time, since some software installations, upgrades, and system parameter configurations can be pre-set in the custom image, users do not need to manually configure the customized content in the image, thus achieving out-of-the-box usability to a certain extent and improving user work efficiency.

[0090] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0091] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM (Read-Only Memory) / RAM (Random Access Memory), magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.

[0092] According to another aspect of the embodiments of this application, an apparatus for building an image file for implementing the above-described image file building method is also provided, and the image file building apparatus can be applied to a smart device. Figure 4 This is a structural block diagram of an optional image file building apparatus according to an embodiment of this application, such as... Figure 4As shown, the device may include:

[0093] The receiving unit 402 is used to receive an image file building instruction through a specified device in the continuous integration platform, wherein the image file building instruction is used to instruct the image file to be built using the target update script according to the pipeline task corresponding to the specified pipeline script;

[0094] Execution unit 404, connected to receiving unit 402, is used to respond to image file build instructions and execute the following build steps according to the pipeline task corresponding to the specified pipeline script to obtain the built image file:

[0095] Execute the target update script in the runtime environment of the source image file to update the source image file in the runtime environment of the source image file. The source image file is the image file of the specified operating system, and the target update script is the update script obtained by the continuous integration platform from the script hosting platform.

[0096] After exiting the runtime environment of the source image file, the updated source image file is compressed to obtain the target image file.

[0097] It should be noted that the receiving unit 402 in this embodiment can be used to perform the above step S202, and the execution unit 404 in this embodiment can be used to perform the above step S204.

[0098] Through the aforementioned module, an image file build instruction is received from a designated device within the continuous integration platform. This instruction instructs the use of a target update script to build the image file according to the pipeline task corresponding to the specified pipeline script. In response to the image file build instruction, the following build steps are executed according to the pipeline task corresponding to the specified pipeline script to obtain the built image file: The target update script is executed within the runtime environment of the source image file to update the source image file within that environment. Here, the source image file is an image file of the specified operating system, and the target update script is an update script obtained by the continuous integration platform from a script hosting platform. After exiting the runtime environment of the source image file, the updated source image file is compressed to obtain the target image file. This improves the efficiency of image file construction, addressing the issue of low efficiency in existing image file building methods due to the need for manual execution.

[0099] In one exemplary embodiment, the above-described apparatus further includes:

[0100] The extraction unit is used to extract the image file version identifier and the target script identifier from the image file build instruction after receiving the image file build instruction through a specified device in the continuous integration platform. The image file version identifier is used to identify the file version of the source image file used to build the image file, and the target script identifier is used to identify the update script used to build the image file.

[0101] The selection unit is used to select the image file that matches the file version identified by the image file version identifier from a set of image files, so as to obtain the source image file;

[0102] The pull unit is used to pull the update script that matches the target script identifier from the script hosting platform to obtain the target update script.

[0103] In one exemplary embodiment, the above-described apparatus further includes:

[0104] The acquisition unit is used to acquire configuration information input by the input operation detected by the script configuration interface of the continuous integration platform in response to the input operation detected by the input operation before receiving the image file build instruction through the specified device in the continuous integration platform. The configuration information includes device information for specifying the specified device for executing the pipeline task corresponding to the specified pipeline script, image file version identifier, and target script identifier.

[0105] The first sending unit is used to send an image file build instruction to a designated device in response to a detected build instruction operation. The build instruction operation is used to trigger the image file build, and the image file build instruction carries an image file version identifier and a target script identifier.

[0106] In one exemplary embodiment, the execution unit includes:

[0107] The first execution module is used to compress the updated source image file according to the target image name indicated by the image file building instruction after exiting the runtime environment of the source image file, so as to obtain the target image file. The file name of the target image file is called the target image name.

[0108] In one exemplary embodiment, the execution unit includes:

[0109] The first execution module is used to compress the root file system corresponding to the runtime environment of the source image file after exiting the runtime environment of the source image file to obtain the target image file, wherein the root file system includes the updated source image file.

[0110] In one exemplary embodiment, the above-described apparatus further includes:

[0111] The second sending unit is used to send an image file build response message to a group chat robot in an instant messaging application through a preset message notification interface after the following build steps are performed according to the pipeline task represented by the specified pipeline script to obtain the built image file. The group chat robot is a robot in the target group of the instant messaging application, so that the group chat robot can send the image file build response message to the object in the target group. The image file build response message is used to indicate the build result of building the image file according to the pipeline task corresponding to the specified pipeline script using the target update script.

[0112] In one exemplary embodiment, the above-described apparatus further includes:

[0113] The upload unit is used to perform the following build steps according to the pipeline task represented by the specified pipeline script, and after obtaining the built image file, upload the target image file to the object storage space of the target cloud storage server for storage by calling the object storage interface of the target cloud storage server.

[0114] It should be noted that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the content disclosed in the above embodiments. It should also be noted that the above modules, as part of a device, can operate in environments such as... Figure 1 The hardware environment shown can be implemented through software or hardware, and the hardware environment includes the network environment.

[0115] According to another aspect of the embodiments of this application, a storage medium is also provided, which can be located on a smart device. Optionally, in this embodiment, the storage medium can be used to execute program code for the method of constructing any of the image files described in the embodiments of this application.

[0116] Optionally, in this embodiment, the storage medium may be located on at least one of the network devices in the network shown in the above embodiment.

[0117] Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps:

[0118] S1, receive image file build instructions through a specified device in the continuous integration platform. The image file build instructions are used to instruct the image file to be built using the target update script according to the pipeline task corresponding to the specified pipeline script.

[0119] S2, in response to the image file build command, executes the following build steps according to the pipeline task corresponding to the specified pipeline script to obtain the built image file:

[0120] Execute the target update script in the runtime environment of the source image file to update the source image file in the runtime environment of the source image file. The source image file is the image file of the specified operating system, and the target update script is the update script obtained by the continuous integration platform from the script hosting platform.

[0121] After exiting the runtime environment of the source image file, the updated source image file is compressed to obtain the target image file.

[0122] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments, and will not be repeated in this embodiment.

[0123] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, ROMs, RAMs, portable hard drives, magnetic disks, or optical disks.

[0124] According to another aspect of the embodiments of this application, an electronic device for implementing the above-described method for constructing an image file is also provided. The electronic device may be a smart device, a server, a terminal, or a combination thereof.

[0125] Figure 5 This is a structural block diagram of an optional electronic device according to an embodiment of this application, such as... Figure 5 As shown, it includes a processor 502, a communication interface 504, a memory 506, and a communication bus 508. The processor 502, communication interface 504, and memory 506 communicate with each other via the communication bus 508.

[0126] Memory 506 is used to store computer programs;

[0127] When processor 502 executes a computer program stored in memory 506, it performs the following steps:

[0128] S1, receive image file build instructions through a specified device in the continuous integration platform. The image file build instructions are used to instruct the image file to be built using the target update script according to the pipeline task corresponding to the specified pipeline script.

[0129] S2, in response to the image file build command, executes the following build steps according to the pipeline task corresponding to the specified pipeline script to obtain the built image file:

[0130] Execute the target update script in the runtime environment of the source image file to update the source image file in the runtime environment of the source image file. The source image file is the image file of the specified operating system, and the target update script is the update script obtained by the continuous integration platform from the script hosting platform.

[0131] After exiting the runtime environment of the source image file, the updated source image file is compressed to obtain the target image file.

[0132] Optionally, the communication bus can be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 The symbol is represented by a single thick line, but this does not indicate that there is only one bus or one type of bus. The communication interface is used for communication between the aforementioned electronic device and other devices.

[0133] The memory may include RAM, or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0134] As an example, the memory 506 described above may include, but is not limited to, the receiving unit 402 and the execution unit 404 in the resource information pushing device. Furthermore, it may include, but is not limited to, other module units in the resource information pushing device, which will not be elaborated upon in this example.

[0135] The processors mentioned above can be general-purpose processors, including but not limited to: CPU (Central Processing Unit), NP (Network Processor), etc.; they can also be DSP (Digital Signal Processor), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0136] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments, and will not be repeated here.

[0137] Those skilled in the art will understand that Figure 5The structure shown is for illustrative purposes only. The device that implements the above method for building image files can be a terminal device, such as a smartphone (e.g., Android phone, iOS phone), tablet computer, PDA, mobile Internet Devices (MID), PAD, etc. Figure 5 This does not limit the structure of the aforementioned electronic device. For example, the electronic device may also include components that are more... Figure 5 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 5 The different configurations shown.

[0138] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, ROM, RAM, disk or optical disk, etc.

[0139] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0140] If the integrated units in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in the aforementioned computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.

[0141] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0142] In the several embodiments provided in this application, it should be understood that the disclosed client can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between units or modules, and may be electrical or other forms.

[0143] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the solution provided in this embodiment, depending on actual needs.

[0144] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or at least two units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0145] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method for constructing an image file, characterized in that, include: Receive image file build instructions through a designated device in the continuous integration platform, wherein the image file build instructions are used to instruct the image file to be built using the target update script according to the pipeline task corresponding to the designated pipeline script; In response to the image file build instruction, the following build steps are executed according to the pipeline task corresponding to the specified pipeline script to obtain the built image file: The target update script is executed in the runtime environment of the source image file to update the source image file in the runtime environment of the source image file, wherein the source image file is an image file of a specified operating system, and the target update script is an update script obtained by the continuous integration platform from the script hosting platform; After exiting the runtime environment of the source image file, the updated source image file is compressed to obtain the target image file; The source image file runs in a virtual environment that changes the root directory referenced when the program is executed. This virtual environment is used to modify the running directories of the current process and its child processes.

2. The method according to claim 1, characterized in that, After receiving the image file build instruction via a designated device in the continuous integration platform, the method further includes: The image file version identifier and the target script identifier are extracted from the image file build instructions. The image file version identifier is used to identify the file version of the source image file used to build the image file, and the target script identifier is used to identify the update script used to build the image file. Based on the image file version identifier, select the image file that matches the file version identified by the image file version identifier from a group of image files to obtain the source image file; The target update script is obtained by pulling the update script that matches the target script identifier from the script hosting platform.

3. The method according to claim 2, characterized in that, Before receiving the image file build instruction via a designated device in the continuous integration platform, the method further includes: In response to an input operation detected through the script configuration interface of the continuous integration platform, configuration information input through the input operation is obtained, wherein the configuration information includes device information for specifying the specified device for executing the pipeline task corresponding to the specified pipeline script, the image file version identifier, and the target script identifier; In response to a detected build instruction operation, the image file build command is sent to the designated device, wherein the build instruction operation is used to trigger the image file build, and the image file build command carries the image file version identifier and the target script identifier.

4. The method according to claim 1, characterized in that, After exiting the runtime environment of the source image file, the updated source image file is compressed to obtain the target image file, including: After exiting the runtime environment of the source image file, the updated source image file is compressed according to the target image name indicated by the image file building instruction to obtain the target image file, wherein the file name of the target image file is called the target image name.

5. The method according to claim 1, characterized in that, After exiting the runtime environment of the source image file, the updated source image file is compressed to obtain the target image file, including: After exiting the runtime environment of the source image file, the root file system corresponding to the runtime environment of the source image file is compressed to obtain the target image file, wherein the root file system includes the updated source image file.

6. The method according to any one of claims 1 to 5, characterized in that, After the method executes the following build steps according to the pipeline task represented by the specified pipeline script to obtain the built image file, the method further includes: A mirror file build response message is sent to a group chat robot in an instant messaging application via a preset message notification interface. The group chat robot is a robot in a target group of the instant messaging application. The group chat robot sends the mirror file build response message to objects in the target group. The mirror file build response message is used to indicate the build result of building the mirror file using the target update script according to the pipeline task corresponding to the specified pipeline script.

7. The method according to any one of claims 1 to 5, characterized in that, After the method executes the following build steps according to the pipeline task represented by the specified pipeline script to obtain the built image file, the method further includes: By calling the object storage interface of the target cloud storage server, the target image file is uploaded to the object storage space of the target cloud storage server for storage.

8. An apparatus for building an image file, characterized in that, include: The receiving unit is configured to receive an image file building instruction through a specified device in the continuous integration platform, wherein the image file building instruction is configured to instruct the image file to be built using a target update script according to the pipeline task corresponding to the specified pipeline script; An execution unit, in response to the image file build instruction, performs the following build steps according to the pipeline task corresponding to the specified pipeline script to obtain the built image file: The target update script is executed in the runtime environment of the source image file to update the source image file in the runtime environment of the source image file, wherein the source image file is an image file of a specified operating system, and the target update script is an update script obtained by the continuous integration platform from the script hosting platform; After exiting the runtime environment of the source image file, the updated source image file is compressed to obtain the target image file; The source image file runs in a virtual environment that changes the root directory referenced when the program is executed. This virtual environment is used to modify the running directories of the current process and its child processes.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the method of any one of claims 1 to 7.

10. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method of any one of claims 1 to 7 through the computer program.

Citation Information

Patent Citations

  • Container mirror image construction method and device, storage medium and electronic device

    CN114675928A

  • Mirror image file generation method and device of operating system and computer equipment

    CN115344275A