Application publishing method and device and readable storage medium
By uniformly completing the application packaging and deployment in one release software, the problem of low configuration and setting efficiency in the existing technology is solved, and the effect of improving application release efficiency is achieved.
Patent Information
- Application Number
- CN202311552751.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-20
- Publication Date
- 2025-05-20
AI Technical Summary
In the prior art, the packaging and deployment of applications are carried out in two software respectively, resulting in low efficiency in the configuration setting process and may reduce the release efficiency during the application release process.
Provides an application publishing method, which uniformly completes the application packaging and deployment through a publishing software, obtains the first configuration and the second configuration, and packages and deploys the source code of the published application based on these configurations.
By setting the first configuration and the second configuration in one software, the probability and time of errors during the configuration setting process are reduced, the configuration setting efficiency is improved, and the release efficiency during the application release process is improved.
Smart Images

Figure CN120020705A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of application publishing, and particularly relates to a method, an apparatus, and a readable storage medium for publishing an application. Background Art
[0002] Currently, the application publishing process mainly includes two stages: packaging and deployment. In the packaging stage, an installation package is obtained by packaging the source code of the application according to some relevant configurations required for packaging (hereinafter referred to as the first configuration). In the deployment stage, the installation package is deployed to the target environment according to some other relevant configurations required for deployment (hereinafter referred to as the second configuration) to complete the application publishing.
[0003] In the related art, the packaging and deployment of an application are carried out in two software respectively. Therefore, during the application publishing process, the user needs to set the first configuration in one software and the second configuration in another software. Since the configurations in the application publishing process need to be set through two software, the efficiency of the configuration setting process is low, which may reduce the publishing efficiency during the application publishing process. Summary of the Invention
[0004] Embodiments of the present application provide a method, an apparatus, and a readable storage medium for publishing an application, which can improve the publishing efficiency during the application publishing process.
[0005] In a first aspect, a method for publishing an application is provided, including:
[0006] The publishing software obtains the first configuration and the second configuration;
[0007] The publishing software packages the source code of the application to be published according to the first configuration to obtain an installation package;
[0008] The publishing software deploys the installation package according to the second configuration.
[0009] In the embodiments of the present application, during the application publishing process, the publishing software obtains the first configuration and the second configuration, then packages the source code of the application to be published according to the first configuration to obtain an installation package, and deploys the installation package according to the second configuration. Compared with setting the first configuration and the second configuration in two software respectively, the user can complete the settings of the first configuration and the second configuration in one software. For related configurations, the error probability during the configuration setting process can be reduced, so that the time used in the configuration setting process can be reduced. At the same time, for the same configuration, it only needs to be set once, so the time used in the configuration setting process can also be shortened. Thus, the efficiency of the configuration setting process can be improved, and further the publishing efficiency during the application publishing process can be improved. Moreover, when the settings of the first configuration and the second configuration are completed uniformly in one software, it is convenient for the user to manage and check the configurations.
[0010] In some embodiments, the publishing software deploys the installation package according to the second configuration, including:
[0011] The publishing software constructs a container image according to the second configuration and the installation package;
[0012] The publishing software deploys the container image.
[0013] In the embodiments of the present application, the publishing software deploys the application in a containerized deployment manner, which can improve the deployment rate of the application, reduce the deployment time and cost, and at the same time facilitate the iterative update of the application.
[0014] In some embodiments, the first configuration includes the version information of the application to be published. The publishing software packages the source code of the application to be published according to the first configuration, including:
[0015] The publishing software determines whether the version of the source code matches the version information;
[0016] If so, the source code is packaged according to the first configuration to obtain the installation package.
[0017] In the embodiments of the present application, before packaging the source code of the application to be published, first verify whether the version of the source code matches the version information in the first configuration. When the version of the source code matches the version information, package the source code, which can reduce the probability of errors in the application publishing process, thereby improving the reliability of the application publishing.
[0018] In some embodiments, the version information includes the first version number and the first branch number of the application to be published. The publishing software determines whether the version of the source code matches the version information, including:
[0019] The publishing software determines whether the version number of the source code is the first version number and whether the branch number of the source code is the first branch number.
[0020] In the embodiments of the present application, before packaging the source code of the application to be published, verify the source code according to the version number and branch number in the first configuration and the version number and branch number of the source code, which can reduce the probability that the published application does not match the expected result, thereby improving the reliability of the application publishing.
[0021] In some embodiments, the publishing software packages the source code of the application to be published according to the first configuration, including:
[0022] The publishing software packages the source code to obtain the installation package when it is determined that there are no errors in the source code.
[0023] In the embodiments of the present application, during the process of packaging the source code, the publishing software checks the source code, and packages the source code to obtain an installation package when no errors are detected in the source code, which can reduce the probability of anomalies occurring after the application is released, thereby improving the reliability of the application release.
[0024] In some embodiments, the method further includes:
[0025] When the publishing software obtains a configuration change request, it changes the second configuration;
[0026] The publishing software redeploys the installation package according to the changed second configuration.
[0027] In the embodiments of the present application, the application publishing device can change the configuration in the second configuration according to the configuration change request, which can facilitate the user to quickly adjust the configuration in the second configuration according to the deployment requirements, thereby facilitating the user to quickly redeploy the application.
[0028] In some embodiments, the configuration change request is used to request to change the first middleware configuration in the second configuration to a second middleware configuration. The changing of the second configuration includes:
[0029] Changing the first middleware configuration included in the second configuration to the second middleware configuration.
[0030] In the embodiments of the present application, the application publishing device can change the middleware configuration included in the second configuration according to the configuration change request, which can facilitate the user to change the middleware configuration according to the requirements, thereby facilitating the user to redeploy the application according to the requirements.
[0031] In some embodiments, the publishing software obtains the first configuration and the second configuration, including:
[0032] The publishing software obtains the first configuration and the second configuration from the configuration file of the publishing software.
[0033] In the embodiments of the present application, the first configuration and the second configuration can be stored in the configuration file of the publishing software in advance. During the application release process, the publishing software can directly obtain the first configuration and the second configuration from the configuration file, so that the first configuration and the second configuration can be obtained quickly, thereby improving the packaging efficiency and the deployment efficiency, and further improving the application release efficiency.
[0034] In a second aspect, an application publishing device is provided. The publishing device is installed with publishing software, and the publishing software includes:
[0035] An acquisition module, configured to acquire a first configuration and a second configuration;
[0036] A packaging module, configured to package the source code of the application to be released according to the first configuration to obtain an installation package;
[0037] A deployment module, configured to deploy the installation package according to the second configuration.
[0038] In some embodiments, the deployment module is specifically configured to build a container image according to the second configuration and the installation package; and deploy the container image.
[0039] In some embodiments, the first configuration includes version information of the application to be released, and the packaging module is specifically configured to determine whether the version of the source code matches the version information; if so, package the source code according to the first configuration to obtain the installation package.
[0040] In some embodiments, the version information includes a first version number and a first branch number of the application to be released, and the packaging module is specifically configured to determine whether the version number of the source code is the first version number and whether the branch number of the source code is the first branch number for the release software.
[0041] In some embodiments, the packaging module is specifically configured to package the source code to obtain the installation package when it is determined that there are no errors in the source code.
[0042] In some embodiments, the deployment module is further configured to change the second configuration when a configuration change request is acquired; and redeploy the installation package according to the changed second configuration.
[0043] In some embodiments, the configuration change request is used to request to change a first middleware configuration in the second configuration to a second middleware configuration, and the deployment module is specifically configured to change the first middleware configuration included in the second configuration to the second middleware configuration.
[0044] In some embodiments, the acquisition module is specifically configured to acquire the first configuration and the second configuration from a configuration file of the release software.
[0045] In a third aspect, a readable storage medium is provided, on which a computer program is stored. When the computer program runs on a release device of an application, the release device of the application is enabled to execute the application release method provided in the foregoing first aspect.
[0046] Fourthly, a publishing device for an application is provided, including: a processor; a memory; and a computer program, where the computer program is stored in the memory, and when the computer program is executed by the processor, the publishing device for the application executes the application publishing method provided in the foregoing first aspect.
[0047] Fifthly, a computer program product is provided, including: computer program code, when the computer program code runs on a publishing device for an application, the publishing device for the application executes the application publishing method provided in the foregoing first aspect.
[0048] Sixthly, a chip is provided, including: a processor, configured to call and run a computer program from a memory, so that a publishing device for an application installed with the chip executes the application publishing method provided in the foregoing first aspect.
[0049] It can be understood that the publishing device for an application provided in the foregoing second aspect and fourth aspect, the readable storage medium provided in the third aspect, the computer program product provided in the fifth aspect, and the chip provided in the sixth aspect are all used to execute the application publishing method provided in the foregoing first aspect. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above, and will not be elaborated here. Description of the Drawings
[0050] Figure 1 A schematic diagram showing an application scenario of an application publishing method provided by an embodiment of the present application is shown.
[0051] Figure 2 A flowchart showing the steps of an application publishing method provided by an embodiment of the present application is shown.
[0052] Figure 3 A flowchart showing an application publishing method provided by an embodiment of the present application is shown.
[0053] Figure 4 A flowchart showing another application publishing method provided by an embodiment of the present application is shown.
[0054] Figure 5 A schematic structural diagram of a publishing device for an application provided by an embodiment of the present application is shown
[0055] Figure 6 A structural block diagram of a publishing device for an application provided by an embodiment of the present application is shown. Detailed Embodiments
[0056] Next, the technical solutions in the present application will be described in conjunction with the drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments.
[0057] In the following description, for the purpose of illustration rather than limitation, specific details such as specific system architectures, technologies, etc. are presented to provide a thorough understanding of the embodiments of the present application. However, those skilled in the art should clearly understand that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid unnecessary details from interfering with the description of the present application.
[0058] As used herein, the term "comprising" indicates the presence of the described features, wholes, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations. The terms "comprising", "including", "having", and their variants all mean "including but not limited to", unless otherwise specifically emphasized. Hereinafter, the terms "first" and "second" are used only for descriptive purposes and should not be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of the embodiments of the present application, unless otherwise specified, the meaning of "a plurality of" is two or more.
[0059] As used herein, the term "and / or" is merely a description of the association relationship between associated objects, indicating that three relationships may exist. For example, A and / or B may represent three situations: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " herein generally represents an "or" relationship between the associated objects before and after.
[0060] Application release refers to the process of deploying a newly developed application (also known as an application program) or a new version of an application obtained through iterative updates to a target environment such as a server, cloud platform, virtualization platform, etc. The release process mainly includes two stages: packaging and deployment.
[0061] In the packaging stage, first, the source code of the application needs to be compiled to obtain an executable file, and then the executable file is packaged into an installation package of the application according to the first configuration required for the packaging stage. The first configuration usually includes the application name, version number, branch number, environment information (used to specify the target environment as a test environment or a production environment), configuration file (usually including configuration information such as fonts, colors, and interfaces in the application), resource file (usually including resources such as pictures, audio, and video used during the operation of the application), as well as the startup items, library files, etc. of the application, but is not limited thereto.
[0062] In the deployment stage, the installation package of the application needs to be deployed to the target environment according to the second configuration required in the deployment stage. Taking the containerized deployment of the application as an example, during the containerized deployment of the application, a container image (dockerimage) of the application needs to be created. The second configuration includes environmental information, the image name and image tag of the container image, and the base image used to build the container image, etc., but is not limited thereto.
[0063] In the related art, the packaging and deployment of the application are carried out in two software respectively. For example, the packaging of the application is usually carried out in Jenkins software (hereinafter referred to as the first software), and the deployment of the application is usually carried out in Kubernetes software (hereinafter referred to as the second software). Therefore, during the application release process, users usually set the first configuration in the first software first, and then set the second configuration in the second software. Since the configuration needs to be set through two software, the efficiency of the configuration setting process is low, which may reduce the release efficiency during the application release process.
[0064] For example, the first configuration and the second configuration may include some identical configurations. When setting the first configuration and the second configuration in two software respectively, the same configuration may need to be set twice, which virtually reduces the efficiency of the configuration setting process. For another example, the first configuration and the second configuration include some related configurations. When setting the related configurations in two software respectively, it is easy to make mistakes, which requires users to switch between the two software multiple times to check whether the related configurations are accurately associated, and this also takes a certain amount of time.
[0065] To solve the above technical problems, the embodiments of the present application provide a method for releasing an application, which places the packaging stage and the deployment stage in the application release process in one software (collectively referred to as the release software). In this way, users can uniformly set the first configuration and the second configuration in one software. Compared with setting the first configuration and the second configuration in two software respectively, users can complete the setting of the first configuration and the second configuration in one software. For related configurations, the probability of making mistakes in the configuration setting process can be reduced, so that the time used in the configuration setting process can be reduced. At the same time, for the same configuration, it only needs to be set once, so the time used in the configuration setting process can also be shortened. Thus, the efficiency of the configuration setting process in the application release process can be improved, and further the release efficiency in the application release process can be improved. Moreover, when uniformly completing the setting of the first configuration and the second configuration in one software, it is convenient for users to manage and check the configuration.
[0066] See Figure 1 , Figure 1 shows a schematic diagram of application scenario 10 of a method for releasing an application provided by the embodiments of the present application. As Figure 1As shown, the application scenario 10 includes a user 11, a publishing device 12 of an application, and a target environment 13. The publishing device 12 of the application can be, for example, a server, a server cluster, a cloud platform, etc. The target environment 13 can be a server, a server cluster, a cloud platform, a virtualization platform, etc., but is not limited thereto.
[0067] A publishing software is installed in the publishing device 12. The publishing software has a packaging function and a deployment function. It can package the source code of the application to be published to obtain an installation package, and can deploy the application based on the installation package in the target environment. Before the application is published, the user 11 can set a first configuration and a second configuration for the application to be published in the publishing software. Then, the publishing software can obtain the source code of the application to be published, compile the source code to obtain an executable file, and package the executable file according to the first configuration to obtain an installation package. After that, the publishing software can deploy the installation package to the target environment 13 according to the second configuration, thereby completing the publishing of the application.
[0068] The above is only an exemplary example. The application scenarios of the application publishing method provided by the embodiments of the present application may include but are not limited to Figure 1 as shown.
[0069] See Figure 2 , Figure 2 which shows a flowchart of the steps of an application publishing method 100 provided by an embodiment of the present application. The execution subject of the application publishing method 100 can be Figure 1 the publishing device 12 of the application as shown, and specifically can be executed by the publishing software in the publishing device 12 of the application. As Figure 1 such, this method may include:
[0070] Step 110, the publishing software obtains a first configuration and a second configuration.
[0071] Among them, the first configuration includes the configuration required for the source code of the application to be published in the packaging stage, and the second configuration includes the configuration required for the installation package of the application to be published in the deployment stage.
[0072] Exemplarily, the first configuration required in the packaging stage includes startup items, library files, configuration files, resource files, etc. required during the operation of the application. The startup items include the names, paths, parameters, etc. of the scripts that need to be automatically run or loaded when the application starts. The library files include functions, static libraries, and / or dynamic libraries required during the operation of the application. The configuration files include configuration information such as the interface, font, and color during the operation of the application. The resource files include resources such as pictures, audio, and video required during the operation of the application. The first configuration also includes the basic information of the application, such as the application name, version number, branch number, developer information, copyright information, etc.
[0073] It should be understood that the first configuration can be specifically set according to the application release process. For example, when deploying an application in a containerized manner, if the container instance of the application needs to use a trigger during operation, the relevant code of the trigger is also included in the first configuration. The content included in the first configuration can include, but is not limited to, the above examples.
[0074] Exemplarily, in the case of deploying an application through a virtual machine, the second configuration can include configurations such as the processor, memory, network, and ports of the virtual machine, and can also include middleware configurations. The middleware configurations are used to specify various types of middleware required during the operation of the application, such as message middleware, database management systems (such as MySQL), distributed stream processing platforms (such as Kafka), etc., but are not limited thereto.
[0075] Exemplarily, the application can be directly deployed to a certain device (i.e., the target environment), such as deployed on a server. In this case, the second configuration can include the system configuration of the server, which is used to specify the operating system in the server, and also includes the middleware configuration used to specify various types of middleware required during the operation of the application, but is not limited thereto. It should be understood that the second configuration can be specifically set according to the application deployment process, and the content included in the second configuration can include, but is not limited to, the above examples.
[0076] In some embodiments, before the application is released, the user can pre-set the first configuration and the second configuration for the release software and upload the first configuration and the second configuration to the release device. After starting to release the application, the release software can obtain the first configuration and the second configuration pre-stored in the release device. Alternatively, before the application is released, the user can pre-set the first configuration and the second configuration for the release software and upload the first configuration and the second configuration to other devices other than the application release device. After starting to release the application, the release software can obtain the first configuration and the second configuration from other devices.
[0077] Among them, the release software can obtain the first configuration and the second configuration at the same time, or can obtain the first configuration in the packaging stage and obtain the second configuration in the deployment stage. The above are only exemplary examples, and the specific methods for obtaining the first configuration and the second configuration can include, but are not limited to, the above examples.
[0078] Step 120: The release software packages the source code of the application to be released according to the first configuration to obtain an installation package.
[0079] Exemplarily, the source code of the application to be released can be stored in a code repository (such as GitLab). The code repository can be a code repository installed in the application release device, or a code repository in other devices communicatively connected to the application release device. Before packaging the source code of the application to be released, the application release device can run release software to obtain the source code of the application to be released from the code repository through the release software. Of course, the application release device can also obtain the source code of the application to be released from other locations or through other means.
[0080] The release software can integrate a compilation tool and a packaging tool to enable the release software to have a packaging function. After obtaining the source code of the application to be released, the release device runs the release software, and then compiles the source code into an executable file through the compilation tool integrated in the release software. After that, the release software can package the first configuration such as startup items, library files, configuration files, resource files, etc. together with the executable file into an independent installation package, and set metadata for the installation package. The metadata includes basic information such as the application name, version number, branch number, developer information, copyright information, etc. of the application to be released, so that the installation package of the application can be obtained. After packaging to obtain the installation package of the application, the release software can store the installation package in a preset location to obtain the installation package from the preset location during the deployment phase.
[0081] Among them, the compilation tool and the packaging tool can be software modules integrated in the release software, or the compilation tool and the packaging tool can also be software modules independent of the release software installed in the application release device. In the packaging phase, the release software can call the compilation tool to compile the source code of the application to obtain an executable file, and then call the packaging tool to package an installation package according to the first configuration and the executable file.
[0082] Step 130: The release software deploys the installation package according to the second configuration.
[0083] Among them, the process of deploying the installation package according to the second configuration is the process of deploying the application to be released in the target environment according to the installation package and the second configuration.
[0084] Exemplarily, a deployment tool is integrated in the release software to enable the release software to have the function of deploying applications. When deploying the application to be released through a virtual machine, the release software can call the deployment tool to create a virtual machine in the target environment (such as a server) according to the relevant configuration of the virtual machine included in the second configuration, then add the corresponding middleware in the virtual machine according to the middleware configuration, and then install the installation package into the virtual machine and start the application in the virtual machine, so as to deploy the application to be released into the virtual machine.
[0085] Exemplarily, when directly deploying an application to be released in a certain device (such as a server), the publishing software can first configure the server according to the relevant configuration of the server included in the second configuration, then add the corresponding middleware in the server according to the middleware configuration, and then install the installation package into the server and start the application in the server, so as to deploy the application to be released to the target environment. The above is only an exemplary example, and the specific method for deploying the installation package may include but is not limited to the above example.
[0086] In the embodiments of the present application, during the application release process, the publishing software obtains the first configuration and the second configuration, then packages the source code of the application to be released according to the first configuration to obtain an installation package, and deploys the installation package according to the second configuration. Compared with setting the first configuration and the second configuration in two software respectively, the user can complete the settings of the first configuration and the second configuration in one software. For related configurations, the probability of errors in the configuration setting process can be reduced, so that the time used in the configuration setting process can be reduced. At the same time, the same configuration only needs to be set once, so the time used in the configuration setting process can also be shortened. Thus, the efficiency of the configuration setting process can be improved, and further the release efficiency during the application release process can be improved. Moreover, when the settings of the first configuration and the second configuration are completed uniformly in one software, it is convenient for the user to manage and check the configuration.
[0087] Optionally, step 130 may include:
[0088] The publishing software constructs a container image according to the second configuration and the installation package;
[0089] The publishing software deploys the container image.
[0090] In some embodiments, the application can be deployed in a containerized deployment manner. In this case, the second configuration mainly includes a container file (Dockerfile). The container file is used to construct the container image of the application to be released. The container file may include multiple instructions for constructing the container image of the application. The instructions include the image name of the base image required for constructing the container image of the application, as well as the image name and image tag set for the container image of the application, etc.
[0091] Exemplarily, the publishing software is integrated with a building tool for building a container image. After obtaining the installation package of the application to be published, the publishing software can first obtain the container file (i.e., the second configuration), then parse the container file through the building tool, and execute each instruction in the container file. First, obtain the image package of the base image from the image repository according to the image name of the base image included in the instruction, and then obtain the installation package from the preset location according to the location information of the preset location included in the instruction. After that, the obtained installation package can be copied into the image package of the base image, and then the corresponding instructions in the container file are executed to build the container image of the application by using the image package including the base image and the installation package.
[0092] Meanwhile, during the process of building the container image of the application to be published, the publishing software can configure the image name included in the container file to the built container image, and configure the image tag included in the container file to the container image. The image name corresponds to the application name of the application to be published, and the image tag corresponds to the version number of the application to be published.
[0093] The container engine is installed in the target environment. After obtaining the container image of the application to be published, the publishing software can push the container image into the container engine, and the container engine creates and runs a container instance of the application to be published in the target environment based on the container image, thereby completing the deployment of the container image, that is, completing the containerized deployment of the application to be published.
[0094] Among them, the building tool can be a software module integrated in the publishing software. Or, the building tool can also be a software module installed in the publishing device and relatively independent of the publishing software. During the deployment stage, the publishing software can call the building tool to build the container image of the application to be published according to the second configuration and the installation package.
[0095] It should be noted that when deploying an application in the containerized deployment manner, other configurations can also be included in the second configuration. Specifically, the process of building the container image through the second configuration and the installation package and deploying the application through the container image can be set according to requirements.
[0096] In the embodiments of the present application, the publishing software deploys the application in the containerized deployment manner, which can improve the deployment rate of the application, reduce the deployment time and deployment cost, and at the same time facilitate the iterative update of the application.
[0097] Optionally, the first configuration includes the version information of the application. In step 120, it may include:
[0098] The publishing software determines whether the version of the source code matches the version information;
[0099] If so, the source code is packaged according to the first configuration to obtain the installation package.
[0100] In some embodiments, the release software may perform version verification on the source code of the application according to the version information in the first configuration to verify whether the version of the obtained source code is correct. Exemplarily, the version information may include the version number of the application to be released, and the version number is used to specify the version of the application to be released. When the release software obtains the source code of the application from the code repository, what is usually obtained is the code package of the application. The code package includes the source code of the application, as well as other information such as the application name and version number of the application.
[0101] After the release software obtains the code package of the application to be released from the code repository, it first parses the code package to obtain the version number of the source code from the code package. This version number indicates the version of the application corresponding to the obtained source code. Then, the release software may extract the version number of the application to be released from the first configuration. If the version number in the code package is consistent with the version number in the first configuration, it may be determined that the version of the source code conforms to the version information. At this time, the source code can be compiled, and the compiled executable file can be packaged to obtain an installation package.
[0102] In the embodiments of the present application, before packaging the source code of the application to be released, first verify whether the version of the source code conforms to the version information in the first configuration. Packaging the source code when the version of the source code conforms to the version information can reduce the probability of errors during the application release process, thereby improving the reliability of the application release.
[0103] Optionally, the step of determining whether the version of the source code conforms to the version information may include:
[0104] The release software determines whether the version number of the source code is the first version number and whether the branch number of the source code is the first branch number.
[0105] In some embodiments, the version information may include the first version number and the first branch number of the application to be released. The first version number indicates the version of the source code of the application to be released, and the branch number indicates the development branch where the source code of the application to be released is located. Correspondingly, the code package of the application to be released includes the source code of the application to be released, and may also include other information such as the application name, version number, and branch number of the application to be released.
[0106] After obtaining the code package of the application to be released, the publishing software first parses the code package to obtain the version number and branch number of the application to be released from the code package. Then, the publishing software can extract the version number and branch number of the application to be released from the first configuration. If the version number in the code package is the same as the first version number in the first configuration, and the branch number in the code package is the same as the first branch number in the first configuration, it can be determined that the version of the source code is the version specified by the first version number and the first branch number, that is, the version of the source code matches the version information. At this time, the publishing software can compile the source code and package the compiled executable file to obtain an installation package.
[0107] In the embodiment of the present application, before packaging the source code of the application to be released, verifying the source code according to the version number and branch number in the first configuration and the version number and branch number of the source code can reduce the probability that the released application does not match the expected result, thereby improving the reliability of application release.
[0108] Optionally, the method may further include:
[0109] When the publishing software receives a configuration change request, it changes the second configuration;
[0110] The publishing software redeploys the installation package according to the changed second configuration.
[0111] In some embodiments, the user can change the second configuration according to the requirements, and the publishing software can redeploy the installation package of the application to be released according to the changed second configuration. During the process of changing the second configuration, the user can send a configuration change request to the publishing device through devices such as a computer, a laptop, and a tablet. The configuration change request may include relevant information of the original configuration to be changed and relevant information of the changed target configuration. After receiving the configuration change request, the publishing software can change the original configuration in the second configuration to the target configuration according to the relevant information of the original configuration and the relevant information of the target configuration included in the configuration change request. After changing the second configuration, the publishing software can redeploy the application to be released in the target environment according to the changed second configuration and the installation package.
[0112] For example, the original configuration is the first memory configuration of the virtual machine included in the second configuration, and the target configuration in the configuration change request is the second memory configuration of the changed virtual machine. After receiving the configuration change request, the publishing software can change the first memory configuration in the second configuration to the second memory configuration. Then, the publishing software can recreate the virtual machine according to the changed second configuration, then reinstall the installation package of the application in the recreated virtual machine, and start the application.
[0113] The above is only an exemplary example. The specific method of changing the second configuration may include, but is not limited to, the above examples. It should be noted that when redeploying the application in the target environment, the previously deployed application can be shut down, and then the application can be redeployed in the target environment.
[0114] In the embodiment of the present application, the application publishing device can change the configuration in the second configuration according to the configuration change request, which can facilitate the user to quickly adjust the configuration in the second configuration according to the deployment requirements, so as to facilitate the user to quickly redeploy the application.
[0115] Optionally, the configuration change request is used to request to change the first middleware configuration in the second configuration to the second middleware configuration. The steps of changing the second configuration may include:
[0116] Change the first middleware configuration included in the second configuration to the second middleware configuration.
[0117] For example, if the first middleware configuration included in the second configuration is MySQL and the second middleware configuration in the configuration change request is Kafka, after receiving the configuration change request, the publishing software can change the middleware configuration MySQL in the second configuration to the middleware configuration Kafka.
[0118] For another example, when the application is deployed in a containerized deployment manner, the base image includes the underlying operating system and middleware. At this time, the configuration change request may include the image name of the target base image, and the target base image includes the underlying operating system and the second middleware. After receiving the configuration change request, the publishing software can change the image name of the base image included in the instructions of the container file to the image name of the target base image, so as to change the first middleware configuration in the original base image to the second middleware configuration in the target base image. The above is only an exemplary example. The specific form of the configuration change request and the specific process of changing the second configuration can be set according to requirements, and this embodiment does not limit this.
[0119] In the embodiment of the present application, the application publishing device can change the middleware configuration included in the second configuration according to the configuration change request, which can facilitate the user to change the middleware configuration according to the requirements, so as to facilitate the user to redeploy the application according to the requirements.
[0120] Optionally, step 110 may include:
[0121] The publishing software obtains the first configuration and the second configuration from the configuration file of the publishing software.
[0122] In some embodiments, before releasing an application, a user can set a first configuration and a second configuration through a computer, laptop, tablet, etc., and then send the first configuration and the second configuration to a release device. After receiving the first configuration and the second configuration, the release software can store the first configuration and the second configuration in a configuration file of the release software. During the application release process, the release software can directly obtain the first configuration and the second configuration from the configuration file, and then package the source code according to the first configuration to obtain an installation package, and deploy the installation package according to the second configuration.
[0123] In the embodiments of the present application, the first configuration and the second configuration can be stored in a configuration file of the release software in advance. During the application release process, the release software can directly obtain the first configuration and the second configuration from the configuration file, so that the first configuration and the second configuration can be obtained quickly, thereby improving the packaging efficiency and the deployment efficiency, and further improving the application release efficiency.
[0124] Optionally, step 120 may include:
[0125] When the release software determines that there are no errors in the source code, it packages the source code to obtain an installation package.
[0126] In some embodiments, in the packaging stage, the release software can check the source code to determine whether there are errors in the source code, and when it is determined that there are no errors in the source code after the check, it compiles the source code to obtain an executable file, and then packages the executable file according to the first configuration.
[0127] Exemplarily, during the compilation process, the release software can also perform semantic and syntax checks on the source code of the application to be released. When it is detected that there are no semantic and / or syntax errors in the source code, it packages the source code to obtain an installation package. When it is detected that there are semantic and / or syntax errors in the source code, it outputs a prompt message to prompt the user to modify the source code. For example, when the release device is connected to a display, the release software can control the display to output a text prompt message to prompt the user that there are semantic and / or syntax errors in the source code.
[0128] For another example, when the release device of the application is communicatively connected to a user device such as a user's mobile phone, wearable device, computer, etc., the release device of the application can send a notification to the user device to notify the user that there are semantic and / or syntax errors in the source code. Among them, the specific way of outputting the prompt message may include but is not limited to the above examples. It should be understood that in addition to checking the semantics and syntax of the source code, the release software can also check other contents of the source code.
[0129] In the embodiments of the present application, when the publishing software packages the source code, it checks the source code. If no errors are detected in the source code, the source code is packaged to obtain an installation package, which can reduce the probability of anomalies occurring after the application is released, thereby improving the reliability of application release.
[0130] See Figure 3 , Figure 3 FIG. shows a flowchart of a method 200 for releasing an application provided by an embodiment of the present application. The execution subject of the application release method 200 may be Figure 1 the application release device 12 shown in FIG., and specifically may be executed by the publishing software in the application release device 12. As Figure 3 such, the method may include:
[0131] Step 210, obtain the source code of the application to be released.
[0132] In this embodiment, when an application needs to be released, the publishing software may first obtain the source code of the application to be released. For example, the publishing software may first determine the application name, version number, and branch number of the application to be released, and then send a code acquisition request to a device (such as a server) installed with a code repository. The code acquisition request includes the application name, version number, and branch number of the application to be released. After receiving the code acquisition request, the server may query and determine the source code of the application to be released from the code repository according to the information such as the application name, version number, and branch number in the code acquisition request, and then send a code package including the source code to the publishing software. The source code in the code repository is pre-uploaded to the code repository by developers.
[0133] It should be understood that the source code of the application may also be obtained by other means. For example, when the publishing software and the code repository are located in the same device, the publishing software may directly query and obtain the source code from the code repository. Or, the user may pre-upload a code package including the source code to the application release device 12, and the publishing software may directly obtain the source code from the application release device 12. The above are only exemplary examples, and the specific method for obtaining the source code of the application may include but is not limited to the above examples.
[0134] Step 220, determine whether the version of the source code is correct.
[0135] In this embodiment, after obtaining the code package of the source code of the application to be released, the publishing software may determine whether the version of the source code matches the version information in the first configuration, that is, determine whether the version of the source code is correct. If it is determined that the version of the source code is incorrect, step 230 is executed; if it is determined that the version of the source code is correct, step 240 is executed.
[0136] Step 230, output a prompt message.
[0137] In this embodiment, when it is determined that the version of the obtained source code is incorrect, the publishing software can output a prompt message to prompt the user that the version of the source code is incorrect, so that the user can take relevant measures to change the source code to the correct version. For example, when the publishing device of the application is connected to the display, the publishing software can control the display to output a text prompt message to prompt the user that the version of the source code is incorrect. For another example, when the publishing device of the application is communicatively connected to user devices such as the user's mobile phone, wearable device, computer, etc., the publishing device of the application can send a notification to the user device to notify the user that the version of the source code is incorrect. The above are only exemplary examples, and the specific ways to output the prompt message may include but are not limited to the above examples.
[0138] Step 240: Compile the source code to obtain an executable file.
[0139] Step 250: Package the executable file according to the first configuration to obtain an installation package.
[0140] Optionally, before compiling the source code, the publishing software can check the source code to determine whether there are errors in the source code. If there are errors in the source code, continue to execute step 240. If there are no errors in the source code, output a prompt message to prompt the user that there are errors in the source code.
[0141] Among them, the process of compiling the source code of the application to obtain an executable file and packaging the executable file according to the first configuration to obtain an installation package can refer to the above examples, and this embodiment will not elaborate here.
[0142] Step 260: Deploy the application in the target environment according to the second configuration and the installation package.
[0143] In this embodiment, after obtaining the installation package of the application to be published, the publishing software can deploy the application to be published in the target environment according to the second configuration and the installation package, that is, deploy the installation package according to the second configuration. As described above, the application to be published can be deployed in a virtual machine or directly on a device according to the second configuration and the installation package, or the application to be published can also be deployed in a containerized deployment manner. The specific deployment process can refer to the above examples, and this embodiment will not elaborate here.
[0144] See Figure 4 , Figure 4 shows a flowchart of another application publishing method 300 provided by an embodiment of the present application. The execution subject of the application publishing method 300 can be Figure 1 the application publishing device 12 shown in Figure 4 Therefore, this method may include:
[0145] Step 310: Obtain the first configuration and the second configuration.
[0146] In this embodiment, before deploying the application to be released, the user can first set the first configuration and the second configuration, and then send the first configuration and the second configuration to the release software. The release software can receive the first configuration and the second configuration and store the first configuration in the configuration file.
[0147] Step 320: Receive a code release request.
[0148] Step 330: Obtain the source code of the application to be released.
[0149] Exemplarily, when an application needs to be deployed in a target environment, the user can send a code release request to the application release device through devices such as a computer, a laptop, and a tablet. Correspondingly, the application release device can receive the code release request, and the code release request usually includes basic information such as the application name, version number, and branch number of the application to be released. After receiving the code release request, the release software can parse the code release request to obtain information such as the application name, version number, and branch number included in the code release request.
[0150] After that, the release software can send a code acquisition request to the code repository. The code acquisition request includes the application name, version number, and branch number of the application to be released. After receiving the code acquisition request, the code repository can query and determine the source code of the application to be released from the code repository according to the information such as the application name, version number, and branch number in the code acquisition request, and then send a code package including the source code of the application to the application release device.
[0151] The above is only an exemplary example, and the source code of the application can also be obtained by other means. The specific method for obtaining the source code of the application can include but is not limited to the above examples.
[0152] Step 340: Determine whether the version of the source code is correct.
[0153] In this embodiment, after obtaining the code package of the source code of the application to be released, the release software can determine whether the version of the source code matches the version information in the first configuration, that is, determine whether the version of the source code is correct. If the version of the source code is determined to be incorrect, step 350 is executed; if the version of the source code is determined to be correct, step 360 is executed.
[0154] Step 350: Output a prompt message.
[0155] Step 360: Compile the source code to obtain an executable file.
[0156] Step 370: Package the executable file according to the first configuration to obtain an installation package.
[0157] Optionally, before compiling the source code, the publishing software can check the source code to determine whether there are errors in the source code. If there are errors in the source code, continue to execute Step 380. If there are no errors in the source code, output a prompt message to prompt the user that there are errors in the source code.
[0158] Among them, the process of compiling the source code of the application to obtain an executable file and packaging the executable file according to the first configuration to obtain an installation package can refer to the above example, and this embodiment will not be elaborated here.
[0159] Step 380: Build a container image according to the second configuration and the installation package.
[0160] Step 390: Create a container instance in the target environment through the container image.
[0161] In this embodiment, the application is deployed in a containerized deployment manner. After obtaining the installation package of the application, the publishing software can build a container image of the application to be published based on the second configuration and the installation package, and then create a container instance of the application container in the target environment to deploy the application in the target environment.
[0162] Step 311: Determine whether a configuration change request is received.
[0163] Step 312: Change the second configuration.
[0164] In this embodiment, after receiving the second configuration, the publishing software can determine whether a configuration change request is received. If a configuration change request is received, execute Step 312 to change the second configuration according to the configuration change request. The specific method of changing the second configuration can refer to the above example, and this embodiment will not be elaborated here.
[0165] On the contrary, if a configuration change request is not received, return to Step 311 and continue to determine whether a configuration change request is received.
[0166] Step 313: Determine whether the application has been deployed.
[0167] Step 314: Shut down the deployed application.
[0168] In this embodiment, after changing the configuration in the second configuration, the publishing software can determine whether the application has been deployed in the target environment. If the application has been deployed to the target environment, shut down the application deployed in the target environment, and then redeploy the application in the target environment.
[0169] Such as Figure 4As shown, in the case of a container instance in which an application has been deployed in a target environment, the publishing software can shut down the container instance running in the target environment, and then execute step 380 and step 390 again, build a container image of the application according to the changed second configuration and the installation package, and then create a container instance of the application in the target environment according to the container image to complete the redeployment of the application.
[0170] On the contrary, in the case where the application has not been deployed, the application is directly deployed according to the changed second configuration.
[0171] As described above in conjunction with Figures 1 to 4 The method for publishing an application provided by the embodiments of the present application is described in detail. Below, in conjunction with Figure 5 、 Figure 5 The publishing device of the application provided by the embodiments of the present application is described. It should be understood that Figure 5 、 Figure 6 The control device shown can implement Figure 2 、 Figure 3 Or Figure 4 One or more steps in the method flow shown. To avoid repetition, it will not be elaborated in detail here.
[0172] See Figure 5 , Figure 5 Shows a schematic structural diagram of a publishing device 50 for an application provided by an embodiment of the present application. As Figure 5 Shown, the publishing software is installed in the publishing device 50 for the application, and the publishing software includes an acquisition module 51, a packaging module 52, and a deployment module 53.
[0173] The acquisition module 51 is used to acquire a first configuration and a second configuration;
[0174] The packaging module 52 is used to package the source code of the application to be published according to the first configuration to obtain an installation package;
[0175] The deployment module 53 is used to deploy the installation package according to the second configuration.
[0176] In some embodiments, the deployment module 53 is specifically used to build a container image according to the second configuration and the installation package; deploy the container image.
[0177] In some embodiments, the first configuration includes version information of the application to be published, and the packaging module 52 is specifically used to determine whether the version of the source code matches the version information; if so, package the source code according to the first configuration to obtain the installation package.
[0178] In some embodiments, the version information includes the first version number and the first branch number of the application to be released, and the packaging module 52 is specifically used by the release software to determine whether the version number of the source code is the first version number, and determine whether the branch number of the source code is the first branch number.
[0179] In some embodiments, the packaging module 52 is specifically used to package the source code to obtain the installation package when it is determined that there is no error in the source code.
[0180] In some embodiments, the deployment module 53 is further configured to change the second configuration when a configuration change request is obtained; and redeploy the installation package according to the changed second configuration.
[0181] In some embodiments, the configuration change request is used to request to change the first middleware configuration in the second configuration to the second middleware configuration, and the deployment module 53 is specifically used to change the first middleware configuration included in the second configuration to the second middleware configuration.
[0182] In some embodiments, the acquisition module 51 is specifically used to acquire the first configuration and the second configuration from the configuration file of the publishing software.
[0183] Figure 6 shows a structural block diagram of an application publishing device 60 provided in an embodiment of the present application. As Figure 6 As shown in FIG. 1 , the application publishing device 60 includes a processor 61 and a memory 62, and the above-mentioned components can be connected via one or more buses 64.
[0184] The application publishing device 60 also includes a computer program 63, which is stored in the memory 62. When the computer program 63 is executed by the processor 61, the application publishing device 60 executes the above Figure 2 、 Figure 3 and Figure 4 The method shown. All relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding physical device, and will not be repeated here.
[0185] The present application also provides a readable storage medium, which includes a computer program. When the computer program is run on a computer, the computer executes the method provided in the above method embodiment.
[0186] The present application embodiment also provides a computer program product containing instructions, when the computer program product is run on a computer, the computer is caused to execute the method provided by the above method embodiment.
[0187] An embodiment of the present application further provides a chip system, including a memory and a processor. The memory is used to store a computer program, and the processor is used to call and run the computer program from the memory, so that a publishing device of an application installed with the chip system executes the method provided in the above method embodiment.
[0188] Wherein, the chip system may include an input circuit or interface for sending information or data, and an output circuit or interface for receiving information or data.
[0189] It should be understood that in the embodiment of the present application, the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0190] It should also be understood that the memory in the embodiments of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of random access memory (RAM) are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchlink dynamic random access memory (SLDRAM), and direct rambus random access memory (DR RAM).
[0191] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or by a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered to exceed the scope of the present application.
[0192] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments, and will not be elaborated herein.
[0193] In several embodiments provided by the present application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of the devices or units can be in electrical, mechanical, or other forms.
[0194] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0195] In addition, in each embodiment of the present application, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit.
[0196] If the above functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or a part of this 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 for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs that can store program codes.
[0197] As described above, the above is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present application can easily think of changes or substitutions, which should all be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for publishing an application, characterized in that: The method comprises: The release software obtains the first configuration and the second configuration; The publishing software packages the source code of the application to be published according to the first configuration to obtain an installation package; The publishing software deploys the installation package according to the second configuration.
2. The method according to claim 1, characterized in that The publishing software deploys the installation package according to the second configuration, including: The publishing software builds a container image according to the second configuration and the installation package; The publishing software deploys the container image.
3. The method according to claim 1 or 2, characterized in that The first configuration includes version information of the application to be released, and the release software packages the source code of the application to be released according to the first configuration to obtain an installation package, including: The publishing software determines whether the version of the source code is consistent with the version information; If so, the source code is packaged according to the first configuration to obtain the installation package.
4. The method according to claim 3, characterized in that The version information includes a first version number and a first branch number of the application to be released, and the release software determines whether the version of the source code is consistent with the version information, including: The publishing software determines whether the version number of the source code is the first version number, and determines whether the branch number of the source code is the first branch number.
5. The method according to any one of claims 1 to 4, characterized in that The publishing software packages the source code of the application to be published according to the first configuration to obtain an installation package, including: When determining that there is no error in the source code, the publishing software packages the source code to obtain the installation package.
6. The method according to any one of claims 1 to 5, characterized in that The method further comprises: The publishing software changes the second configuration when obtaining the configuration change request; The publishing software redeploys the installation package according to the modified second configuration.
7. The method according to claim 6, characterized in that The configuration change request is used to request to change the first middleware configuration in the second configuration to the second middleware configuration, and the changing of the second configuration includes: The first middleware configuration included in the second configuration is changed to the second middleware configuration.
8. The method according to any one of claims 1 to 7, characterized in that The publishing software obtains the first configuration and the second configuration, including: The publishing software obtains the first configuration and the second configuration from a configuration file of the publishing software.
9. A device for publishing an application, characterized in that: The publishing device is installed with publishing software, and the publishing software includes: An acquisition module, used to acquire a first configuration and a second configuration; A packaging module, used to package the source code of the application to be released according to the first configuration to obtain an installation package; A deployment module is used to deploy the installation package according to the second configuration.
10. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed on the application publishing device, the application publishing device executes the method according to any one of claims 1 to 8.