Front-end application deployment method and device
By separating the environment code and business code of the front-end application, matching environment configuration files and image files are generated according to different environments, which solves the problem of automated deployment of front-end applications in multiple environments, improves deployment efficiency and accuracy, and reduces labor costs. and handover difficulty.
Patent Information
- Application Number
- CN202210837801.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-15
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2042-07-15
AI Technical Summary
Existing technology cannot simultaneously meet the needs of front-end applications for automated packaging and deployment according to different environments. Traditional deployment is cumbersome and inaccurate, and continuous integration automated deployment cannot adapt to multi-environment scenarios.
By separating the environment code and business code in the front-end application, the corresponding environment configuration information is automatically retrieved according to different environments, a matching environment configuration file and business image file are generated, and a complete image file is generated for deployment.
It greatly reduces the error rate and complexity of the deployment process, improves deployment efficiency, saves labor costs, reduces handover difficulty, and realizes multi-environment automated deployment of front-end applications.
Smart Images

Figure CN115016808B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet technology, and in particular to a front-end application deployment method and device. Background Art
[0002] Due to the rapid development of front-end engineering and the mainstream front-end and back-end separation architecture, the front-end also needs to be packaged and deployed separately according to the operating environment. According to the more popular front-end deployment methods at this stage, it can be roughly divided into traditional deployment and continuous integration and automated deployment. The traditional deployment method generally includes logging in to the target server, viewing the services running on the server, operating the corresponding services, and then backing up, deleting, uploading, decompressing, and finally restarting the service to complete the final front-end deployment. Continuous integration and automated deployment generally uploads the target code file to the release branch of the gitlab server through git, triggers the deployment process, and Jenkins automatically scans and pulls the target code file on the gitlab server, generates an image, and pushes the image to the harbor server to complete the automated deployment.
[0003] The above traditional deployment method can complete packaging and deployment according to different environments, but the overall process is quite cumbersome and time-consuming. Due to pure manual operation, the accuracy of all operations cannot be guaranteed. Although the above continuous integration automated deployment process is fully automated and does not require much human intervention, the dist file content has been generated after the front-end packaging in the automated process, and the environment information has been fixed, which cannot meet the scenarios of multiple environments. Therefore, there is an urgent need for a method that can meet the needs of automated packaging and deployment of front-end applications according to different environments. Summary of the invention
[0004] The purpose of the present invention is to provide a front-end application deployment method, device, electronic device and storage medium to solve the problem that the front-end application deployment in the existing network technology cannot simultaneously meet the requirements of automatic packaging and deployment according to different environments. By separating the environment code and business code in the front-end application, the corresponding environment configuration information is automatically retrieved according to different environments, the front-end deployment of each environment is automatically completed, and continuous integration and continuous deployment can be continuously carried out, which greatly reduces the error rate and tediousness of the deployment link, improves the deployment efficiency, saves labor costs, and reduces the difficulty of handover.
[0005] The present invention provides a front-end application deployment method, comprising:
[0006] Determining that the operation mode of the target application is a packaging mode; wherein the target application includes a business code;
[0007] The business code is packaged to obtain a business code file:
[0008] The environment parameters of each preset operating environment are packaged in sequence to obtain an environment configuration file corresponding to the environment parameters of each operating environment;
[0009] Based on the business code file, generate a corresponding business image file;
[0010] Combining an environment configuration file that matches the environment to be deployed, selected from the environment configuration files corresponding to the environment parameters of each operating environment, with the business image file to generate a complete image file;
[0011] Based on the complete image file, the deployment is completed.
[0012] The present invention provides a front-end application deployment method, wherein determining that the operation mode of the target application is a packaging mode comprises:
[0013] Identify the command executed by the target application and obtain an environment parameter;
[0014] Based on the environmental parameters, it is determined that the running mode of the target application is a packaging mode.
[0015] The present invention provides a front-end application deployment method, wherein the environmental parameters of each preset operating environment are packaged in sequence to obtain an environmental configuration file corresponding to the environmental parameters of each operating environment, wherein the packaging of the environmental parameters of any one of the preset environmental parameters of each operating environment includes:
[0016] Based on the predetermined environment parameters, obtain the global environment variables and custom data sources;
[0017] Based on the global environment variable and the custom data source, obtain variable configuration text;
[0018] The variable configuration text is written into an environment configuration file; wherein the environment configuration file is created by a file operation module of the operating environment.
[0019] The present invention provides a front-end application deployment method, wherein the variable configuration text is obtained based on the global environment variable and the custom data source, including:
[0020] Based on the global environment variables and the custom data source, a complete data storage object is constructed;
[0021] Based on the data storage object, according to the constraint field predetermined by the target application, a global variable object required by the target application when running is matched using regular expressions;
[0022] Based on the global variable, a variable configuration text is obtained.
[0023] The present invention provides a front-end application deployment method, wherein the global environment variables and the custom data source include a data interface used by a target application.
[0024] The present invention provides a front-end application deployment method, wherein the target application further includes an environment code and:
[0025] Packaging the environment code to obtain an initial environment configuration file;
[0026] The initial environment configuration file is associated with the business code file.
[0027] The present invention provides a front-end application deployment method, which, before determining that the operation mode of the target application is a packaging mode, further comprises:
[0028] Obtain the code file of the target application and upload the code file to the code repository;
[0029] Determine the currently deployed version of the code file, and mark the version number of the currently deployed version as a tag.
[0030] The present invention also provides a front-end application deployment device, comprising:
[0031] A packaging mode determination module, used to determine that the operation mode of the target application is a packaging mode; wherein the target application includes a business code;
[0032] A business packaging module, used to package the business code to obtain a business code file;
[0033] The environment packaging module is used to package the environment parameters of each preset operating environment in turn to obtain an environment configuration file corresponding to the environment parameters of each operating environment;
[0034] A business image generation module, used to generate a corresponding business image file based on the business code file;
[0035] A complete image generation module, used to combine an environment configuration file selected from environment configuration files corresponding to the environment parameters of each operating environment and matching the environment to be deployed with the business image file to generate a complete image file;
[0036] The deployment module is used to complete the deployment based on the complete image file.
[0037] The present invention also provides an electronic device, comprising a memory, a processor, a bus, and a computer program stored in the memory and executable on the processor, wherein the processor implements any step of the front-end application deployment method when executing the program.
[0038] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of any one of the front-end application deployment methods are implemented.
[0039] The present invention provides a front-end application deployment method and device, by determining that the operation mode of the target application is a packaging mode; wherein the target application includes a business code; the business code is packaged to obtain a business code file; the environmental parameters of each preset operating environment are packaged in turn to obtain an environment configuration file corresponding to the environmental parameters of each operating environment; based on the business code file, a corresponding business image file is generated; an environment configuration file selected from the environment configuration files corresponding to the environmental parameters of each operating environment and matching the environment to be deployed is combined with the business image file to generate a complete image file; based on the complete image file, deployment is completed. The present invention separates the business code from the front-end application, automatically retrieves the corresponding environment configuration information according to different environments, automatically completes the front-end deployment of each environment, and can continuously integrate and continuously deploy, which greatly reduces the error rate and tediousness of the deployment link, improves the deployment efficiency, and saves labor costs and reduces the difficulty of handover. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0041] Figure 1 It is a flow chart of the front-end application deployment method provided by the present invention;
[0042] Figure 2 This is a schematic diagram of the main process of front-end application packaging provided by the present invention;
[0043] Figure 3 It is a schematic diagram of the main process of front-end application automation deployment provided by the present invention;
[0044] Figure 4 It is a structural schematic diagram of the front-end application deployment device provided by the present invention;
[0045] Figure 5 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0046] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0047] Combine the following Figure 1-Figure 5 The present invention describes the front-end application deployment method, device, electronic device and storage medium.
[0048] Figure 1 is a flow chart of the front-end application deployment method provided by the present invention, such as Figure 1 As shown, a front-end application deployment method provided by the present invention comprises the following steps:
[0049] Step S110: determining that the operation mode of the target application is a packaging mode; wherein the target application includes a business code;
[0050] Step S120: Packaging the business code to obtain a business code file:
[0051] Step S130: Packaging the environment parameters of each preset operating environment in turn to obtain an environment configuration file corresponding to the environment parameters of each operating environment;
[0052] Step S140: Generate a corresponding business image file based on the business code file;
[0053] Step S150, combining an environment configuration file that matches the environment to be deployed, selected from the environment configuration files corresponding to the environment parameters of each operating environment, with the business image file to generate a complete image file;
[0054] Step S160: Complete the deployment based on the complete image file.
[0055] In a specific embodiment, the application platform of the present invention includes a K8S platform, and may also be compatible with other platforms of similar nature, such as a Docker platform. The target application refers to the front-end application to be installed. The operating mode of the target application includes a packaging mode and a development mode. The business code refers to the code in the target application stripped of environmental factors. The business code of the target application is universal in each operating environment. Each operating environment is a different deployment environment for the front-end application.
[0056] In a specific embodiment, the operation mode of the target application is first determined. When the operation mode is the packaging mode, the business code of the target application is packaged to obtain a business code file corresponding to the business code of the target application; according to the preset environmental parameters of each operating environment, the environmental parameters of each operating environment are packaged in turn to obtain its own environment configuration file corresponding to each operating environment; based on the business code file, a corresponding business image file is generated; an environment configuration file matching the environment to be deployed selected from the environment configuration files corresponding to the environmental parameters of each operating environment is combined with the business image file to generate a complete image file; based on the complete image file, the deployment process of the environment to be deployed is executed by default, and the deployment is automatically completed.
[0057] In addition, by selecting deployment processes of other to-be-deployed environments and executing the operation of step S150 , deployment processes of different operating environments can be completed.
[0058] The front-end application deployment method provided in this embodiment separates the business code from the front-end application, automatically retrieves the corresponding environment configuration information according to different environments, automatically completes the front-end deployment of each environment, and can continuously integrate and deploy continuously, which greatly reduces the error rate and tediousness of the deployment process, improves deployment efficiency, saves labor costs, and reduces the difficulty of handover.
[0059] In another embodiment, the present invention provides a front-end application deployment method, wherein determining that the operation mode of the target application is a packaging mode comprises:
[0060] Identify the command executed by the target application and obtain an environment parameter;
[0061] Based on the environmental parameters, it is determined that the running mode of the target application is a packaging mode.
[0062] In a specific embodiment, the commands executed by the target application include packaging (build, sit, test, pre), development (dev), variables, etc. The environment parameter is a field in the command executed by the target application.
[0063] In a specific embodiment, the command executed by the target application is identified, the current operating environment of the target application is acquired and parsed, an environment parameter is obtained, and according to the environment parameter, the operating mode of the target application is determined to be the packaging mode.
[0064] The front-end application deployment method provided in this embodiment strongly supports the subsequent packaging process by further disclosing the process of determining the target application operation mode, thereby supporting the adaptability and deployment efficiency of the target application to different environments.
[0065] In a third embodiment, the present invention provides a front-end application deployment method, wherein the environment parameters of each preset operating environment are packaged in sequence to obtain an environment configuration file corresponding to the environment parameters of each operating environment, wherein the packaging of the environment parameters of any one of the preset environment parameters of each operating environment includes:
[0066] Based on the predetermined environment parameters, obtain the global environment variables and custom data sources;
[0067] Based on the global environment variable and the custom data source, obtain variable configuration text;
[0068] The variable configuration text is written into an environment configuration file; wherein the environment configuration file is created by a file operation module of the operating environment.
[0069] In a specific embodiment, the global environment variable refers to the configuration required for the operation of the front-end project engineering; the custom data source refers to the data required for the operation of the business application.
[0070] In a specific embodiment, according to the predetermined environment parameters, an environment variable file is obtained, and according to the basic environment variable file, in combination with the above environment variable files, an environment variable file set is generated, wherein the basic environment variable file refers to the env file, and each operating environment generally has a corresponding env file with higher permissions than the basic environment variable file. When the two env files are finally combined, the env file of the operating environment will overwrite the basic environment variable file when there is the same configuration. Traverse each environment variable file in the environment variable file set to obtain the global environment variables and custom data sources of the environment variable file; obtain the variable configuration text according to the global environment variables and the custom data source; write the variable configuration text into the environment configuration file created by the file operation module in the operating environment to be deployed, and according to the file path exported by the predetermined current environment variable, move the created environment configuration file to the predetermined file location through the file operation module. Execute the packaging process of each environment parameter in turn, and finally obtain a variety of environment configuration files. Among them, the environment configuration file includes test files, pro files and prod files.
[0071] The front-end application deployment method provided in this embodiment strongly supports the adaptability of the target application to different environments by further exposing the environmental parameter packaging process of different preset operating environments.
[0072] In a fourth embodiment, the present invention provides a front-end application deployment method, wherein the variable configuration text is obtained based on the global environment variable and the custom data source, including:
[0073] Based on the global environment variables and the custom data source, a complete data storage object is constructed;
[0074] Based on the data storage object, according to the constraint field predetermined by the target application, a global variable object required by the target application when running is matched using regular expressions;
[0075] Based on the global variable, a variable configuration text is obtained.
[0076] In a specific embodiment, a complete data storage object is constructed based on global environment variables and custom data sources; based on the acquired data storage object and the constraint fields predetermined by the front-end target application, a global variable object required for the target application to run is matched using regular expressions; the global variable object is converted into a json string, and the json string is mounted into the global variable of the current running environment through the built-in mounting method; the data object containing the json string mounted into the global variable is frozen through the built-in freezing function of the current running environment, and finally the variable configuration text is obtained.
[0077] The front-end application deployment method provided in this embodiment strongly supports the adaptability of the target application to different environments by further exposing the specific path from global environment variables and custom data sources to generating variable configuration text.
[0078] In a fifth embodiment, the present invention provides a front-end application deployment method, wherein the global environment variables and the custom data source include a data interface used by the target application.
[0079] In a specific embodiment, the data interface is an interface that outputs data to the data connection line during data transmission, and is also a key node connecting the front-end and back-end communications.
[0080] The front-end application deployment method provided in this embodiment strongly supports the adaptability of the target application to different environments by further exposing the global environment variables and the custom data source including the data interface used by the target application.
[0081] In a sixth embodiment, the present invention provides a front-end application deployment method, wherein the target application further includes an environment code and further includes:
[0082] Packaging the environment code to obtain an initial environment configuration file;
[0083] The initial environment configuration file is associated with the business code file.
[0084] In a specific embodiment, in the existing front-end application deployment technology, especially the continuous integration automatic deployment method, the target application can only be deployed in a specific operating environment. In this embodiment, the environment code of the target application is separated and packaged to obtain an initial environment configuration file. The specific packaging process includes: identifying the command executed by the target application to obtain an environment parameter; obtaining global environment variables and custom data sources according to the obtained environment parameters, wherein the global environment variables and custom data sources contain the data interface used by the target application; constructing a complete data storage object according to the global environment variables and the custom data source; according to the obtained data storage object, using regular matching according to the constraint field predetermined by the front-end application to obtain the global variable object required for the target application to run; converting the above global variable object into a json string, and mounting the above generated json string into the global variable of the operating environment through the built-in mounting method; freezing the data object including the json string mounted in the global variable through the built-in freezing function of the operating environment, and finally obtaining a variable configuration text; creating an environment configuration file according to the file operation module of the operating environment, and writing the above generated variable configuration text into the created environment configuration text, and moving the created environment configuration file to a predetermined file location through the file operation module according to the predetermined file path, completing the association between the environment configuration file and the packaged business code file.
[0085] The front-end application deployment method provided in this embodiment achieves compatibility with traditional processing methods of front-end applications by further disclosing the packaging and processing process of the environment code that comes with the target application, and strongly supports the adaptability of the target application to different environments.
[0086] In a seventh embodiment, the present invention provides a front-end application deployment method, which, before determining that the operation mode of the target application is a packaging mode, further includes:
[0087] Obtain the code file of the target application and upload the code file to the code repository;
[0088] Determine the currently deployed version of the code file, and mark the version number of the currently deployed version as a tag.
[0089] In a specific embodiment, all code files of the target application are obtained, and all the above code files are uploaded to the code repository through a specified code upload tool, branches are merged to determine the current deployment version, and the current deployment version number is marked as a tag to complete a version release.
[0090] The front-end application deployment method provided in this embodiment strongly supports the adaptability of the target application to different environments by further exposing the pre-packaging process.
[0091] In order to better illustrate the technical solution of the present invention, Figure 2 It is a schematic diagram of the main process of front-end application packaging provided by the present invention. Figure 3 It is a schematic diagram of the main process of the front-end application automatic deployment provided by the present invention. The packaging process is an operation step in the automatic deployment. Figure 2 and Figure 3 As shown, the complete technical framework process of the present invention includes:
[0092] 1. Release the target application, i.e. the front-end application version, obtain all the code files of the target application, upload all the above code files to the code repository through the specified code upload tool, merge branches to determine the current deployment version, and mark the current deployment version number as a tag to complete a version release.
[0093] 2. Build the image, and the Jenkins service will automatically scan and trigger the deployment process; obtain the current version of the code file from the code repository, execute the script according to the Dockerfile, trigger the front-end packaging process, and wait for completion Figure 2 The packaging operation specifically includes packaging the environment code that comes with the target application and packaging the environment parameters of each preset operating environment. The specific packaging process has been described in detail in the above embodiment and will not be repeated here. At this point, the front-end packaging is completed; wait for other processes to be automatically completed, and the image of the version number has been generated.
[0094] 3. Start deployment, log in to the Jenkins management terminal, and choose to execute the above-mentioned version of the target application. By default, the deployment process of the environment to be deployed, that is, the test environment, is executed. Parallel to the test environment are also quasi-production environment, production environment or others. At this stage, you can choose to execute deployment in different environments. Each deployment process corresponds to an environment configuration file for the running environment; this process will automatically replace the initial environment configuration file, and automatically copy the configuration file of the current environment to the default configuration file directory generated by the front-end packaging. Wait for other processes to be automatically completed, and the deployment of the environment is completed.
[0095] A front-end application deployment device provided by the present invention is described below. The front-end application deployment device described below and the front-end application deployment method described above can refer to each other.
[0096] Figure 4 The structural diagram of the front-end application deployment device provided by the present invention is as follows: Figure 4 As shown, the front-end application deployment device provided by the present invention includes:
[0097] The packaging mode determination module 410 is used to determine that the operation mode of the target application is the packaging mode; wherein the target application includes an environment code and a business code;
[0098] The service packaging module 420 is used to package the service code to obtain a service code file;
[0099] The environment packaging module 430 is used to package the environment parameters of each preset operating environment in turn to obtain an environment configuration file corresponding to the environment parameters of each operating environment;
[0100] A business image generation module 440, used to generate a corresponding business image file based on the business code file;
[0101] A complete image generation module 450 is used to combine an environment configuration file selected from the environment configuration files corresponding to the environment parameters of each operating environment and matching the environment to be deployed with the business image file to generate a complete image file;
[0102] The deployment module 460 is used to complete the deployment based on the complete image file.
[0103] The front-end application deployment device provided in this embodiment separates the business code from the front-end application by setting a packaging mode determination module, a business packaging module, an environment packaging module, a business image generation module, a complete image generation module and a deployment module, automatically retrieves corresponding environment configuration information according to different environments, automatically completes the front-end deployment of each environment, and can continuously integrate and deploy continuously, which greatly reduces the error rate and tediousness of the deployment process, improves deployment efficiency, saves labor costs, and reduces the difficulty of handover.
[0104] In a specific embodiment, the present invention provides a front-end application deployment device, wherein the packaging mode determination module 410 includes:
[0105] An environment parameter acquisition unit, used to identify the command executed by the target application and obtain an environment parameter;
[0106] The packaging mode determining unit is used to determine that the running mode of the target application is the packaging mode based on the environmental parameters.
[0107] The present invention provides a front-end application deployment device, which further discloses the determination process of the target application operation mode by setting an environment parameter acquisition unit and a packaging mode determination unit, effectively supports the subsequent packaging process, and further supports the adaptability and deployment efficiency of the target application to different environments.
[0108] In a specific embodiment, the present invention provides a front-end application deployment device, wherein the environment packaging module 430 includes:
[0109] The first unit is used to obtain global environment variables and custom data sources based on predetermined environment parameters;
[0110] The second unit is used to obtain a variable configuration text based on the global environment variable and the custom data source;
[0111] The third unit is used to write the variable configuration text into an environment configuration file; wherein the environment configuration file is created by a file operation module of the operating environment.
[0112] The front-end application deployment device provided in this embodiment further discloses the environment parameter packaging process of different preset operating environments by setting the first unit, the second unit and the third unit, which strongly supports the adaptability of the target application to different environments.
[0113] In a specific embodiment, the present invention provides a front-end application deployment device, wherein the second unit includes:
[0114] A data storage object subunit, used to construct a complete data storage object based on the global environment variables and the custom data source;
[0115] A global variable object subunit is used to use regular matching to find out the global variable objects required by the target application when it is running, based on the data storage object and according to the constraint fields predetermined by the target application;
[0116] The variable configuration text subunit is used to obtain the variable configuration text based on the global variable.
[0117] The front-end application deployment device provided in this embodiment, by setting a data storage object sub-unit, a global variable object sub-unit and a variable configuration text sub-unit, further discloses the specific path starting from global environment variables and custom data sources to generating variable configuration texts, thereby effectively supporting the adaptability of the target application to different environments.
[0118] In a specific embodiment, the present invention provides a front-end application deployment device, further comprising:
[0119] An initial environment configuration file module is used to package the environment code to obtain an initial environment configuration file;
[0120] An association module is used to associate the initial environment configuration file with the business code file.
[0121] The front-end application deployment device provided in this embodiment, by setting the initial environment configuration file module and the associated module, further discloses the packaging processing process of the environment code of the target application, thereby achieving compatibility with the traditional processing method of the front-end application and strongly supporting the adaptability of the target application to different environments.
[0122] In a specific embodiment, the present invention provides a front-end application deployment device, further comprising:
[0123] A code file upload module is used to obtain the code file of the target application and upload the code file to the code repository;
[0124] The deployment version determination module is used to determine the current deployment version of the code file and mark the version number of the current deployment version as a tag.
[0125] The front-end application deployment device provided in this embodiment further discloses the pre-packaging process by setting a code file upload module and a deployment version determination module, thereby effectively supporting the adaptability of the target application to different environments.
[0126] In another aspect, the present invention further provides an electronic device, Figure 5 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 5 As shown, the electronic device may include a processor 510, a communication bus 540, a memory 530, a communication interface 520, and a computer program stored in the memory 530 and executable on the processor 510, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other via the communication bus 540, and the processor 510 may call the logic instructions in the memory 530 to execute all or part of the steps of the front-end application deployment method. The method includes:
[0127] Determining that the operation mode of the target application is a packaging mode; wherein the target application includes a business code;
[0128] The business code is packaged to obtain a business code file:
[0129] The environment parameters of each preset operating environment are packaged in sequence to obtain an environment configuration file corresponding to the environment parameters of each operating environment;
[0130] Based on the business code file, generate a corresponding business image file;
[0131] Combining an environment configuration file that matches the environment to be deployed, selected from the environment configuration files corresponding to the environment parameters of each operating environment, with the business image file to generate a complete image file;
[0132] Based on the complete image file, the deployment is completed.
[0133] Finally, the present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, all or part of the steps of the front-end application deployment method can be implemented. The method includes:
[0134] Determining that the operation mode of the target application is a packaging mode; wherein the target application includes a business code;
[0135] The business code is packaged to obtain a business code file:
[0136] The environment parameters of each preset operating environment are packaged in sequence to obtain an environment configuration file corresponding to the environment parameters of each operating environment;
[0137] Based on the business code file, generate a corresponding business image file;
[0138] Combining an environment configuration file that matches the environment to be deployed, selected from the environment configuration files corresponding to the environment parameters of each operating environment, with the business image file to generate a complete image file;
[0139] Based on the complete image file, the deployment is completed.
[0140] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0141] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0142] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A front-end application deployment method, characterized in that: include: Determining that the operation mode of the target application is a packaging mode; wherein the target application includes a business code; The business code is packaged to obtain a business code file: The environment parameters of each preset operating environment are packaged in sequence to obtain an environment configuration file corresponding to the environment parameters of each operating environment; Based on the business code file, generate a corresponding business image file; Combining an environment configuration file that matches the environment to be deployed, selected from the environment configuration files corresponding to the environment parameters of each operating environment, with the business image file to generate a complete image file; Based on the complete image file, the deployment is completed; The environmental parameters of the preset operating environments are packaged in sequence to obtain environment configuration files corresponding to the environmental parameters of the preset operating environments, wherein the packaging of the environmental parameters of any one of the preset environmental parameters of the operating environments includes: Based on the predetermined environment parameters, obtain the global environment variables and custom data sources; Based on the global environment variable and the custom data source, obtain variable configuration text; Writing the variable configuration text into an environment configuration file; wherein the environment configuration file is created by a file operation module of the operating environment; The target application also includes environment code, and further includes: Packaging the environment code to obtain an initial environment configuration file; The initial environment configuration file is associated with the business code file.
2. The front-end application deployment method according to claim 1, characterized in that: Determining that the operation mode of the target application is a packaging mode includes: Identify the command executed by the target application and obtain an environment parameter; Based on the environmental parameters, it is determined that the running mode of the target application is a packaging mode.
3. The front-end application deployment method according to claim 1, characterized in that: The obtaining of variable configuration text based on the global environment variable and the custom data source includes: Based on the global environment variables and the custom data source, a complete data storage object is constructed; Based on the data storage object, according to the constraint field predetermined by the target application, a global variable object required by the target application when running is matched using regular expressions; Based on the global variable, a variable configuration text is obtained.
4. The front-end application deployment method according to claim 1, characterized in that: The global environment variables and custom data sources include data interfaces used by the target application.
5. The front-end application deployment method according to claim 1, characterized in that: Before determining that the running mode of the target application is the packaging mode, the method further includes: Obtain the code file of the target application and upload the code file to the code repository; Determine the currently deployed version of the code file, and mark the version number of the currently deployed version as a tag.
6. A front-end application deployment device, characterized in that: include: A packaging mode determination module, used to determine that the operation mode of the target application is a packaging mode; wherein the target application includes a business code; A business packaging module, used to package the business code to obtain a business code file; The environment packaging module is used to package the environment parameters of each preset operating environment in turn to obtain an environment configuration file corresponding to the environment parameters of each operating environment; A business image generation module, used to generate a corresponding business image file based on the business code file; A complete image generation module, used to combine an environment configuration file selected from environment configuration files corresponding to the environment parameters of each operating environment and matching the environment to be deployed with the business image file to generate a complete image file; A deployment module, used to complete the deployment based on the complete image file; The environmental parameters of the preset operating environments are packaged in sequence to obtain environment configuration files corresponding to the environmental parameters of the preset operating environments, wherein the packaging of the environmental parameters of any one of the preset environmental parameters of the operating environments includes: Based on the predetermined environment parameters, obtain the global environment variables and custom data sources; Based on the global environment variable and the custom data source, obtain variable configuration text; Writing the variable configuration text into an environment configuration file; wherein the environment configuration file is created by a file operation module of the operating environment; The target application also includes environment code, and further includes: Packaging the environment code to obtain an initial environment configuration file; The initial environment configuration file is associated with the business code file.
7. An electronic device comprising a memory, a processor, a bus, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the front-end application deployment method as described in any one of claims 1 to 5 are implemented.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the front-end application deployment method as described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Software automatic deployment method and device
CN108897547A
Application management method and device, server and storage medium
CN110865840A
Service publishing method and device
CN111443923A
Project deployment method and device, electronic equipment and storage medium
CN112764753A
Method capable of quickly building multiple sets of operating environments
CN113900640A
