Code deployment method and device and electronic equipment

By implementing data packaging, incremental configuration information determination and continuous integration system-driven deployment process in the code library and configuration library, the problem of inefficient code deployment in the existing technology is solved, and automated deployment and efficient configuration management are realized.

CN119690458APending Publication Date: 2025-03-25INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411743257.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

When managing differentiated configuration information in multiple code environments, the existing technology has operational complexity and maintenance difficulty through branch or directory, resulting in low code deployment efficiency.

Method used

Provides a code deployment method, which is used to package and push data to the mirror repository when the code library receives changes, and determines incremental configuration information and target code environment when the configuration library detects change information, and deploys based on a continuous integration system.

Benefits of technology

It realizes automated deployment, improves code deployment efficiency, simplifies configuration management, reduces human errors, and improves the reliability and security of the software.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690458A_ABST
    Figure CN119690458A_ABST
Patent Text Reader

Abstract

The invention discloses a code deployment method and device and electronic equipment, and is applied to the field of financial science and technology, and the method comprises the steps: packaging first data and pushing the first data to a mirror image warehouse under the condition that a code library receives the first data, and obtaining an updated mirror image warehouse; determining incremental configuration information in the change information when it is detected that the configuration stock is in the change information; determining a target code environment corresponding to the incremental configuration information; and deploying the target code environment based on the continuous integration system according to the updated mirror image warehouse and the incremental configuration information. Through the method and the device, the problem of low code deployment efficiency caused by relatively complex inheriting or merging operation of different versions and difficulty in code maintenance when the differentiated configuration information in various code environments is managed in a branch or directory mode in related technologies is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of financial technology, and specifically, to a code deployment method, device and electronic device. Background Art

[0002] The only source of changes to environment deployment in the GitOps mode is the Git repository (hereinafter referred to as the configuration repository), which stores all the configuration information required for deployment, including Kubernetes resource files (Deployment, ConfigMap, etc.), application configuration, deployment configuration, etc. (the source code is located in the source code repository). Usually, the entire life cycle of an application involves multiple environments, such as testing, pre-release, and production, and there are parallel environments (such as functional testing environments and performance testing environments) or promotion relationships between environments (for example, the version is promoted from the test environment to the pre-release environment, and then to the production environment). Currently, there are two main ways to manage differentiated configurations in these different environments in Git: by creating different Git branches to isolate the differentiated configurations of different environments, and the promotion between environments is completed by merging branches; using the same branch, different environments are isolated by different directories, and the promotion between environments is achieved by copying and submitting the changes between directories.

[0003] The above two methods can be used in simple application development scenarios (micro-systems, few environments, low frequency of change deployment, etc.), but they are both severely limited in the complex software development model of large enterprises. In addition to the lack of security brought by the same library management of production and test configurations, there are also the following problems: When managed in a branch manner, the merging of different environments may cause configuration errors in the target environment; when managed in a directory manner, the consistent basic configuration (i.e. version configuration) between environments also lacks the ability to inherit and merge between different versions. Therefore, it is only applicable to the single-branch serial development model and cannot meet the needs of large-scale software development.

[0004] Regarding the problem of low code deployment efficiency when managing differentiated configuration information in multiple code environments through branches or directories in related technologies, due to the complexity of inheritance or merging operations of different versions and difficulty in code maintenance, no effective solution has been proposed yet. Summary of the invention

[0005] The main purpose of the present application is to provide a code deployment method, device and electronic device to solve the problem of low code deployment efficiency due to complex inheritance or merging operations of different versions and difficult code maintenance when managing differentiated configuration information in multiple code environments through branches or directories in related technologies.

[0006] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a code deployment method is provided, the method is applied to a target system, the target system includes a code library and a configuration library, the configuration library includes at least: a first configuration library and a second configuration library, the first configuration library is used to store a first type of configuration information, and the second configuration library is used to store a second type of configuration information. The method includes: when the code library receives first data, the first data is packaged and pushed to an image repository to obtain an updated image repository, wherein the first data includes at least one of the following: code information, the first type of configuration information, the first type of configuration information represents the same configuration information in multiple code environments; when it is detected that there is change information in the configuration library, the incremental configuration information in the change information is determined, wherein the incremental configuration information belongs to the second type of configuration information, and the second type of configuration represents different configuration information in the multiple code environments; determine the target code environment corresponding to the incremental configuration information; and deploy the target code environment based on the continuous integration system according to the updated image repository and the incremental configuration information.

[0007] Furthermore, before detecting that there is change information in the configuration library, the method also includes: determining code branch information under the multiple code environments in the code library; determining the first category of configuration information and the second category of configuration information based on the code branch information under the multiple code environments; constructing the first configuration library based on the first category of configuration information, and constructing the second configuration library based on the second category of configuration information; determining the configuration library based on the first category of configuration and the second category of configuration.

[0008] Further, constructing the first configuration library according to the first category configuration information includes: determining version information of the first category configuration information to obtain different versions of the first category configuration information; merging the different versions of the first category configuration information using a branch merge strategy, and constructing the first configuration library according to the merged first category configuration information, wherein the first configuration library includes: a main library and at least one slave library, each of the at least one slave library references the configuration information of the main library, the operations performed on the main library include: a read operation and a write operation, and the operations performed on the slave library include: a read operation.

[0009] Furthermore, the multiple code environments include at least: a first environment and a second environment, and constructing the second configuration library based on the second type of configuration information includes: determining first version information, and creating a first directory based on the first version information, wherein the first version information represents the version information of the first type of configuration information referenced by the first environment; determining second version information, and creating a second directory based on the second version information, wherein the second version information represents the version information of the second type of configuration information referenced by the second environment; updating the configuration information in the first directory and / or the second directory based on the second type of configuration information to obtain an updated first directory and an updated second directory; and constructing the second configuration library based on the updated first directory and the updated second directory.

[0010] Furthermore, the first data is packaged and pushed to an image repository to obtain an updated image repository, including: when the first data passes compilation, the first data is packaged into a first image; the third version information of the first data is determined through the continuous integration system, and the image tag of the first image is determined according to the third version information; according to the image tag of the first image, the tag information of the deployment template in the configuration library is updated through the continuous integration system, wherein the deployment template represents a template of instructions for deploying applications in the multiple code environments; the first image is pushed to the image repository to obtain the updated image repository.

[0011] Furthermore, the first data includes at least: the first category of configuration information, deploying the target code environment based on the continuous integration system according to the updated image repository and the incremental configuration information, including: updating the configuration reference information in the second configuration repository according to the third version information to obtain an updated second configuration repository, wherein the configuration reference information represents reference information of the second category of configuration information in the second configuration repository that references the first category of configuration information; generating deployment information based on the continuous integration system according to the first image in the updated image repository, the updated second configuration repository, the first category of configuration information and the incremental configuration information; and deploying the target code environment according to the deployment information when the deployment information passes the review.

[0012] Furthermore, after determining the configuration library based on the first type of configuration and the second type of configuration, the method also includes: when changed configuration information in the first configuration library is detected, updating the configuration information in the second configuration library based on the changed configuration information of the first configuration library through a continuous integration system.

[0013] Furthermore, before determining the incremental configuration information in the change information, the method also includes: receiving change configuration information from other business systems to obtain other configuration information; determining the first type of configuration information referenced by the other configuration information to obtain reference configuration information; updating the second configuration library based on the other configuration information and the reference configuration information, and determining that change information exists in the configuration library, and executing the step of determining the incremental configuration information in the change information.

[0014] In order to achieve the above-mentioned purpose, according to another aspect of the present application, a code deployment device is provided, the device deploys a target system, the target system includes a code library and a configuration library, the configuration library includes at least: a first configuration library and a second configuration library, the first configuration library is used to store a first type of configuration information, and the second configuration library is used to store a second type of configuration information. The device includes: a packaging unit, which is used to package the first data and push it to the image repository when the code library receives the first data, so as to obtain an updated image repository, wherein the first data includes at least one of the following: code information, the first type of configuration information, and the first type of configuration information represents the same configuration information in multiple code environments; a first determination unit, which is used to determine the incremental configuration information in the change information when it is detected that the configuration library has change information, wherein the incremental configuration information belongs to the second type of configuration information, and the second type of configuration represents different configuration information in the multiple code environments; a second determination unit, which is used to determine the target code environment corresponding to the incremental configuration information; and a deployment unit, which is used to deploy the target code environment based on the continuous integration system according to the updated image repository and the incremental configuration information.

[0015] Furthermore, the device also includes: a third determination unit, used to determine the code branch information under the multiple code environments in the code library before detecting that there is change information in the configuration library; a fourth determination unit, used to determine the first type of configuration information and the second type of configuration information based on the code branch information under the multiple code environments; a construction unit, used to construct the first configuration library based on the first type of configuration information, and to construct the second configuration library based on the second type of configuration information; a fifth determination unit, used to determine the configuration library based on the first type of configuration and the second type of configuration.

[0016] Further, the construction unit includes: a first determination subunit, used to determine version information of the first type of configuration information, and obtain different versions of the first type of configuration information; a first construction subunit, used to merge the different versions of the first type of configuration information using a branch merge strategy, and build the first configuration library based on the merged first type of configuration information, wherein the first configuration library includes: a main library, at least one slave library, each of the at least one slave library references the configuration information of the main library, the operations performed on the main library include: read operations, write operations, and the operations performed on the slave library include: read operations.

[0017] Furthermore, the multiple code environments include at least: a first environment and a second environment, and the construction unit includes: a first creation subunit, used to determine the first version information, and create a first directory based on the first version information, wherein the first version information represents the version information of the first type of configuration information referenced by the first environment; a second creation subunit, used to determine the second version information, and create a second directory based on the second version information, wherein the second version information represents the version information of the second type of configuration information referenced by the second environment; a first update subunit, used to update the configuration information in the first directory and / or the second directory based on the second type of configuration information to obtain an updated first directory and an updated second directory; a second construction subunit, used to construct the second configuration library based on the updated first directory and the updated second directory.

[0018] Furthermore, the packaging unit includes: a packaging subunit, used to package the first data into a first image when the first data passes compilation; a second determination subunit, used to determine the third version information of the first data through the continuous integration system, and determine the image tag of the first image based on the third version information; a second update subunit, used to update the tag information of the deployment template in the configuration library through the continuous integration system based on the image tag of the first image, wherein the deployment template represents a template of instructions for deploying applications in the multiple code environments; a pushing subunit, used to push the first image to an image repository to obtain the updated image repository.

[0019] Furthermore, the first data at least includes: the first category of configuration information, and the deployment unit includes: a third updating sub-unit, used to update the configuration reference information in the second configuration repository according to the third version information to obtain an updated second configuration repository, wherein the configuration reference information represents the reference information of the second category of configuration information in the second configuration repository that references the first category of configuration information; a generating sub-unit, used to generate deployment information based on the continuous integration system according to the first image in the updated image repository, the updated second configuration repository, the first category of configuration information and the incremental configuration information; a deploying sub-unit, used to deploy the target code environment according to the deployment information if the deployment information passes the review.

[0020] Furthermore, the device also includes: a first updating unit, which is used to update the configuration information in the second configuration library based on the changed configuration information of the first configuration library through a continuous integration system after determining the configuration library based on the first type of configuration and the second type of configuration, when the changed configuration information in the first configuration library is detected.

[0021] Furthermore, the device also includes: a receiving unit, used to receive change configuration information of other business systems before determining the incremental configuration information in the change information, so as to obtain other configuration information; a fifth determination unit, used to determine the first type of configuration information referenced by the other configuration information, so as to obtain referenced configuration information; a second update unit, used to update the second configuration library based on the other configuration information and the referenced configuration information, and determine that there is change information in the configuration library, and execute the step of determining the incremental configuration information in the change information.

[0022] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a computer program product is provided, including a computer program, which, when executed by a processor, implements any one of the above-mentioned code deployment methods, and which, when executed by a processor, implements the steps of the code deployment method described in each embodiment of the present application.

[0023] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes stored computer instructions, wherein when the computer instructions are executed by a processor, any one of the above-mentioned code deployment methods is implemented.

[0024] In order to achieve the above-mentioned purpose, according to one aspect of the present application, an electronic device is provided, including one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by one or more processors, the one or more processors implement any one of the above-mentioned code deployment methods.

[0025] In an embodiment of the present application, when the code library receives first data, the first data is packaged and pushed to the image repository to obtain an updated image repository, wherein the first data includes at least one of the following: code information, the first type of configuration information, the first type of configuration information representing the same configuration information in multiple code environments; when it is detected that there is change information in the configuration library, the incremental configuration information in the change information is determined, wherein the incremental configuration information belongs to the second type of configuration information, and the second type of configuration represents different configuration information in the multiple code environments; the target code environment corresponding to the incremental configuration information is determined; based on the continuous integration system, the target code environment is deployed according to the updated image repository and the incremental configuration information, so as to achieve the purpose of automated deployment, thereby realizing the technical effect of improving the efficiency of code deployment, and further solving the technical problem of low code deployment efficiency due to complex inheritance or merging operations of different versions and difficult code maintenance when managing differentiated configuration information in multiple code environments through branches or directories.

[0026] By receiving the incremental configuration information in the first data and configuration library, the image repository and the environment library can be updated through the continuous integration system, so that the code is deployed in the target code environment according to the updated image repository and the incremental configuration information, thereby achieving the effect of automated deployment, making the deployment and configuration management of applications more automated and standardized, which helps to improve the efficiency of software development and operation and maintenance, facilitates subsequent rollbacks and audits, reduces human errors, and improves the reliability and security of software. At the same time, by building the first configuration library and the second configuration library, the decoupling of the basic configuration and the environment-specific configuration is achieved, which facilitates the maintenance of configuration information in multiple code environments and achieves the effect of improving the efficiency of code deployment. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0028] Figure 1 It is a hardware structure block diagram of a computer terminal (or mobile device) for implementing a code deployment method provided in accordance with Embodiment 1 of the present application;

[0029] Figure 2 is a flowchart of an optional code deployment method provided according to Embodiment 1 of the present application;

[0030] Figure 3 It is a schematic diagram of an optional GitOps-based code, configuration, and image push process provided according to Embodiment 1 of the present application;

[0031] Figure 4 It is a schematic diagram of the synchronization relationship between the optional basic library and the environment library provided according to the first embodiment of the present application;

[0032] Figure 5 It is a schematic diagram summarizing the optional code, configuration and image push process provided according to the first embodiment of the present application;

[0033] Figure 6 is a schematic diagram of a code deployment device provided according to Embodiment 2 of the present application;

[0034] Figure 7 It is a schematic diagram of deploying electronic equipment according to the code provided in Example 5 of the present application. DETAILED DESCRIPTION

[0035] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0036] It should be noted that the methods and devices determined by the processing methods, devices, storage media and electronic devices of the present application documents can be used in the process of managing configuration information in multiple code environments in the financial technology field to improve the efficiency of code deployment, and can also be used in any field other than the financial technology field. The application fields of the methods and devices determined by the processing methods, devices, storage media and electronic devices of the present application documents are not limited.

[0037] It should be noted that the collected information (including but not limited to user device information, user personal information, collected data, used data, generated data, processed data, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, collected information, used information, generated information, processed information, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data are in compliance with the relevant laws, regulations and standards of relevant countries and regions, necessary confidentiality measures are taken, and public order and good customs are not violated, and corresponding operation entrances are provided for users to choose to authorize or refuse. For example, an interface is set up between this system and relevant users or institutions to provide users with corresponding operation entrances for users to choose to agree or refuse the results of automated decision-making; if the user chooses to refuse, the expert decision-making process will be entered.

[0038] Example 1

[0039] According to an embodiment of the present application, a method embodiment of code deployment is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0040] The method embodiment provided in the first embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 FIG. 1 shows a hardware structure block diagram of a computer terminal (or mobile device) for implementing a code deployment method. Figure 1 As shown, the computer terminal 10 (or mobile device) may include one or more (shown in the figure as 102a, 102 code deployment, ..., 102n) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (US code deployment) port (which may be included as one of the ports of the code deployment US bus), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0041] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10 (or mobile device). As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0042] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the code deployment method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, the above-mentioned code deployment method is realized. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0043] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0044] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).

[0045] Under the above operating environment, this application provides Figure 2 The code deployment method shown. The method is applied to a target system, the target system includes a code library and a configuration library, the configuration library includes at least: a first configuration library and a second configuration library, the first configuration library is used to store a first type of configuration information, the second configuration library is used to store a second type of configuration information, Figure 2 It is a flowchart of the code deployment method according to Example 1 of the present application.

[0046] The execution subject of the code deployment method provided in the first embodiment of the present application can be the target system. The target system includes: a continuous integration and continuous deployment system (CI / CD system, hereinafter referred to as the continuous integration system), which is responsible for automatically detecting code and configuration changes, building and testing applications, updating image repositories and deployment templates, and synchronizing changes to the environment library, and triggering the GitOps tool for environment deployment; the GitOps tool is used to monitor changes in the configuration library, automatically execute deployment or send exception notifications, identify configuration changes from the basic library to the environment library, and automatically apply them to the target environment, while tracking and feedbacking the deployment status; the container image building tool is used to build container images from source code and basic configurations, read files such as Dockerfile, package the code and configuration into images, and push them to the image warehouse. In addition, the target system may also include an automated testing tool for verifying the correctness and security of configuration changes of the basic library and the environment library. The automated testing tool performs unit testing, integration testing, and system testing to ensure that the application functions and performance meet the requirements.

[0047] Step S201, when the code library receives the first data, the first data is packaged and pushed to the image repository to obtain an updated image repository, wherein the first data includes at least one of the following: code information, first-category configuration information, and the first-category configuration information represents the same configuration information in multiple code environments.

[0048] In the first embodiment of the present invention, when a developer submits a new code change (code information) in the code base or modifies the basic configuration (first type of configuration information) that remains consistent between environments, it is deemed to have received the "first data". The code base is a centralized storage and version management warehouse for all application source codes. The continuous integration system generates a new container image using a container building tool (such as Docker) based on the extracted first data. The container image contains the executable code of the application and all necessary runtime dependencies, including libraries, environment variables, and basic configuration information. This process is usually based on definition files such as Dockerfile, which specify the steps for image building and the selection of the base image.

[0049] After the container image is built, the continuous integration system pushes the new container image to the image repository (any system that supports image storage and distribution). The image repository receives and stores the new container image, and after updating, it forms an "updated image repository". This means that the image repository now contains the latest application image version, which can be used for subsequent code deployment operations.

[0050] By packaging code and configuration, building images, and pushing images, you can eventually get an updated image repository for automated deployment in subsequent environments. This not only improves deployment efficiency and reliability, but also enhances security, making it an ideal choice for large enterprises to deploy multiple environments.

[0051] Step S202, when it is detected that there is change information in the configuration library, determine the incremental configuration information in the change information, wherein the incremental configuration information belongs to the second type of configuration information, and the second type of configuration represents different configuration information in multiple code environments.

[0052] In the first embodiment, the GitOps tool continuously monitors the configuration repository, which is a repository that stores all configuration information related to code deployment, such as Kubernetes resource files, application configurations, deployment strategies, etc. When a new commit or change is detected in the configuration repository, the GitOps tool responds immediately.

[0053] After detecting the changes, the GitOps tool needs to identify which of these change information are configuration changes that are different between environments, that is, changes in the second type of configuration information. The second type of configuration information has specific configuration requirements for different code environments (such as development, testing, pre-release, production, etc.), and these configurations are different in each environment, for example, database connection information, access control lists, resource restrictions, etc. in different environments.

[0054] Incremental configuration information refers to the specific configuration items that need to be adjusted or updated for a certain environment (or multiple environments) in this change. This may include newly added configurations, modified parameters, or deleted configuration items. The GitOps tool analyzes the specific content of the change submission to determine which configuration information is an incremental change for a specific environment and prepares to apply this information to the corresponding environment.

[0055] The GitOps tool updates the determined incremental configuration information (changes to the second type of configuration information) to the environment library (env library, i.e. the second configuration library mentioned above), which is a repository for storing specific configurations for each environment. For each environment, the directory in the env library records the referenced basic library version (i.e. the first configuration library mentioned above) and the differentiated configuration of the environment. The GitOps tool adds the incremental configuration information to the directory of the corresponding environment and prepares for incremental deployment.

[0056] Through the above steps, the management problem of configuration differences between environments is effectively solved. By subdividing the change information in the configuration library into the basic library and the environment library, only the incremental changes of the environment-specific configuration (i.e., the second type of configuration information) are detected, analyzed, packaged, and deployed, thereby avoiding the confusion and conflict of configuration between environments, reducing maintenance costs and deployment risks. At the same time, such a mechanism ensures that configuration changes can be accurately tracked, enhancing the traceability and controllability of the deployment process.

[0057] Step S203: determine the target code environment corresponding to the incremental configuration information.

[0058] In the first embodiment, the GitOps tool checks each environment directory in the environment library (env library) to find the marked or referenced environment corresponding to the change information. Each environment directory in the environment library stores the version information of the base library (base library) referenced by the environment and the differential configuration information of the environment library. Therefore, by matching the change information and the directory information in the environment library, the target code environment affected by the incremental configuration change is determined, and then code is deployed to the target code environment.

[0059] The target code environment refers to the environment where these incremental configuration information needs to be deployed (or applied), such as the test environment, pre-release environment, or production environment. After the target environment is determined, further deployment operations will only be performed on these environments to avoid unnecessary interference with unaffected environments.

[0060] By determining the target code environment, it is ensured that configuration changes can be applied to the required environment in a targeted manner without affecting the stability and configuration status of other environments, which helps to improve deployment efficiency, reduce operational risks, and meet the specific needs of different environments.

[0061] Step S204: deploy the target code environment based on the continuous integration system according to the updated image repository and incremental configuration information.

[0062] In the first embodiment, the continuous integration system continuously monitors the changes in the code base and configuration base. The continuous integration system determines the target code environment (such as a test environment, a pre-release environment, or a production environment) to be deployed based on the changes. The target code environment refers to the environment where the latest image and configuration changes need to be applied.

[0063] The continuous integration system references the latest container image from the updated image repository and obtains incremental configuration information from the environment library (env library), that is, the specific configuration that needs to be modified in the target code environment. Then, the incremental configuration information is applied to the deployment template. Exemplarily, it includes updating the definitions of Kubernetes' Deployment, Service, ConfigMap and other resources to ensure that they reference the correct image version and contain the latest environment-specific configuration. The GitOps tool pushes incremental configuration information to the Kubernetes cluster to achieve incremental deployment of applications. During the incremental deployment process, the container of the Kubernetes cluster will pull the image from the image repository according to the image tag in the deployment template, and start or update the container instance according to the image content and Kubernetes resource definition.

[0064] In an optional embodiment, the modified configuration file of the target code environment will be submitted to relevant personnel for approval, such as operation and maintenance personnel or security administrators. The relevant personnel will check whether the updated configuration meets the requirements and security policies of the environment. If approved, the deployment will be allowed to continue.

[0065] Deploying the target code environment based on the updated image repository and incremental configuration information based on the continuous integration system is an automated, standardized and controllable process. It ensures that the latest version of the application and environment-specific configuration can be accurately and efficiently deployed to the target environment, while meeting the security and compliance requirements of enterprise-level software development and operation and maintenance scenarios.

[0066] Optionally, in the code deployment method provided in Example 1 of the present application, before detecting that there is change information in the configuration library, the method also includes: determining code branch information under multiple code environments in the code library; determining first-category configuration information and second-category configuration information based on the code branch information under multiple code environments; constructing a first configuration library based on the first-category configuration information, and constructing a second configuration library based on the second-category configuration information; determining the configuration library based on the first-category configuration and the second-category configuration.

[0067] In the first embodiment of the present invention, it is necessary to analyze the branch structure in the code base to determine the code branch information related to various code environments. In large software development projects, the code base usually contains multiple branches, each branch corresponding to a different development stage or environment, such as a development branch, a test branch, a pre-release branch, and a production branch. By determining this branch information, the code branches related to different code environments can be determined.

[0068] After clarifying the branch structure of the code base, based on this branch information, distinguish and determine the first and second types of configuration information from the code base and existing configuration information. The first type of configuration information refers to the basic configuration information that remains consistent between multiple code environments. These configurations are the same in all code environments, such as the code version, library version, etc. The second type of configuration information is information that may be different in different code environments, for example, environment-specific configurations such as database connections, service ports, and resource limits for each code environment.

[0069] Based on the first type of configuration information, build a base library. The base library mainly stores and manages consistent basic configurations between environments. These configurations may come directly from a specific branch in the code library, or may be independently defined outside the code library. The construction of the base library ensures that all environments follow a unified basic configuration version, simplifying the complexity of version synchronization and maintenance.

[0070] Based on the second type of configuration information, an environment library (env library) is built. The environment library provides a configuration directory for each specific code environment, storing the basic library version information referenced by the code environment and the differentiated configuration specific to the code environment. This allows the configuration of each code environment to be managed independently while keeping it synchronized with the version of the basic library, avoiding the configuration merging problems caused by traditional directory or branch management methods.

[0071] Finally, by combining the first type of configuration (basic library) and the second type of configuration (environmental library), the complete configuration library structure is determined, that is, the configuration library mentioned above. The configuration library contains the configuration information of all environments. At the same time, the flexibility and security of the configuration are ensured by distinguishing the management of the basic library and the environment library. In actual operation, this usually means that the continuous system will pull the configuration from the basic library and the environment library to generate the final deployment template for the automated deployment of each code environment.

[0072] Through the above steps, the configuration management in various code environments is optimized. Through clear classification and independent library management, the uniformity of basic configuration and the flexibility of environment configuration are achieved, thereby improving the efficiency and security of switching and deployment between different environments of large software projects. This is a well-designed and easy-to-operate GitOps multi-environment configuration management solution that helps ensure the smooth progress of software development, testing and production.

[0073] Optionally, in the code deployment method provided in Example 1 of the present application, a first configuration library is constructed based on the first type of configuration information, including: determining version information of the first type of configuration information to obtain different versions of the first type of configuration information; merging different versions of the first type of configuration information using a branch merge strategy, and constructing the first configuration library based on the merged first type of configuration information, wherein the first configuration library includes: a main library, at least one slave library, each of the at least one slave library references the configuration information of the main library, the operations performed on the main library include: read operations and write operations, and the operations performed on the slave library include: read operations.

[0074] In the first embodiment, in the code base, the first type of configuration information (i.e., the basic configuration information that remains consistent between environments) is stored in a specific branch (such as a trunk branch, etc.), and these configuration information may change multiple times over time, and each change will generate a new Git commit, thereby forming different versions. By analyzing the Git commit history, multiple versions of these first type of configuration information can be determined.

[0075] To ensure that all environments use a unified base configuration, different versions of the first-class configuration information need to be merged to integrate the latest changes. The branch merge strategy defines how to merge updates from one branch (such as updates to the trunk branch) into other branches (for example, specific environment branches or slave branches). The branch merge strategy ensures that updates to the base configuration can be stably applied to all relevant environments, while avoiding configuration conflicts or deployment failures caused by improper merging.

[0076] Based on the merged first-category configuration information, a first configuration library (basic library, or base library) is constructed. The first configuration library is divided into a master library and at least one slave library. The master library is used to manage the base library and can perform read and write operations, that is, add, update or delete configuration information. Each slave library references the configuration information of the master library, which is used for environmental library references in different code environments and can only perform read operations. The existence of slave libraries can meet the needs of different physically isolated areas. For example, the test environment may have a slave library and the production environment may have another slave library. Each slave library can pull the latest basic configuration information from the master library while complying with local security policies and network isolation policies.

[0077] In order to maintain the consistency of configuration information between the master and slave databases, the slave database pulls the latest first-class configuration information from the master database periodically or when triggered by a specific event (such as master database update) through a one-way synchronization strategy. This ensures that each slave database is synchronized with the master database and uses the latest configuration information, thus avoiding deployment problems and maintenance complexity caused by information asynchrony.

[0078] Once the first configuration library (including the master library and the slave library) is built and synchronized, the continuous integration system can obtain the first type of configuration information from the corresponding configuration library for building and deploying container images. During deployment, the GitOps tool will pull the configuration information of a code environment from the environment library (env library), combine it with the basic configuration information obtained from the base library (base library), generate the final deployment template, and realize the correct deployment of the application in the target environment.

[0079] Through the branch merge strategy and master-slave library structure, different versions of the first type of configuration information (basic configuration information) are effectively managed, ensuring that all environments can use a unified and latest basic configuration, while meeting physical isolation and security requirements, reducing the complexity and risk of configuration management, and improving the efficiency and consistency of software deployment.

[0080] Optionally, in the code deployment method provided in Example 1 of the present application, multiple code environments include at least: a first environment, a second environment, and building a second configuration library based on the second type of configuration information, including: determining the first version information, and creating a first directory based on the first version information, wherein the first version information represents the version information of the first type of configuration information referenced by the first environment; determining the second version information, and creating a second directory based on the second version information, wherein the second version information represents the version information of the second type of configuration information referenced by the second environment; updating the configuration information in the first directory and / or the second directory based on the second type of configuration information to obtain an updated first directory and an updated second directory; and building a second configuration library based on the updated first directory and the updated second directory.

[0081] In the first embodiment of the present invention, the first version information of the first type of configuration information referenced by a specific code environment (i.e., the first environment mentioned above, for example, the test environment) is determined. The first type of configuration information refers to basic configurations that remain consistent in all code environments, such as system parameters, version numbers, etc. The first version information is used to create a first directory corresponding to the environment. The first directory stores the first version information referenced by the first environment.

[0082] Then, determine the second version information of the second type of configuration information referenced by another specific environment (i.e., the second environment mentioned above, for example, the production environment). The second type of configuration information refers to configuration information that is different in different code environments, such as database connection information, service port configuration, etc. The second version information is used to create a second directory corresponding to the second environment, which is used to store specific configuration information of the second environment. When there are updates to the second type of configuration information, these updates will be applied to the relevant first directory and / or second directory. Specifically, if the update of the second type of configuration information includes an update of the version information of the first type of configuration referenced by the second environment, the first version information in the first directory will be updated; if the update only involves configuration information in a specific second environment (i.e., affects the second type of configuration), only the second directory will be updated accordingly, so that each directory contains the latest configuration information related to the environment.

[0083] The updated first directory and the second directory constitute the second configuration library (env library). The second configuration library is a configuration library specifically used to store and manage environment-specific configuration information. It distinguishes different code environments through different directories. The configuration information under each directory reflects the specific requirements of the environment. At the same time, the first version information in the directory corresponds to the version in the first configuration library (base library), ensuring the consistency and traceability of the first and second configuration information.

[0084] It should be noted that the first environment and the second environment described above are only some examples of the various code environments, and are not the entire contents of the second configuration library. In actual production situations, directories corresponding to various code environments can be configured in the second configuration library according to actual needs to form the above-mentioned second configuration library (env library).

[0085] Through the above steps, the second configuration library (env library) can accurately reflect the configuration status of each code environment. When there is a new configuration update, the second configuration library can be updated quickly and accurately, reducing configuration errors and deployment problems, improving the efficiency and reliability of software deployment, and at the same time, avoiding the complexity and potential conflicts in traditional branch merging, simplifying configuration management in multiple environments.

[0086] Optionally, in the code deployment method provided in Example 1 of the present application, the first data is packaged and pushed to the image repository to obtain an updated image repository, including: when the first data passes the compilation, the first data is packaged into a first image; the third version information of the first data is determined through the continuous integration system, and the image tag of the first image is determined based on the third version information; based on the image tag of the first image, the tag information of the deployment template in the configuration library is updated through the continuous integration system, wherein the deployment template represents a template of instructions for deploying applications in multiple code environments; the first image is pushed to the image repository to obtain an updated image repository.

[0087] In the first embodiment, the first data refers to the front-end code, the back-end code or any source code that needs to be compiled. After these codes pass the compilation check and build process of the continuous integration system, they will be packaged into a Docker image or other container image format. This image contains all the dependencies and environment configurations required for the code and its operation, and is called the first image.

[0088] The continuous integration system will record the version information of the first data (i.e. source code) during the image packaging process. This information can be the hash value, version number or other identifier submitted by Git, which is called the third version information. This information ensures the correlation between the image and the code version, so that specific code changes can be traced back during deployment.

[0089] Based on the third version information, the continuous integration system determines an image tag for the first image. An image tag is a string used to identify and distinguish different image versions. It usually contains a version number and / or a build date and time stamp to facilitate the management and deployment of different versions of images. The image tag is a key identifier in the deployment process. GitOps tools or Kubernetes clusters determine the image version required for deployment based on the image tag.

[0090] The continuous integration system will update the deployment template, and update the image reference from the old version's tag information to the newly generated first image's image tag. A deployment template is an instruction template for deploying an application in a code environment, including but not limited to: Kubernetes Deployment, Service, ConfigMap and other resource configuration information. Updating the deployment template ensures that when the GitOps tool detects changes in the configuration library, it can identify the update of the image version and perform the corresponding incremental deployment.

[0091] Finally, the first image will be pushed to the image repository. This process may involve steps such as image signing and security scanning to ensure the quality and security of the image. Once the first image is successfully pushed to the image repository, the image repository is updated to an updated image repository containing the latest version of the image, providing the latest image resources for subsequent deployment operations.

[0092] Through the automated management of the continuous integration system, the compilation, packaging, version control, deployment template updates and synchronization of image repositories are ensured, providing a solid foundation for multi-environment deployment based on GitOps. This approach achieves traceability, automation and reliability of software delivery, helping to improve deployment efficiency and reduce human errors.

[0093] Optionally, in the code deployment method provided in Example 1 of the present application, the first data includes at least: a first type of configuration information, and deploys the target code environment based on the continuous integration system according to the updated image repository and the incremental configuration information, including: updating the configuration reference information in the second configuration repository according to the third version information to obtain an updated second configuration repository, wherein the configuration reference information represents the reference information of the second type of configuration information in the second configuration repository that references the first type of configuration information; generating deployment information based on the continuous integration system according to the first image in the updated image repository, the updated second configuration repository, the first type of configuration information and the incremental configuration information; and deploying the target code environment according to the deployment information when the deployment information passes the review.

[0094] In the first embodiment of the present invention, the first data generally refers to the code, configuration information or other parameter information uploaded by the user. In the case where the first data uploaded by the user includes the first type of configuration information, it is determined that there is a change in the first type of configuration information, and the continuous integration system will use the third version information (i.e., the version information of the first data) to update the configuration reference information in the second configuration library (env library). The configuration reference information refers to the specific version of the first type of configuration information in the base library referenced by the second type of configuration information in the env library (i.e., environment-specific configuration, such as database connection, service port, etc.). By updating these reference information, each environment directory in the env library can point to the correct version of the first type of configuration information, ensuring that the latest basic configuration can be used when the environment is deployed.

[0095] After the above update process is completed, the second configuration library (env library) will be updated to reflect the latest configuration reference information, thereby obtaining an updated second configuration library. This step ensures the consistency and traceability of configurations in all environments and is the key to multi-environment configuration management.

[0096] The continuous integration system generates detailed deployment information based on the first image in the updated image repository, the updated second configuration repository, the first type of configuration information, and the incremental configuration information (i.e., changes to the second type of configuration information for a specific environment in the env repository). The deployment information contains all the necessary parameters and instructions for application deployment, and is a set of instructions for Kubernetes environment deployment.

[0097] Finally, after the deployment information is generated, it will go through the review process of staff (e.g., developers, operations personnel, managers, etc.) to ensure that all configurations and image versions are correct. The review may involve code review, configuration check, security scan, and other aspects. Once the deployment information passes the review, the continuous integration system will automatically deploy the target code environment based on this information. This may include updating Kubernetes Deployment, Service and other resources to ensure that the application runs correctly in the target code environment.

[0098] The automation of the continuous integration system and the continuous delivery mechanism of GitOps ensure the accuracy and security of software deployment. At the same time, through the differentiated management of the first configuration library and the second configuration library, the basic configuration and environment-specific configuration are decoupled, which improves the flexibility and efficiency of configuration management. In this way, software deployment and configuration management become more traceable and verifiable, which helps to improve the reliability and security of software delivery.

[0099] Optionally, in the code deployment method provided in Example 1 of the present application, after determining the configuration library based on the first type of configuration and the second type of configuration, the method also includes: when changed configuration information in the first configuration library is detected, updating the configuration information in the second configuration library based on the changed configuration information of the first configuration library through the continuous integration system.

[0100] In the first embodiment of the present invention, the continuous integration system continuously monitors the configuration information of the first configuration library (i.e., the base library). The first configuration library stores the basic configuration information shared by all environments, such as common system parameters, version numbers, etc. Once a change in the configuration information in the first configuration library is detected, the continuous integration system will automatically trigger an update process to update the second configuration library (i.e., the environment library, env library), which contains the configuration information of multiple code environments (such as test, pre-release, and production environments).

[0101] The continuous integration system obtains the specific modification content and version information based on the changed configuration information. This may involve analyzing the Git commit history to determine which configuration files have been modified and the specific content of the modifications. The continuous integration system merges the changed configuration information obtained from the first configuration repository into the corresponding environment directory in the second configuration repository. Since each environment directory in the env repository references a specific version of the first-class configuration information in the base repository, when the configuration information in the base repository is updated, the configuration information in the env repository also needs to be updated accordingly to keep in sync with the latest first configuration repository (i.e., the base repository). This usually involves adjusting the version information that references the first-class configuration information in the environment directory to ensure that they reference the latest base configuration version.

[0102] The continuous integration system ensures seamless updates of configuration information from the basic library to the environment library, enabling rapid propagation of configuration changes and consistency of environment deployment. This approach reduces the need for manual intervention and improves the efficiency and reliability of software deployment.

[0103] Optionally, in the code deployment method provided in Example 1 of the present application, before determining the incremental configuration information in the change information, the method also includes: receiving change configuration information from other business systems to obtain other configuration information; determining the first type of configuration information referenced by the other configuration information to obtain reference configuration information; updating the second configuration library based on the other configuration information and the reference configuration information, and determining that the change information exists in the configuration library, and executing the step of determining the incremental configuration information in the change information.

[0104] In the first embodiment of the present invention, in the scenario of multi-system integration or business linkage, the continuous integration system or GitOps tool will receive configuration change information from other business systems. This information may involve modification of existing configurations, addition of new configuration items, or deletion of configuration items, collectively referred to as other configuration information. The sources of receiving configuration change information may include, but are not limited to, user interface operations, automated test results, performance monitoring indicators, etc.

[0105] After receiving other configuration information, it is necessary to determine whether the other configuration information references the first type of configuration information (i.e., basic configuration information, stored in the first configuration library base library). By determining the referenced configuration information, it can be ensured that when the second type of configuration information is updated, the first type of configuration information remains consistent and will not be accidentally modified.

[0106] Based on the other configuration information received and the referenced first-class configuration information, the continuous integration system will update the second configuration library (i.e., environment library, env library). The update process may include modifying the configuration files in a specific environment directory or the version information of the referenced first-class configuration information to reflect the latest changes in environment-specific configuration and basic configuration. The configuration information in each environment directory in the env library will be checked and updated to ensure synchronization with the latest first-class configuration information in the base library and reflect the changed configuration information of other business systems.

[0107] After the second configuration library (ie, environment library, env library) is updated according to other configuration information of other business systems, it is determined that there is change information in the configuration library, and the above-mentioned step of determining incremental configuration information in the change information is performed.

[0108] Through the above process, the continuous integration system or GitOps tool realizes the automated process of receiving configuration changes from other business systems, updating the environment library and determining incremental configuration information, ensuring the accuracy and efficiency of configuration management, while also enhancing the ability of multi-system integration and automated deployment. In this way, the management of configuration changes is more refined and controllable, which helps to improve the stability and security of software delivery.

[0109] Optionally, in the first embodiment, a schematic diagram of a code, configuration and image push process based on GitOps in this solution can be as follows: Figure 3 As shown. Figure 3 As you can see in the figure, the application code is pushed out from the code repository, which triggers the continuous integration (CI) process to start building and testing the code. Once the code passes the test, the image will be built and pushed to the image repository. At the same time, the GitOps tool monitors changes in the repository files. Once a configuration change is detected, it will pull the new image and update the application configuration in the Kubernetes cluster. In this process, the continuous integration system obtains external dependency configurations and includes these configurations in the GitOps management scope, simplifying the emergency rollback process. By approving changes, the accuracy of configuration updates can be ensured. Once the change is approved, the GitOps tool will push the configuration to the Kubernetes cluster to achieve incremental deployment of the application, ensuring a smooth transition to the new version while retaining the old version for quick rollback when needed. This figure presents the entire process of the configuration management method in a visual way, showing the automated delivery and deployment between code, configuration, and images.

[0110] Optionally, in the first embodiment, a schematic diagram of the synchronization relationship between a basic library and an environment library in the present solution can be as follows: Figure 4 shown. Figure 4Describes the synchronization relationship between the base library and the environment library, as well as the handling of external dependency configuration in the configuration management method. The figure shows different code environments (such as Figure 4 The synchronization process between a master library and two slave libraries in the production environment, pre-release environment library, and test environment library in the continuous integration. The master library is responsible for version maintenance of configuration information, updating the basic configuration, and writing the changed configuration information to the slave library to ensure that the configuration information in the slave library is accurate and traceable. The environment library in each environment references the configuration information of the basic library to achieve physical isolation and improve local reading efficiency. Continuous integration is responsible for obtaining and writing external dependency configurations before writing to the environment library to include it in GitOps management and simplify the emergency rollback process. Figure 4 It also emphasizes the change notification and synchronization adjustment mechanism. When changes occur in the main database, the slave database will be notified immediately to ensure that they can confirm and synchronously adjust the configuration information in a timely manner to ensure the consistency and accuracy of the configuration information.

[0111] Optionally, in the first embodiment, a schematic diagram of the code, configuration and image push process of the present solution can be as follows: Figure 5 shown. Figure 5 From the build code base (such as Figure 5 Step 1 in Build Code Repository) and Build Configuration Repository (such as Figure 5 Starting from step 1 of the Build Configuration Library, the code library receives the code pushed by the application (such as Figure 5 Step 2 in the above code integration process triggers the code integration and code delivery process of the continuous integration system (such as Figure 5 Step 3) in the code builds the image. The image is then pushed to the image repository (such as Figure 5 Push the image in step 4 of the previous step) and wait for deployment. During this process, the continuous integration system updates the application configuration (such as Figure 5 Update the mirror configuration in step 4) and download the configuration repository (such as Figure 5 Step 2) in the above example obtains configuration information and uses the GitOps tool to monitor changes in repository files (such as Figure 5 Once a change is detected, the GitOps tool pushes the updated configuration to the Kubernetes cluster, enabling incremental deployment of the application (e.g. Figure 5 Incremental deployment in Kubernetes). During incremental deployment, the container of the Kubernetes cluster will pull images from the image repository according to the image tag in the deployment template, and start or update the container instance according to the image content and Kubernetes resource definition. This process ensures the automation and traceability of configuration updates, simplifies the rollback process, and at the same time, when the production environment changes, the change notification and synchronization adjustment mechanism ensures the timely synchronization of the test and pre-release environments, improving the efficiency and security of software deployment and operation and maintenance.

[0112] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0113] To summarize, the code deployment method provided in the embodiment of the present application obtains an updated image repository by packaging the first data and pushing it to the image repository when the code repository receives the first data, wherein the first data includes at least one of the following: code information, first-category configuration information, the first-category configuration information represents the same configuration information in multiple code environments; when it is detected that there is change information in the configuration repository, determining the incremental configuration information in the change information, wherein the incremental configuration information belongs to the second-category configuration information, and the second-category configuration represents different configuration information in multiple code environments; determining the target code environment corresponding to the incremental configuration information; and deploying the target code environment based on the updated image repository and the incremental configuration information based on the continuous integration system, thereby solving the problem of low code deployment efficiency in the related art when managing differentiated configuration information in multiple code environments by branches or directories due to the complexity of inheritance or merging operations of different versions and the difficulty in code maintenance.

[0114] By receiving the incremental configuration information in the first data and configuration library, the image repository and the environment library can be updated through the continuous integration system, so that the code is deployed in the target code environment according to the updated image repository and the incremental configuration information, thereby achieving the effect of automated deployment, making the deployment and configuration management of applications more automated and standardized, which helps to improve the efficiency of software development and operation and maintenance, facilitates subsequent rollbacks and audits, reduces human errors, and improves the reliability and security of software. At the same time, by building the first configuration library and the second configuration library, the decoupling of the basic configuration and the environment-specific configuration is achieved, which facilitates the maintenance of configuration information in multiple code environments and achieves the effect of improving the efficiency of code deployment.

[0115] Example 2

[0116] The embodiment of the present application also provides a code deployment device. It should be noted that the code deployment device of the embodiment of the present application can be used to execute the code deployment method provided by the embodiment of the present application. The code deployment device provided by the embodiment of the present application is introduced below.

[0117] According to an embodiment of the present application, a device for implementing the above-mentioned code deployment method is also provided, the device deploys a target system, the target system includes a code library and a configuration library, the configuration library at least includes: a first configuration library and a second configuration library, the first configuration library is used to store a first type of configuration information, and the second configuration library is used to store a second type of configuration information, such as Figure 6As shown, the device comprises:

[0118] Specifically, the packaging unit 601 is used to package the first data and push it to the image repository when the code library receives the first data, so as to obtain an updated image repository, wherein the first data includes at least one of the following: code information, first-category configuration information, and the first-category configuration information represents the same configuration information in multiple code environments.

[0119] The first determining unit 602 is used to determine the incremental configuration information in the change information when it is detected that there is change information in the configuration library, wherein the incremental configuration information belongs to the second type of configuration information, and the second type of configuration represents different configuration information in multiple code environments.

[0120] The second determining unit 603 is used to determine the target code environment corresponding to the incremental configuration information.

[0121] The deployment unit 604 is used to deploy the target code environment based on the continuous integration system according to the updated image repository and incremental configuration information.

[0122] The code deployment device provided in the embodiment of the present application, through the packaging unit 601, when the code library receives the first data, packages the first data and pushes it to the image repository to obtain an updated image repository, wherein the first data includes at least one of the following: code information, first-category configuration information, the first-category configuration information represents the same configuration information in multiple code environments; the first determination unit 602 determines the incremental configuration information in the change information when detecting that there is change information in the configuration library, wherein the incremental configuration information belongs to the second-category configuration information, and the second-category configuration represents different configuration information in multiple code environments; the second determination unit 603 determines the target code environment corresponding to the incremental configuration information; the deployment unit 604 deploys the target code environment based on the continuous integration system according to the updated image repository and the incremental configuration information, thereby solving the problem of low code deployment efficiency in the related art when managing differentiated configuration information in multiple code environments by branches or directories due to the complex inheritance or merging operations of different versions and the difficulty in code maintenance.

[0123] By receiving the incremental configuration information in the first data and configuration library, the image repository and the environment library can be updated through the continuous integration system, so that the code is deployed in the target code environment according to the updated image repository and the incremental configuration information, thereby achieving the effect of automated deployment, making the deployment and configuration management of applications more automated and standardized, which helps to improve the efficiency of software development and operation and maintenance, facilitates subsequent rollbacks and audits, reduces human errors, and improves the reliability and security of software. At the same time, by building the first configuration library and the second configuration library, the decoupling of the basic configuration and the environment-specific configuration is achieved, which facilitates the maintenance of configuration information in multiple code environments and achieves the effect of improving the efficiency of code deployment.

[0124] Optionally, in the code deployment device provided in Example 2 of the present application, the above-mentioned device also includes: a third determination unit, used to determine the code branch information under multiple code environments in the code library before detecting that there is change information in the configuration library; a fourth determination unit, used to determine the first type of configuration information and the second type of configuration information based on the code branch information under multiple code environments; a construction unit, used to construct a first configuration library based on the first type of configuration information, and to construct a second configuration library based on the second type of configuration information; a fifth determination unit, used to determine the configuration library based on the first type of configuration and the second type of configuration.

[0125] Optionally, in the code deployment device provided in Example 2 of the present application, the above-mentioned construction unit includes: a first determination subunit, used to determine the version information of the first type of configuration information, and obtain different versions of the first type of configuration information; a first construction subunit, used to merge different versions of the first type of configuration information using a branch merge strategy, and build a first configuration library based on the merged first type of configuration information, wherein the first configuration library includes: a main library, at least one slave library, each of the at least one slave library references the configuration information of the main library, the operations performed on the main library include: read operations, write operations, and the operations performed on the slave library include: read operations.

[0126] Optionally, in the code deployment device provided in Example 2 of the present application, the above-mentioned multiple code environments include at least: a first environment, a second environment, and the construction unit includes: a first creation sub-unit, used to determine the first version information, and create a first directory based on the first version information, wherein the first version information represents the version information of the first type of configuration information referenced by the first environment; a second creation sub-unit, used to determine the second version information, and create a second directory based on the second version information, wherein the second version information represents the version information of the second type of configuration information referenced by the second environment; a first update sub-unit, used to update the configuration information in the first directory and / or the second directory based on the second type of configuration information to obtain an updated first directory and an updated second directory; a second construction sub-unit, used to construct a second configuration library based on the updated first directory and the updated second directory.

[0127] Optionally, in the code deployment device provided in Example 2 of the present application, the above-mentioned packaging unit 601 includes: a packaging subunit, used to package the first data into a first image when the first data passes the compilation; a second determination subunit, used to determine the third version information of the first data through the continuous integration system, and determine the image tag of the first image based on the third version information; a second update subunit, used to update the tag information of the deployment template in the configuration library through the continuous integration system based on the image tag of the first image, wherein the deployment template represents a template of instructions for deploying applications in multiple code environments; a pushing subunit, used to push the first image to the image repository to obtain an updated image repository.

[0128] Optionally, in the code deployment device provided in Example 2 of the present application, the above-mentioned first data includes at least: first-category configuration information, and the deployment unit package 604 includes: a third update sub-unit, used to update the configuration reference information in the second configuration repository based on the third version information to obtain an updated second configuration repository, wherein the configuration reference information represents the reference information of the second-category configuration information in the second configuration repository that references the first-category configuration information; a generation sub-unit, used to generate deployment information based on the continuous integration system based on the first image in the updated image repository, the updated second configuration repository, the first-category configuration information and the incremental configuration information; a deployment sub-unit, used to deploy the target code environment based on the deployment information when the deployment information passes the review.

[0129] Optionally, in the code deployment device provided in Example 2 of the present application, the above-mentioned device also includes: a first update unit, which is used to update the configuration information in the second configuration library based on the changed configuration information of the first configuration library through the continuous integration system after determining the configuration library based on the first type of configuration and the second type of configuration, when the changed configuration information in the first configuration library is detected.

[0130] Optionally, in the code deployment device provided in Example 2 of the present application, the above-mentioned device also includes: a receiving unit, used to receive change configuration information of other business systems before determining the incremental configuration information in the change information, so as to obtain other configuration information; a fifth determination unit, used to determine the first type of configuration information referenced by the other configuration information, so as to obtain referenced configuration information; a second update unit, used to update the second configuration library based on the other configuration information and the referenced configuration information, and determine that there is change information in the configuration library, and execute the step of determining the incremental configuration information in the change information.

[0131] It should be noted here that the above-mentioned packaging unit 601, the first determination unit 602, the second determination unit 603 and the deployment unit 604 correspond to steps S201 to S204 in Example 1, and the two modules and the corresponding steps implement the same examples and application scenarios, but are not limited to the contents disclosed in the above-mentioned Example 1. It should be noted that the above-mentioned modules or units can be hardware components or software components stored in a memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102 code deployment, ..., 102n), and the above-mentioned modules can also be run in the computer terminal 10 provided in Example 1 as part of the device.

[0132] Example 3

[0133] An embodiment of the present application may provide an electronic device, Figure 7 is a structural block diagram of an electronic device according to an embodiment of the present application. Figure 7 As shown, the electronic device may include: one or more ( Figure 7 (only one is shown) processor 702, memory 704, storage controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.

[0134] Among them, the memory can be used to store software programs and modules, such as program instructions / modules corresponding to the methods and devices in the embodiments of the present application, and the processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, realizing the above-mentioned method. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0135] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: when the code library receives the first data, the first data is packaged and pushed to the image repository to obtain an updated image repository, wherein the first data includes at least one of the following: code information, first-category configuration information, and the first-category configuration information represents the same configuration information in multiple code environments; when it is detected that there is change information in the configuration library, the incremental configuration information in the change information is determined, wherein the incremental configuration information belongs to the second-category configuration information, and the second-category configuration represents different configuration information in multiple code environments; determine the target code environment corresponding to the incremental configuration information; and deploy the target code environment based on the continuous integration system according to the updated image repository and the incremental configuration information.

[0136] The processor can call the information and application programs stored in the memory through the transmission device to perform the following steps: determine the code branch information in the code library under multiple code environments; determine the first type of configuration information and the second type of configuration information based on the code branch information under multiple code environments; construct a first configuration library based on the first type of configuration information, and construct a second configuration library based on the second type of configuration information; determine the configuration library based on the first type of configuration and the second type of configuration.

[0137] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: determine the version information of the first type of configuration information to obtain different versions of the first type of configuration information; adopt a branch merge strategy to merge the different versions of the first type of configuration information, and build a first configuration library based on the merged first type of configuration information, wherein the first configuration library includes: a main library, at least one slave library, each of the at least one slave library references the configuration information of the main library, the operations performed on the main library include: read operations, write operations, and the operations performed on the slave library include: read operations.

[0138] The processor can call the information and application programs stored in the memory through the transmission device to perform the following steps: multiple code environments include at least: a first environment and a second environment, and a second configuration library is constructed based on the second type of configuration information, including: determining the first version information, and creating a first directory based on the first version information, wherein the first version information represents the version information of the first type of configuration information referenced by the first environment; determining the second version information, and creating a second directory based on the second version information, wherein the second version information represents the version information of the second type of configuration information referenced by the second environment; updating the configuration information in the first directory and / or the second directory based on the second type of configuration information to obtain an updated first directory and an updated second directory; and constructing a second configuration library based on the updated first directory and the updated second directory.

[0139] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: package the first data and push it to the image repository to obtain an updated image repository, including: if the first data passes the compilation, package the first data into a first image; determine the third version information of the first data through the continuous integration system, and determine the image tag of the first image based on the third version information; based on the image tag of the first image, update the tag information of the deployment template in the configuration library through the continuous integration system, wherein the deployment template represents a template of instructions for deploying applications in multiple code environments; push the first image to the image repository to obtain an updated image repository.

[0140] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: the first data includes at least: the first type of configuration information, and the target code environment is deployed based on the continuous integration system according to the updated image repository and the incremental configuration information, including: updating the configuration reference information in the second configuration library according to the third version information to obtain the updated second configuration library, wherein the configuration reference information represents the reference information of the second type of configuration information in the second configuration library that references the first type of configuration information; based on the continuous integration system, the deployment information is generated according to the first image in the updated image repository, the updated second configuration library, the first type of configuration information and the incremental configuration information; when the deployment information passes the review, the target code environment is deployed according to the deployment information.

[0141] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: after determining the configuration library based on the first type of configuration and the second type of configuration, the method also includes: when the changed configuration information in the first configuration library is detected, updating the configuration information in the second configuration library based on the changed configuration information of the first configuration library through the continuous integration system.

[0142] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: before determining the incremental configuration information in the change information, the method also includes: receiving change configuration information from other business systems to obtain other configuration information; determining the first type of configuration information referenced by the other configuration information to obtain reference configuration information; updating the second configuration library based on the other configuration information and the reference configuration information, and determining that the configuration library exists change information, and executing the step of determining the incremental configuration information in the change information.

[0143] According to an embodiment of the present application, a code deployment method is provided. When a code library receives first data, the first data is packaged and pushed to a mirror repository to obtain an updated mirror repository, wherein the first data includes at least one of the following: code information, first-class configuration information, and the first-class configuration information represents the same configuration information in multiple code environments; when it is detected that there is change information in the configuration library, the incremental configuration information in the change information is determined, wherein the incremental configuration information belongs to the second-class configuration information, and the second-class configuration represents different configuration information in multiple code environments; the target code environment corresponding to the incremental configuration information is determined; and the target code environment is deployed based on the updated mirror repository and the incremental configuration information based on a continuous integration system, thereby solving the technical problem of low code deployment efficiency due to the complex inheritance or merging operations of different versions and the difficulty in code maintenance when managing differentiated configuration information in multiple code environments by branch or directory.

[0144] It can be understood by those skilled in the art that Figure 7The structure shown is for illustration only, and the electronic device may also be a terminal device such as a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Moile Internet Devices, MID), a PAD, etc. Figure 7 The structure of the electronic device is not limited. Figure 7 More or fewer components (such as network interfaces, display devices, etc.) shown in, or having Figure 7 Different configurations shown.

[0145] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0146] Example 4

[0147] The embodiment of the present application further provides a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the code deployment method provided in the first embodiment.

[0148] Optionally, in this embodiment, the above storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.

[0149] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing the program of the code deployment method steps.

[0150] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0151] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0152] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. 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 mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

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

[0154] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0155] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it 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 all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0156] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A code deployment method, characterized in that: The method is applied to a target system, the target system includes a code library and a configuration library, the configuration library includes at least: a first configuration library and a second configuration library, the first configuration library is used to store a first type of configuration information, and the second configuration library is used to store a second type of configuration information, the method includes: When the code library receives the first data, the first data is packaged and pushed to the image repository to obtain an updated image repository, wherein the first data includes at least one of the following: code information and the first type of configuration information, wherein the first type of configuration information represents the same configuration information in multiple code environments; In the case where it is detected that there is change information in the configuration library, determining incremental configuration information in the change information, wherein the incremental configuration information belongs to the second type of configuration information, and the second type of configuration represents different configuration information in the multiple code environments; Determining a target code environment corresponding to the incremental configuration information; The target code environment is deployed based on the continuous integration system according to the updated image repository and the incremental configuration information.

2. The method according to claim 1, characterized in that Before detecting that the configuration library has change information, the method further includes: Determine code branch information under the multiple code environments in the code library; Determine the first type of configuration information and the second type of configuration information according to the code branch information under the multiple code environments; constructing the first configuration library according to the first type of configuration information, and constructing the second configuration library according to the second type of configuration information; The configuration library is determined according to the first type of configuration and the second type of configuration.

3. The method according to claim 2, characterized in that Constructing the first configuration library according to the first type of configuration information includes: Determine version information of the first type of configuration information, and obtain different versions of the first type of configuration information; A branch merge strategy is adopted to merge the different versions of the first category configuration information, and the first configuration library is constructed based on the merged first category configuration information, wherein the first configuration library includes: a main library and at least one slave library, each of the at least one slave library references the configuration information of the main library, the operations performed on the main library include: a read operation and a write operation, and the operations performed on the slave library include: a read operation.

4. The method according to claim 2, characterized in that: The multiple code environments include at least: a first environment and a second environment, and constructing the second configuration library according to the second type of configuration information includes: Determine first version information, and create a first directory according to the first version information, wherein the first version information represents version information of the first type of configuration information referenced by the first environment; Determine second version information, and create a second directory according to the second version information, wherein the second version information represents version information of the second type of configuration information referenced by the second environment; updating the configuration information in the first directory and / or the second directory according to the second type of configuration information to obtain an updated first directory and an updated second directory; The second configuration library is constructed according to the updated first directory and the updated second directory.

5. The method according to claim 1, characterized in that The first data is packaged and pushed to the image repository to obtain an updated image repository, including: When the first data passes the compilation, packaging the first data into a first image; Determine the third version information of the first data through the continuous integration system, and determine the image tag of the first image according to the third version information; According to the image tag of the first image, updating the tag information of the deployment template in the configuration library through the continuous integration system, wherein the deployment template represents a template of instructions for deploying the application in the multiple code environments; The first image is pushed to the image repository to obtain the updated image repository.

6. The method according to claim 5, characterized in that The first data at least includes: the first type of configuration information, and the target code environment is deployed based on the continuous integration system according to the updated image repository and the incremental configuration information, including: updating the configuration reference information in the second configuration repository according to the third version information to obtain an updated second configuration repository, wherein the configuration reference information represents reference information of the second type of configuration information in the second configuration repository that references the first type of configuration information; Generate deployment information based on the first image in the updated image repository, the updated second configuration repository, the first type of configuration information, and the incremental configuration information based on a continuous integration system; When the deployment information passes the review, the target code environment is deployed according to the deployment information.

7. The method according to claim 2, characterized in that After determining the configuration library according to the first type of configuration and the second type of configuration, the method further includes: When the changed configuration information in the first configuration repository is detected, the configuration information in the second configuration repository is updated according to the changed configuration information in the first configuration repository through the continuous integration system.

8. The method according to claim 1, characterized in that Before determining the incremental configuration information in the change information, the method further includes: Receive configuration change information from other business systems and obtain other configuration information; Determine the first type of configuration information referenced by the other configuration information to obtain referenced configuration information; The second configuration library is updated according to the other configuration information and the referenced configuration information, and it is determined that there is change information in the configuration library, and the step of determining incremental configuration information in the change information is performed.

9. A code deployment device, characterized in that: The device deploys a target system, the target system includes a code library and a configuration library, the configuration library includes at least: a first configuration library and a second configuration library, the first configuration library is used to store a first type of configuration information, the second configuration library is used to store a second type of configuration information, the device includes: a packaging unit, configured to package the first data and push the first data to the image repository to obtain an updated image repository when the code repository receives the first data, wherein the first data includes at least one of the following: code information and the first type of configuration information, wherein the first type of configuration information represents the same configuration information in multiple code environments; A first determining unit is configured to determine, when detecting that there is change information in the configuration library, incremental configuration information in the change information, wherein the incremental configuration information belongs to the second type of configuration information, and the second type of configuration represents different configuration information in the multiple code environments; A second determining unit, configured to determine a target code environment corresponding to the incremental configuration information; A deployment unit is used to deploy the target code environment based on the continuous integration system according to the updated image repository and the incremental configuration information.

10. An electronic device, characterized in that: include: A memory storing an executable program; A processor, configured to run the program, wherein the program executes the method according to any one of claims 1 to 8 when running.