CN111552508A - Application program version construction method and device and electronic equipment - Google Patents

Application program version construction method and device and electronic equipment Download PDF

Info

Publication number
CN111552508A
CN111552508A CN202010357876.7A CN202010357876A CN111552508A CN 111552508 A CN111552508 A CN 111552508A CN 202010357876 A CN202010357876 A CN 202010357876A CN 111552508 A CN111552508 A CN 111552508A
Authority
CN
China
Prior art keywords
container
version
compiling
application program
target application
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010357876.7A
Other languages
Chinese (zh)
Other versions
CN111552508B (en
Inventor
陈军
高昕羽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Dt Dream Technology Co Ltd
Original Assignee
Hangzhou Dt Dream Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Dt Dream Technology Co Ltd filed Critical Hangzhou Dt Dream Technology Co Ltd
Priority to CN202010357876.7A priority Critical patent/CN111552508B/en
Publication of CN111552508A publication Critical patent/CN111552508A/en
Application granted granted Critical
Publication of CN111552508B publication Critical patent/CN111552508B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

An application program version construction method and device, electronic equipment and a machine-readable storage medium are disclosed. In the application, version construction parameters which are input by a user on a visual interface and are related to a target application program are obtained; when detecting that the code of a target application program is changed, creating a version construction task which corresponds to the target application program and carries the version construction parameters; scheduling the version construction task to a node in a container cluster for operation, and generating a cache container for version construction in the node; the cache container is used for caching intermediate data in the version construction process; creating and starting a compiling container for version construction in the cache container, and transmitting the version construction parameters to the compiling container, so that the compiling container generates an application image containing the version of the target application program based on the version construction parameters and the intermediate data construction.

Description

Application program version construction method and device and electronic equipment
Technical Field
One or more embodiments of the present application relate to the field of computer application technologies, and in particular, to a method and an apparatus for constructing an application version, an electronic device, and a machine-readable storage medium.
Background
The continuous integration means that partial codes developed by multiple workers for multiple times in the application program are integrated together to form a backbone code of multiple versions of the application program, and the application program which can be deployed and released is provided by constructing, compiling and testing in an automatic mode through a continuous integration tool. The goal of persistent integration is to allow for rapid iterations of version development and deployment of applications while maintaining high quality.
Disclosure of Invention
The application provides an application program version construction method, which comprises the following steps:
acquiring a version construction parameter which is input by a user on a visual interface and is related to a target application program;
when detecting that the code of a target application program is changed, creating a version construction task which corresponds to the target application program and carries the version construction parameters; wherein the version construction task is used for constructing a version of the target application program of the changed code;
scheduling the version construction task to a node in a container cluster for operation, and generating a cache container for version construction in the node; the cache container is used for caching intermediate data in the version construction process;
creating and starting a compiling container for version construction in the cache container, and transmitting the version construction parameters to the compiling container, so that the compiling container generates an application image containing the version of the target application program based on the version construction parameters and the intermediate data construction.
Optionally, before creating the version building task carrying the version building parameters corresponding to the target application program, the method further includes:
checking whether a code version branch corresponding to the changed code and merged into the target application program is in a state of allowing execution of construction;
if so, further creating a version construction task which is corresponding to the target application program and carries the version construction parameters; otherwise, version build task creation is prohibited.
Optionally, the generating the cache container for version building in the node includes:
and taking the first container mirror image as a template, generating a first container instance of the first container mirror image in the node, and taking the first container instance as a cache container for version construction.
Optionally, the version building parameters further include a second container image for generating the compilation container, a compilation environment for compiling code of a target application, and a compilation script;
the creating and starting a compiling container for version construction in the cache container and transmitting the version construction parameters to the compiling container comprises the following steps:
taking the second container mirror image as a template, generating a second container instance of the second container mirror image in the cache container, and taking the second container instance as a compiling container for version construction;
and after the compiling container is started to run, transmitting the compiling environment and the compiling script in the version construction parameters as parameters to the compiling container which is started to run.
Optionally, the version construction parameter further includes a code obtaining address of the target application program, and further includes:
and the compiling container acquires the code of the target application program from a code warehouse corresponding to the code acquisition address, and executes version compiling on the code based on the compiling environment and the compiling script in the transmitted version construction parameters to generate the version of the corresponding target application program.
Optionally, the version building parameter further includes a third container image as a running environment of the target application program, and further includes:
initiating a third container instance that is templated by the third container image;
the compiling container deploys the generated version of the target application program into the third container instance and generates an application image of which the third container instance is used as a template;
generating an application mirror image label corresponding to the application mirror image; the application image label at least comprises a code version branch label corresponding to the target application program and a code submission label of the target application program.
Optionally, the method further includes:
the cache container pre-caches intermediate data required in the process of generating the version of the target application program by the compiling container in a first cache directory local to the cache container, so that the compiling container mounts the first cache directory to a second cache directory local to the compiling container based on the environment variable transmitted by the cache container and is used for generating the version of the target application program.
Optionally, the intermediate data at least includes container mirror image and version compilation dependent data.
Optionally, the intermediate data further includes compiled intermediate product data of a version compiling process; in the process of generating the version of the target application program by the compiling container, the method further comprises the following steps:
and the compiling container stores the compiling intermediate product data into a first cache directory in the cache container for caching.
Optionally, the container cluster is a Docker container cluster based on kubernets management.
Optionally, the cache container and the compilation container are both Docker containers.
The present application further provides an application version building apparatus, the apparatus including:
the acquisition module is used for acquiring the version construction parameters which are input by a user on a visual interface and are related to the target application program;
the creating module is used for creating a version building task which carries the version building parameters and corresponds to the target application program when detecting that the code of the target application program is changed; wherein the version construction task is used for constructing a version of the target application program of the changed code;
the generation module is used for scheduling the version construction task to a node in a container cluster for operation and generating a cache container for version construction in the node; the cache container is used for caching intermediate data in the version construction process;
and the construction module is used for creating and starting a compiling container for version construction in the cache container, and transmitting the version construction parameters to the compiling container so that the compiling container constructs and generates an application image containing the version of the target application program based on the version construction parameters and the intermediate data.
Optionally, before creating the version building task carrying the version building parameters corresponding to the target application program, the method further includes:
the checking module is used for checking whether a code version branch corresponding to the changed code and merged into the target application program is in a state of allowing execution and construction;
if so, further creating a version construction task which is corresponding to the target application program and carries the version construction parameters; otherwise, version build task creation is prohibited.
Optionally, the version construction parameter includes a first container image for generating the cache container, and the generating module further:
and taking the first container mirror image as a template, generating a first container instance of the first container mirror image in the node, and taking the first container instance as a cache container for version construction.
Optionally, the version building parameters further include a second container image for generating the compilation container, a compilation environment for compiling code of a target application, and a compilation script;
the building module further:
taking the second container mirror image as a template, generating a second container instance of the second container mirror image in the cache container, and taking the second container instance as a compiling container for version construction;
and after the compiling container is started to run, transmitting the compiling environment and the compiling script in the version construction parameters as parameters to the compiling container which is started to run.
Optionally, the version construction parameter further includes a code obtaining address of the target application program, and the construction module further:
and the compiling container acquires the code of the target application program from a code warehouse corresponding to the code acquisition address, and executes version compiling on the code based on the compiling environment and the compiling script in the transmitted version construction parameters to generate the version of the corresponding target application program.
Optionally, the version build parameter further includes a third container image as a running environment of the target application, and the build module further:
initiating a third container instance that is templated by the third container image;
the compiling container deploys the generated version of the target application program into the third container instance and generates an application image of which the third container instance is used as a template;
generating an application mirror image label corresponding to the application mirror image; the application image label at least comprises a code version branch label corresponding to the target application program and a code submission label of the target application program.
Optionally, the method further includes:
the cache module is used for caching intermediate data required in the process of generating the version of the target application program by the compiling container in a first cache directory local to the cache container in advance, so that the compiling container mounts the first cache directory to a second cache directory local to the compiling container based on the environment variable transmitted by the cache container and is used for generating the version of the target application program.
Optionally, the intermediate data at least includes container mirror image and version compilation dependent data.
Optionally, the intermediate data further includes compiled intermediate product data of a version compiling process; in the process of generating the version of the target application program by the compiling container, the cache module further:
and the compiling container stores the compiling intermediate product data into a first cache directory in the cache container for caching.
Optionally, the container cluster is a Docker container cluster based on kubernets management.
Optionally, the cache container and the compilation container are both Docker containers.
The application also provides an electronic device, which comprises a communication interface, a processor, a memory and a bus, wherein the communication interface, the processor and the memory are mutually connected through the bus;
the memory stores machine-readable instructions, and the processor executes the method by calling the machine-readable instructions.
Through the embodiment, the version construction parameters related to the target application program are templated and provided for the user to construct the version in a visual interface mode, a multi-level container is constructed and created in the container cluster to construct the version and intermediate data cache in the version construction process, and the application image containing the version of the target application program is generated. On one hand, the learning cost of the developer for version construction is reduced, and the version development efficiency is improved; on the other hand, the isolation of concurrent construction of the versions is ensured, and meanwhile, due to the fact that intermediate data in the version construction process are cached, the dependence of downloading construction again in each version construction is avoided, and the version construction efficiency is improved.
Drawings
FIG. 1 is a flow chart of a method for application version construction provided by an exemplary embodiment;
FIG. 2 is an architectural diagram of a version built multi-level container nesting provided by an exemplary embodiment;
FIG. 3 is a hardware block diagram of an electronic device provided by an exemplary embodiment;
fig. 4 is a block diagram of an application version building apparatus according to an exemplary embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
In order to make those skilled in the art better understand the technical solution in the embodiment of the present specification, the following briefly describes the related art of application version construction related to the embodiment of the present specification.
The traditional continuous integration is usually realized based on continuous integration tools such as Jenkins and the like, and when the continuous integration tools are used for version construction, the problems of complex configuration modes (such as manual downloading, installation and configuration of corresponding compiling scripts and compiling tools for different language frameworks), poor expandability of the version construction deployment on physical nodes, poor isolation of concurrent construction of multiple versions on a single physical node and potential safety hazards of code residue generally exist.
Based on the technical scheme, the version construction task is scheduled to the multi-level nested container of the container cluster node for version construction, and the intermediate data in the version construction process is cached, so that the application image containing the version of the target application program is generated.
During implementation, the version construction system acquires version construction parameters which are input by a user on a visual interface and are related to a target application program; when detecting that the code of the target application program is changed, creating a version construction task which corresponds to the target application program and carries the version construction parameters; the version construction task is used for constructing the version of the target application program of the changed code.
Further, scheduling the version construction task to a node in a container cluster for operation, and generating a cache container for version construction in the node; the cache container is used for caching intermediate data in the version construction process; and creating and starting a compiling container for version construction in the cache container, and transmitting the version construction parameters to the compiling container, so that the compiling container constructs and generates an application image containing the version of the target application program based on the version construction parameters and the intermediate data.
In the scheme, the version construction parameters related to the target application program are templated and provided for a user in a visual interface mode for version construction, a multi-level container is constructed and created in the container cluster for version construction, and intermediate data caching is performed in the version construction process, so that the application image containing the version of the target application program is generated. On one hand, the learning cost of the developer for version construction is reduced, and the version development efficiency is improved; on the other hand, the isolation of concurrent construction of the versions is ensured, meanwhile, due to the intermediate data caching in the version construction process, the dependence of re-downloading construction for each version construction is avoided, and the version construction efficiency is improved.
The present application is described below with reference to specific embodiments and specific application scenarios.
Referring to fig. 1, fig. 1 is a flowchart of an application version construction method applied to a version construction system according to an embodiment of the present application, where the method performs the following steps:
and 102, acquiring a version construction parameter which is input by a user on a visual interface and is related to the target application program.
104, when detecting that the code of the target application program is changed, creating a version construction task which corresponds to the target application program and carries the version construction parameters; wherein the version construction task is used for constructing the version of the target application program of the changed code.
Step 106, scheduling the version construction task to a node in a container cluster for operation, and generating a cache container for version construction in the node; the cache container is used for caching the intermediate data in the version construction process.
Step 108, creating and starting a compiling container for version construction in the cache container, and transmitting the version construction parameters to the compiling container, so that the compiling container constructs and generates an application image containing the version of the target application program based on the version construction parameters and the intermediate data.
In this specification, the target application may include an application developed based on any programming language and its associated framework.
For example, in practical applications, the target application may specifically be a Java application based on different JDK (Java development kit) frameworks and developed based on Java language. The target application program can also be a NET application program developed based on a NET language and based on different NET Framework 4.0 development frameworks.
In this specification, the version construction system refers to a node or a node cluster for performing version construction on a code of the target application program to generate different versions of the target application program;
the node may be a single physical node in a cluster built by a plurality of physical machines, or a single virtual machine node in a cluster built by a plurality of virtual machines
For example, in practical applications, the version construction system may be specifically constructed Based on several server hardware, or may be constructed Based on several KVM (Kernel-Based Virtual Machines) Virtual Machines.
It should be noted that, when the version building system is built on the basis of a virtual machine node, a virtual machine cluster management architecture (for example, an Openstack architecture) may be used to perform dynamic elastic expansion on the virtual machine node.
In this specification, the container cluster refers to a cluster included in the version construction system and used for container management.
In one embodiment, the container cluster is a Docker container cluster managed based on kubernets (container orchestration engine, supporting automated deployment, large-scale scalable, application containerization management); the container cluster may be specifically deployed on a physical node or a virtual machine node of the version building system.
It should be noted that, the container cluster may manage other containers besides the Docker container, for example: LXC Container (Linux Container).
In the present specification, the version construction parameters described above include any parameters related to the construction of the target program described above. For example, in practical applications, the version building parameters may specifically include information such as code, code branches, a compiling environment, and a compiling script related to the object program.
In this specification, the version construction system may output a visual interface to a user (e.g., a developer, a version manager, a tester, etc. of the target program), so that the user may select the version construction parameters for constructing the target application program on the visual interface without being familiar with a continuous integration tool and performing complex configuration (e.g., requiring manual downloading, installation, and configuration of corresponding compilation scripts and tools for different language frameworks), thereby reducing the learning cost of the developer in performing version construction and improving the version development efficiency.
In this specification, after acquiring the version construction parameter related to the target application program, which is input by a user on a visual interface, the version construction system may perform version construction of the target application program based on the version construction parameter.
In this specification, the version construction system may detect whether the code of the target application program submitted by the user has changed based on a code repository service included in the version construction system.
In an embodiment shown in the present disclosure, when it is monitored that a code of the target application program is changed, the version construction system may further check whether a code version branch incorporated into the target application program corresponding to the changed code is in a state allowing construction, and if so, further create a version construction task corresponding to the target application program and carrying the version construction parameters; otherwise, version build task creation is prohibited.
For example, in practical applications, if a code version branch incorporated corresponding to a code of the target application program fails to pass the automatic test verification, the version construction system may obtain a failure result of the automatic test verification of the code version branch, so as to determine that the code version branch is in the execution prohibition construction state according to the failure result; and when the code version branch corresponding to the code of the target application program passes the automatic test verification, the version construction system can obtain the successful result of the automatic test verification of the code version branch, so that the code version branch is determined to be in the state of allowing execution of construction according to the successful result.
In this specification, the compilation container is a container for compiling a code of the target application program and generating an application image including a version of the target application program. For example, in one illustrated embodiment, the compilation container is a Docker container.
In this specification, the cache container refers to a container for caching intermediate data in the compilation container execution version building process. For example, in an illustrated embodiment, the cache container is a Docker container, and the Docker container is used for caching intermediate data in the version building process performed by the compilation container.
In this specification, the intermediate data refers to a compilation dependent tool, a container mirror, and the like, which are required by the compilation container in the version construction process of the target application program and are other than the code of the target application program.
In this specification, after determining that the modified code corresponding to the incorporated code version branch of the target application program is in the execution permission construction state, the version construction system creates a version construction task corresponding to the target application program and carrying the version construction parameters; wherein the version construction task is used for constructing a version of the target application program of the changed code.
In this specification, further, the version construction system may schedule the version construction task to a node in the container cluster for operation, and generate a cache container for version construction in the node;
for example, the version building system may schedule a version building task to run on a virtual machine node in a Docker container cluster based on Kubernetes management in a Job b manner, and generate the cache container on the virtual machine node.
It should be noted that, the version construction task is implemented based on the Job mode, and the version construction task is automatically exited after Job is completed, so that it can be ensured that the construction environment created by the task is automatically destroyed after the construction task is completed each time, and sensitive information such as codes and the like is not retained.
In an embodiment shown, the version construction parameter includes a first container image for generating the cache container, and in the process of generating the cache container in the node, the version construction system may use the first container image as a template, generate a first container instance of the first container image in the node, and use the first container instance as the cache container for version construction.
For example, in an actual application, the version construction parameter includes a linux container image (a first container image) used for generating the cache container, and the version construction system may generate a linux container instance of the linux container image in the node as the cache container used for the version construction by using the first container image as a template.
In this specification, after the cache container is generated, the version construction system creates and starts the compiling container for version construction in the cache container.
In an embodiment shown, the version building parameter includes, in addition to the first container image, a second container image for generating the compilation container, a compilation environment for compiling code of a target application, and a compilation script, and the version building system uses the second container image as a template, generates a second container instance of the second container image in the cache container, and uses the second container instance as a compilation container for version building.
Continuing the example from the above example, the version construction parameter includes a JDK container image (second container image) used for generating the above compilation container, and after the version construction system generates a linux container instance as the above cache container, the version construction system generates the second container instance of the JDK container image in the linux container, and uses the JDK container image instance as the above compilation container used for version construction.
It should be noted that, in the above-mentioned cache container, a plurality of above-mentioned compiling containers corresponding to different programming languages, dependent frameworks, and tool versions for constructing the above-mentioned target program version may be created.
For example, taking the target program version as JAVA application, if there are multiple versions of 1.4 and 1.6 corresponding to JDK versions, two compiling containers corresponding to JDK1.4 and JDK1.6 may be created in the cache container.
For another example, if the target program version can be developed based on JAVA language or C + + language, a compilation container corresponding to a framework dependent on JAVA language and a JAVA compilation tool, or a compilation container corresponding to a framework dependent on C + + language and a C + + compilation tool may be created in the cache container.
In this specification, after the compilation container is generated, the cache container may transmit the compilation environment and the compilation script for compiling the code of the target application program in the version construction parameter to the compilation container, so that the compilation container constructs an application image including the version of the target application program based on the version construction parameter and the intermediate data.
For example, in the case that the target program version is developed based on JAVA language, the cache container may transfer a JAVA compilation environment (e.g., JDK1.8) and a compilation script (e.g., a maven compilation script, such as mvn clean package-dskips test) in a version construction parameter for compiling a code of a target application into the compilation container, so that the compilation container constructs an application image including the version of the target application based on the version construction parameter and the intermediate data.
In an embodiment, the version construction parameter further includes a code obtaining address of the target application program, in addition to the first container image, the second container image for generating the compilation container, a compilation environment for compiling a code of the target application program, and a compilation script, and the compilation container obtains the code of the target application program from a code repository corresponding to the code obtaining address, and performs version compilation on the code based on the compilation environment and the compilation script in the version construction parameter, so as to generate a version of the corresponding target application program.
For example, the version building parameter includes a code obtaining address of the target application program, in addition to the first container image, the second container image for generating the compiling container, the compiling environment for compiling a code of the target application program, and the compiling script; the compiling container obtains the code of the target application program from the code warehouse corresponding to the code obtaining address, and based on the compiling environment and the compiling script in the version construction parameter, performs version compiling on the code to generate the version of the corresponding target application program.
It should be noted that the code repository specifically may include a github code repository, an svn code repository, a cvs code repository, and the like, the code repository may be specifically deployed in a private network or a public network, and a specific type and a deployment manner of the code repository are not specifically limited in this specification.
In an illustrated embodiment, the version construction parameter further includes a third container image serving as a running environment of the target application program in addition to the first container image, the second container image used for generating the compilation container, the compilation environment and the compilation script used for compiling a code of the target application program, and the code acquisition address of the target application program, the compilation container starts a third container instance using the third container image as a template, deploys a generated version of the target application program into the third container instance, and generates an application image using the third container instance as a template; generating an application mirror image label corresponding to the application mirror image; the application image label at least comprises a code version branch label corresponding to the target application program and a code submission label of the target application program.
For example, the version build parameter includes a third container image that is an operating environment of the target application program, in addition to the first container image, the second container image used for generating the compilation container, the compilation environment and the compilation script used for compiling a code of the target application program, and the code acquisition address of the target application program; the third container image may specifically include a running environment to be deployed by the target application, such as: the target application is a JAVA program, and the third container image may be a container image based on a linux container including a JAVA program execution environment JRE. The compiling container starts a linux container instance taking a container mirror image of the linux container as a template, deploys a generated JAVA program version to the linux container instance, generates an application mirror image taking the linux container instance as the template, and simultaneously generates an application mirror image label corresponding to the application mirror image; the application image label at least comprises a code version branch label corresponding to the JAVA program and a code submission label of the JAVA program.
It should be noted that the code version branch tag refers to an identifier of a code version branch corresponding to the target application program, and the code version branch tag is recorded in the application mirror image tag, so that a user can clearly distinguish a code incorporation version of the target application program, for example: a mainline version or a branch version. The code submitting tag is a modification identifier corresponding to a modification code submitted by the target application program developer, and the modification identifier is also commonly referred to as commit, and the code submitting tag is recorded in the application mirror image tag, so that a user can conveniently determine information such as specific content, reason, time, modifier and the like of code modification, and the user can conveniently backtrack the version.
Certainly, in an actual application, the application image tag may further include, in addition to the code version branch tag and the code submission tag, an operating system type (e.g., linux and detailed linux release version), a container engine version (e.g., Docker version), a running hardware architecture (e.g., AMD architecture, Intel architecture, various embedded architectures), and an image digest (a hash value calculated by the application image through a hash algorithm) of the application image.
In one embodiment, in the process of creating the application image including the version of the target application program by the compiling container based on the version creating parameter and the intermediate data, the cache container pre-caches intermediate data required in the process of creating the version of the target application program by the compiling container in a first cache directory local to the cache container so that the compiling container creates the version of the target application program by mounting the first cache directory in a second cache directory local to the compiling container based on an environment variable transferred by the cache container; the intermediate data at least comprises container mirror images and version compiling dependent data.
For example, taking the target application program as an example of a JAVA program based on JRE1.8 to be deployed and run in a linux system, the cache container pre-caches intermediate data such as a linux container mirror image, a JRE1.8 installation package dependent on version compilation, and other compilation dependent tools required in the process of generating a JAVA program version by the compilation container under a first cache directory local to the cache container, and transmits the first cache directory to the compilation container in a shell environment variable manner, the compilation container may obtain information of the first cache directory local to the cache container based on an environment variable transmitted by the cache container, and mount the first cache directory under a second cache directory local to the compilation container based on a container load command, so that the compilation container may remotely access the intermediate data under the first cache directory, and copying the intermediate data to the local compiling container for executing the version compiling of the target application program.
It should be noted that, by caching the intermediate data required in the process of generating the version of the target application program by the compiling container in the first cache directory local to the caching container in advance based on the caching container, the construction dependency needs to be repeatedly downloaded each time the version of the target application program is constructed in the compiling container, and the construction efficiency of the target application program is improved.
In an embodiment shown in the above, the intermediate data may include, in addition to a container image and version compilation dependent data, compilation intermediate data of the compilation container in a version compilation process, and in a process of creating, by the compilation container, the application image including the version of the target application program, the compilation container may store the compilation intermediate data in a first cache directory in the cache container for caching.
Continuing the example above, the compilation container described above may compile compiled intermediate data of a JAVA program, such as: and compiling byte codes of related JAVA libraries in the JAVA program, and storing the byte codes into a first cache directory in the cache container for caching.
It should be noted that, based on the compiling container, the compiling intermediate product data may be stored in the first cache directory in the cache container for caching, so that repeated compiling of dependent class libraries during multiple versions of the target application program are reduced, and the efficiency of constructing the target application program is improved.
To facilitate understanding of the relationship of the cache container and the compilation container. Referring to fig. 2, fig. 2 is a schematic diagram of an architecture of multi-level container nesting of version construction according to an exemplary embodiment.
As shown in fig. 2, a cache container runs on a node in a container cluster, the cache container includes a data/build cache directory (a first cache directory), and a compiling container a triggered and created by a build task a and a compiling container B triggered and created by a build task B may be nested and run in the cache container; the compiling container a includes an/data/debug 1 directory (a second cache directory), the compiling container B includes an/data/debug 2 directory (a second cache directory), and the compiling container A, B may load the/data/debug cache directory in the cache container to the respective/data/debug 1 directory and/data/debug 2 directory in a directory mount manner, and obtain or store the intermediate data (for example, a container mirror image required to build the target program, general components such as version compiling dependency data, etc., a compiling intermediate product generated by building the target program, etc.).
As shown in fig. 2, compilation container A, B may concurrently perform version compilation of multiple target programs and their corresponding application image generation.
In this specification, after the compiling container base constructs and generates an application image including the version of the target application program, the compiling container may further upload the application image to an image repository for permanent storage.
In this specification, further, after the version construction task is completed, the version construction task executes an automatic destruction process, that is, the version construction system destroys the compiling container by using sensitive information such as codes in the compiling container, which is not retained.
In the technical scheme, the version construction parameters related to the target application program are templated and provided for a user in a visual interface mode for version construction, a multi-level container is constructed and created in the container cluster for version construction, and intermediate data cache in the version construction process is used for generating the application image containing the version of the target application program. On one hand, the learning cost of the developer for version construction is reduced, and the version development efficiency is improved; on the other hand, the isolation of concurrent construction of the versions is ensured, meanwhile, due to the data caching in the version construction process, the dependence of re-downloading construction for each version construction is avoided, and the version construction efficiency is improved.
Corresponding to the embodiment of the method, the application also provides an embodiment of an application program version constructing device.
Corresponding to the embodiment of the method, the specification also provides an embodiment of an application program version building device. The embodiment of the application version constructing apparatus of the present specification can be applied to an electronic device. The device embodiments may be implemented by software, or by hardware, or by a combination of hardware and software. Taking a software implementation as an example, as a logical device, the device is formed by reading, by a processor of the electronic device where the device is located, a corresponding computer program instruction in the nonvolatile memory into the memory for operation. From a hardware aspect, as shown in fig. 3, a hardware structure diagram of an electronic device in which an apparatus is located is constructed for an application version of this specification, except for the processor, the memory, the network interface, and the nonvolatile memory shown in fig. 3, the electronic device in which the apparatus is located in the embodiment may also include other hardware according to an actual function of the electronic device, which is not described again.
Fig. 4 is a block diagram of an application version building apparatus according to an exemplary embodiment of the present specification.
Referring to fig. 4, the application version building apparatus 40 can be applied in the electronic device shown in fig. 3, and the apparatus includes:
the obtaining module 401 obtains a version building parameter related to a target application program, which is input by a user on a visual interface;
a creating module 402, configured to create, when it is detected that a code of a target application program has changed, a version construction task corresponding to the target application program and carrying the version construction parameters; wherein the version construction task is used for constructing a version of the target application program of the changed code;
a generating module 403, configured to schedule the version construction task to a node in a container cluster for operation, and generate a cache container for version construction in the node; the cache container is used for caching intermediate data in the version construction process;
a building module 404, which creates and starts a compiling container for version building in the cache container, and transmits the version building parameters to the compiling container, so that the compiling container builds an application image containing the version of the target application program based on the version building parameters and the intermediate data.
In this embodiment, before creating the version building task corresponding to the target application program and carrying the version building parameters, the method further includes:
a checking module 405 (not shown in fig. 4) for checking whether a branch of the code version corresponding to the changed code incorporated into the target application program is in a state allowing execution of the build;
if so, further creating a version construction task which is corresponding to the target application program and carries the version construction parameters; otherwise, version build task creation is prohibited.
In this embodiment, the version construction parameter includes a first container image for generating the cache container, and the generating module 403 further:
and taking the first container mirror image as a template, generating a first container instance of the first container mirror image in the node, and taking the first container instance as a cache container for version construction.
In this embodiment, the version build parameters further include a second container image for generating the compilation container, a compilation environment for compiling code of a target application, and a compilation script;
the build module 404 further:
taking the second container mirror image as a template, generating a second container instance of the second container mirror image in the cache container, and taking the second container instance as a compiling container for version construction;
and after the compiling container is started to run, transmitting the compiling environment and the compiling script in the version construction parameters as parameters to the compiling container which is started to run.
In this embodiment, the version construction parameter further includes a code obtaining address of the target application, and the construction model 404 block further:
and the compiling container acquires the code of the target application program from a code warehouse corresponding to the code acquisition address, and executes version compiling on the code based on the compiling environment and the compiling script in the transmitted version construction parameters to generate the version of the corresponding target application program.
In this embodiment, the version build parameter further includes a third container image as a running environment of the target application, and the build module 404 further:
initiating a third container instance that is templated by the third container image;
the compiling container deploys the generated version of the target application program into the third container instance and generates an application image of which the third container instance is used as a template;
generating an application mirror image label corresponding to the application mirror image; the application image label at least comprises a code version branch label corresponding to the target application program and a code submission label of the target application program.
In this embodiment, the method further includes:
a caching module 406 (not shown in fig. 4), where the caching container pre-caches intermediate data required in the process of generating the version of the target application program by the compiling container in a first caching directory local to the caching container, so that the compiling container mounts the first caching directory to a second caching directory local to the compiling container based on an environment variable transferred by the caching container, and is used for generating the version of the target application program.
In this embodiment, the intermediate data at least includes container image, version compilation dependency data.
In this embodiment, the intermediate data further includes compiled intermediate data of a version compilation process; in the process of generating the version of the target application program by the compiling container, the cache module further:
and the compiling container stores the compiling intermediate product data into a first cache directory in the cache container for caching.
In this embodiment, the container cluster is a Docker container cluster based on kubernets management.
In this embodiment, the cache container and the compilation container are both Docker containers.
The apparatuses, modules or modules illustrated in the above embodiments may be implemented by a computer chip or an entity, or by an article with certain functions. A typical implementation device is a computer, which may take the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email messaging device, game console, tablet computer, wearable device, or a combination of any of these devices.
Other embodiments of the present disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This specification is intended to cover any variations, uses, or adaptations of the specification following, in general, the principles of the specification and including such departures from the present disclosure as come within known or customary practice within the art to which the specification pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the specification being indicated by the following claims.
It will be understood that the present description is not limited to the precise arrangements described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present description is limited only by the appended claims.
The above description is only a preferred embodiment of the present disclosure, and should not be taken as limiting the present disclosure, and any modifications, equivalents, improvements, etc. made within the spirit and principle of the present disclosure should be included in the scope of the present disclosure.

Claims (14)

1. A method of application version construction, the method comprising:
acquiring a version construction parameter which is input by a user on a visual interface and is related to a target application program;
when detecting that the code of a target application program is changed, creating a version construction task which corresponds to the target application program and carries the version construction parameters; wherein the version construction task is used for constructing a version of the target application program of the changed code;
scheduling the version construction task to a node in a container cluster for operation, and generating a cache container for version construction in the node; the cache container is used for caching intermediate data in the version construction process;
creating and starting a compiling container for version construction in the cache container, and transmitting the version construction parameters to the compiling container, so that the compiling container generates an application image containing the version of the target application program based on the version construction parameters and the intermediate data construction.
2. The method of claim 1, before creating the version build task corresponding to the target application program and carrying the version build parameters, further comprising:
checking whether a code version branch corresponding to the changed code and merged into the target application program is in a state of allowing execution of construction;
if so, further creating a version construction task which is corresponding to the target application program and carries the version construction parameters; otherwise, version build task creation is prohibited.
3. The method of claim 1, the versioning parameter comprising a first container image used to generate the cache container, the generating a cache container in the node for versioning comprising:
and taking the first container mirror image as a template, generating a first container instance of the first container mirror image in the node, and taking the first container instance as a cache container for version construction.
4. The method of claim 3, the version build parameters further comprising a second container image for generating the compilation container, a compilation environment for compiling code of a target application, and a compilation script;
the creating and starting a compiling container for version construction in the cache container and transmitting the version construction parameters to the compiling container comprises the following steps:
taking the second container mirror image as a template, generating a second container instance of the second container mirror image in the cache container, and taking the second container instance as a compiling container for version construction;
and after the compiling container is started to run, transmitting the compiling environment and the compiling script in the version construction parameters as parameters to the compiling container which is started to run.
5. The method of claim 4, the version build parameter further comprising a code acquisition address of a target application, further comprising:
and the compiling container acquires the code of the target application program from a code warehouse corresponding to the code acquisition address, and executes version compiling on the code based on the compiling environment and the compiling script in the transmitted version construction parameters to generate the version of the corresponding target application program.
6. The method of claim 5, the version build parameters further comprising a third container image that is a runtime environment of a target application, further comprising:
initiating a third container instance that is templated by the third container image;
the compiling container deploys the generated version of the target application program into the third container instance and generates an application image of which the third container instance is used as a template;
generating an application mirror image label corresponding to the application mirror image; the application image label at least comprises a code version branch label corresponding to the target application program and a code submission label of the target application program.
7. The method of claim 5, further comprising:
the cache container pre-caches intermediate data required in the process of generating the version of the target application program by the compiling container in a first cache directory local to the cache container, so that the compiling container mounts the first cache directory to a second cache directory local to the compiling container based on the environment variable transmitted by the cache container and is used for generating the version of the target application program.
8. The method of claim 7, the intermediate data comprising at least container mirror, version compilation dependent data.
9. The method of claim 8, the intermediate data further comprising compiled intermediate data of a versioning process; in the process of generating the version of the target application program by the compiling container, the method further comprises the following steps:
and the compiling container stores the compiling intermediate product data into a first cache directory in the cache container for caching.
10. The method of claim 1, the container cluster being a Docker container cluster based on Kubernets management.
11. The method of claim 1, the cache container and the compilation container each being a Docker container.
12. An application version building apparatus, the apparatus comprising:
the acquisition module is used for acquiring the version construction parameters which are input by a user on a visual interface and are related to the target application program;
the creating module is used for creating a version building task which carries the version building parameters and corresponds to the target application program when detecting that the code of the target application program is changed; wherein the version construction task is used for constructing a version of the target application program of the changed code;
the generation module is used for scheduling the version construction task to a node in a container cluster for operation and generating a cache container for version construction in the node; the cache container is used for caching intermediate data in the version construction process;
and the construction module is used for creating and starting a compiling container for version construction in the cache container, and transmitting the version construction parameters to the compiling container so that the compiling container constructs and generates an application image containing the version of the target application program based on the version construction parameters and the intermediate data.
13. An electronic device comprises a communication interface, a processor, a memory and a bus, wherein the communication interface, the processor and the memory are connected with each other through the bus;
the memory has stored therein machine-readable instructions, which the processor executes by calling the processor to perform the method of any one of claims 1 to 11.
14. A machine readable storage medium having stored thereon machine readable instructions which, when invoked and executed by a processor, carry out the method of any of claims 1 to 11.
CN202010357876.7A 2020-04-29 2020-04-29 Application program version construction method and device and electronic equipment Active CN111552508B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010357876.7A CN111552508B (en) 2020-04-29 2020-04-29 Application program version construction method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010357876.7A CN111552508B (en) 2020-04-29 2020-04-29 Application program version construction method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN111552508A true CN111552508A (en) 2020-08-18
CN111552508B CN111552508B (en) 2023-03-14

Family

ID=72006264

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010357876.7A Active CN111552508B (en) 2020-04-29 2020-04-29 Application program version construction method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN111552508B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112463123A (en) * 2020-11-25 2021-03-09 北京字跳网络技术有限公司 Task compiling method, device, network node, system and storage medium
CN112685035A (en) * 2020-12-25 2021-04-20 京东数字科技控股股份有限公司 Project development method and device, computer-readable storage medium and electronic device
CN113253887A (en) * 2021-06-11 2021-08-13 北京中祥英科技有限公司 Application issuing method, computer device and readable storage medium
CN113382049A (en) * 2021-05-31 2021-09-10 山东英信计算机技术有限公司 Management system and device of modular construction tool MBS
CN114064594A (en) * 2021-11-22 2022-02-18 马上消费金融股份有限公司 Data processing method and device
CN114661312A (en) * 2022-03-25 2022-06-24 江苏安超云软件有限公司 OpenStack cluster nested deployment method and system
WO2022142601A1 (en) * 2020-12-28 2022-07-07 京东科技控股股份有限公司 Application program construction method and apparatus, and computer device

Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102005032944A1 (en) * 2005-07-14 2007-01-18 Robert Bosch Gmbh Method and software system for configuring a modular system
US8032822B1 (en) * 2006-07-28 2011-10-04 Intuit Inc. Method and system for explaining dependencies on a document
US20140181800A1 (en) * 2012-12-14 2014-06-26 Telefonaktiebolaget L M Ericsson (Publ) Systems, methods, and computer program products for a software build and load process using a compilation and deployment service
US20160117162A1 (en) * 2014-07-07 2016-04-28 Symphony Teleca Corporation Remote Embedded Device Update Platform Apparatuses, Methods and Systems
CN105843623A (en) * 2016-03-29 2016-08-10 乐视控股(北京)有限公司 Target program generation method and device
CN106095523A (en) * 2016-06-03 2016-11-09 北京奇虎科技有限公司 A kind of method and system realizing Android compiling isolation
CN107741851A (en) * 2017-10-12 2018-02-27 北京元心科技有限公司 Compilation Method, device and the terminal device of compiling system
CN107943485A (en) * 2017-12-11 2018-04-20 北京奇虎科技有限公司 A kind of patch compiling platform and patch Compilation Method
CN109408064A (en) * 2018-09-10 2019-03-01 杭州安恒信息技术股份有限公司 A kind of visual micro services system automation dispositions method of layout and system
CN109471621A (en) * 2018-09-26 2019-03-15 西安电子科技大学工程技术研究院有限公司 A kind of tools build method under linux system based on big data
CN109491662A (en) * 2018-10-31 2019-03-19 珠海市筑巢科技有限公司 Code packaging method, computer installation and computer readable storage medium, code packaging system
US20190129991A1 (en) * 2017-10-26 2019-05-02 Sap Se Exchanging shared containers and adapting tenants in multi-tenancy database systems
CN110673853A (en) * 2019-09-25 2020-01-10 中国工商银行股份有限公司 Compiling method, device and system
US20200065124A1 (en) * 2018-08-22 2020-02-27 International Business Machines Corporation Shortening just-in-time code warm up time of docker containers

Patent Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102005032944A1 (en) * 2005-07-14 2007-01-18 Robert Bosch Gmbh Method and software system for configuring a modular system
US8032822B1 (en) * 2006-07-28 2011-10-04 Intuit Inc. Method and system for explaining dependencies on a document
US20140181800A1 (en) * 2012-12-14 2014-06-26 Telefonaktiebolaget L M Ericsson (Publ) Systems, methods, and computer program products for a software build and load process using a compilation and deployment service
US20160117162A1 (en) * 2014-07-07 2016-04-28 Symphony Teleca Corporation Remote Embedded Device Update Platform Apparatuses, Methods and Systems
CN105843623A (en) * 2016-03-29 2016-08-10 乐视控股(北京)有限公司 Target program generation method and device
CN106095523A (en) * 2016-06-03 2016-11-09 北京奇虎科技有限公司 A kind of method and system realizing Android compiling isolation
CN107741851A (en) * 2017-10-12 2018-02-27 北京元心科技有限公司 Compilation Method, device and the terminal device of compiling system
US20190129991A1 (en) * 2017-10-26 2019-05-02 Sap Se Exchanging shared containers and adapting tenants in multi-tenancy database systems
CN107943485A (en) * 2017-12-11 2018-04-20 北京奇虎科技有限公司 A kind of patch compiling platform and patch Compilation Method
US20200065124A1 (en) * 2018-08-22 2020-02-27 International Business Machines Corporation Shortening just-in-time code warm up time of docker containers
CN109408064A (en) * 2018-09-10 2019-03-01 杭州安恒信息技术股份有限公司 A kind of visual micro services system automation dispositions method of layout and system
CN109471621A (en) * 2018-09-26 2019-03-15 西安电子科技大学工程技术研究院有限公司 A kind of tools build method under linux system based on big data
CN109491662A (en) * 2018-10-31 2019-03-19 珠海市筑巢科技有限公司 Code packaging method, computer installation and computer readable storage medium, code packaging system
CN110673853A (en) * 2019-09-25 2020-01-10 中国工商银行股份有限公司 Compiling method, device and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
XPP0205: "Docker容器数据卷详解(共享数据)", 《HTTPS://BLOG.CSDN.NET/WEIXIN_40322495/ARTICLE/DETAILS/84957433》 *

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112463123A (en) * 2020-11-25 2021-03-09 北京字跳网络技术有限公司 Task compiling method, device, network node, system and storage medium
CN112685035A (en) * 2020-12-25 2021-04-20 京东数字科技控股股份有限公司 Project development method and device, computer-readable storage medium and electronic device
CN112685035B (en) * 2020-12-25 2024-05-17 京东科技控股股份有限公司 Project development method and device, computer readable storage medium and electronic equipment
WO2022142601A1 (en) * 2020-12-28 2022-07-07 京东科技控股股份有限公司 Application program construction method and apparatus, and computer device
CN113382049A (en) * 2021-05-31 2021-09-10 山东英信计算机技术有限公司 Management system and device of modular construction tool MBS
CN113382049B (en) * 2021-05-31 2022-04-19 山东英信计算机技术有限公司 Management system and device of modular construction tool MBS
CN113253887A (en) * 2021-06-11 2021-08-13 北京中祥英科技有限公司 Application issuing method, computer device and readable storage medium
CN113253887B (en) * 2021-06-11 2023-08-22 北京中祥英科技有限公司 Application publishing method, computer device and readable storage medium
CN114064594A (en) * 2021-11-22 2022-02-18 马上消费金融股份有限公司 Data processing method and device
CN114064594B (en) * 2021-11-22 2023-09-22 马上消费金融股份有限公司 Data processing method and device
CN114661312A (en) * 2022-03-25 2022-06-24 江苏安超云软件有限公司 OpenStack cluster nested deployment method and system

Also Published As

Publication number Publication date
CN111552508B (en) 2023-03-14

Similar Documents

Publication Publication Date Title
CN111552508B (en) Application program version construction method and device and electronic equipment
CN108287694B (en) Application program construction method, system, computer device and storage medium
CN106407101B (en) LXC-based continuous integration method and device
CN107451474B (en) Software bug fixing method and device for terminal
US8510728B2 (en) Dynamic determination of application server runtime classloading
CN108319460B (en) Method and device for generating application program installation package, electronic equipment and storage medium
Shahriar et al. Testing of memory leak in android applications
US10606586B2 (en) Application architecture generation
US10496380B2 (en) Cache-based system and method for executing instances of a computational algorithm
JP2008502968A (en) Method for loading software comprising an intermediate object-oriented language onto a portable device
EP3447635A1 (en) Application architecture generation
TW201721412A (en) Selecting and loading firmware volumes
CN115629971A (en) Application development system and method
CN114546819A (en) Code processing method and device, electronic equipment and readable medium
US20110209004A1 (en) Integrating templates into tests
Pemberton et al. Firemarshal: Making hw/sw co-design reproducible and reliable
CN113051088B (en) Program loading method, device, equipment and computer readable medium
Fernández-Prades et al. Continuous reproducibility in GNSS signal processing
CN110471828B (en) Operating system testing method, device and equipment thereof
CN108460276B (en) Processing method and device for SO file of dynamic link library of android installation package
US11573777B2 (en) Method and apparatus for enabling autonomous acceleration of dataflow AI applications
US20240134979A1 (en) Systems and Methods for API Security Integration
Feld et al. Detecting disaster before it strikes: On the challenges of automated building and testing in HPC environments
CN117313162A (en) Block chain-based vulnerability restoration method and device, electronic equipment and storage medium
CN113342642A (en) Method and device for executing test unit

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant