CN114895916A - Code deployment method, device, storage medium and electronic equipment - Google Patents

Code deployment method, device, storage medium and electronic equipment Download PDF

Info

Publication number
CN114895916A
CN114895916A CN202210481318.0A CN202210481318A CN114895916A CN 114895916 A CN114895916 A CN 114895916A CN 202210481318 A CN202210481318 A CN 202210481318A CN 114895916 A CN114895916 A CN 114895916A
Authority
CN
China
Prior art keywords
code
program code
program
mirror
changed
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210481318.0A
Other languages
Chinese (zh)
Inventor
刘世权
申贻民
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Cloud Network Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN202210481318.0A priority Critical patent/CN114895916A/en
Publication of CN114895916A publication Critical patent/CN114895916A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • G06F8/63Image based installation; Cloning; Build to order
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Landscapes

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

Abstract

The invention discloses a code deployment method, a code deployment device, a storage medium and electronic equipment. The method comprises the following steps: monitoring a local program code of the client; under the condition that the program code is changed, generating a mirror image code of the changed program code; sending the mirror code to a remote repository of the server; the mirror code in the remote repository is deployed into the k8s cluster. The invention solves the technical problem of low code verification efficiency.

Description

Code deployment method, device, storage medium and electronic equipment
Technical Field
The invention relates to the field of computers, in particular to a code deployment method, a code deployment device, a storage medium and electronic equipment.
Background
In the prior art, after a client develops code locally, it takes several minutes or even tens of minutes to perform continuous integration and continuous deployment on the code, and then the code after the integrated deployment is verified. However, in the prior art, the function verification of the code is inefficient.
Disclosure of Invention
The embodiment of the invention provides a code deployment method, a code deployment device, a storage medium and electronic equipment, and at least solves the technical problem of low code verification efficiency.
According to an aspect of an embodiment of the present invention, there is provided a code deployment method, including: monitoring a local program code of the client; generating a mirror image code of the changed program code when the program code is changed; sending the mirror image code to a remote repository of a server; deploying the mirror code in the remote repository into a k8s cluster.
According to another aspect of the embodiments of the present invention, there is provided a code deployment apparatus, including: the monitoring module is used for monitoring the local program code of the client; a generation module, configured to generate a mirror image code of the changed program code when the program code is changed; the sending module is used for sending the mirror image code to a remote warehouse of a server; and the deployment module is used for deploying the mirror image codes in the remote warehouse into the k8s cluster.
As an optional example, the monitoring module includes: a first determining unit configured to determine that the program code has changed when the client receives a storage instruction for storing the program code.
As an optional example, the monitoring module includes: a second determining unit, configured to determine that the program code changes when a time length from a last time when the program code was determined to have changed reaches a first time length; or a third determining unit configured to determine that the program code has changed when the content of the edited program code exceeds a first threshold; or a fourth determination unit configured to determine that the program code has changed when a ratio of the content of the edited program code to the total content of the program code exceeds a second threshold.
As an optional example, the generating module includes: a compiling unit for compiling the program code; a packing unit, configured to pack the compiled program code into a code program; and the determining unit is used for determining the code program as the mirror image code.
As an alternative example, the packing unit includes: a reading subunit, configured to read the compiled program code line by line starting from a first line of the compiled program code; the writing subunit is used for sequentially writing the read code contents into the target file according to the reading sequence; and the determining subunit is used for determining the object file as the code program after reading the compiled program code and writing the program code into the object file.
As an optional example, the deployment module includes: a first deployment unit, configured to deploy the mirror code to a container in the k8s cluster; a creating unit for creating a plurality of instances of the mirror code; and the debugging unit is used for carrying out data communication among the plurality of instances and debugging and running the mirror image code.
As an optional example, the deployment module includes: and a second deployment unit, configured to deploy each type of code into a type of container when the image code and the code called by the image code include different types of code.
According to still another aspect of the embodiments of the present invention, there is also provided a storage medium having a computer program stored therein, wherein the computer program executes the code deployment method when executed by a processor.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including a memory and a processor, where the memory stores a computer program, and the processor is configured to execute the code deployment method through the computer program.
In the embodiment of the invention, the local program code of the client is monitored; generating a mirror image code of the changed program code when the program code is changed; sending the mirror image code to a remote repository of a server; according to the method for deploying the mirror image codes in the remote warehouse to the k8s cluster, the mirror image codes of the changed program codes can be generated after the codes are edited locally at the client, and the mirror image codes are sent to the remote warehouse to be deployed to the k8s cluster, so that the aim of quickly deploying and checking the codes locally at the client is fulfilled, and the technical problem of low code verification efficiency is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a flow diagram of an alternative code deployment method according to an embodiment of the invention;
FIG. 2 is a schematic diagram of a read program code of an alternative code deployment method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a read program code of an alternative code deployment method according to an embodiment of the invention;
FIG. 4 is a system diagram of an alternative code deployment method according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of an alternative code deployment apparatus according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of an alternative electronic device according to an embodiment of the invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to a first aspect of the embodiments of the present invention, there is provided a code deployment method, optionally, as shown in fig. 1, the method includes:
s102, monitoring a local program code of a client;
s104, generating a mirror image code of the changed program code under the condition that the program code is changed;
s106, sending the mirror image code to a remote warehouse of the server;
and S108, deploying the mirror image codes in the remote warehouse to the k8S cluster.
Optionally, in this embodiment, code development may be performed locally at the client. The developed code content is local to the client. In the development process of the local code of the client, the method can monitor the development condition of the local code of the client. After the development of the local code of the client is completed or the code is changed, the mirror image code of the changed program code can be generated and transmitted to the remote warehouse of the server for storage. The remote repository may store the codes in categories according to their item types. The code in the remote warehouse is deployed in a Kubernetes (k8s) cluster, so that the program code can be rapidly deployed and verified, and the efficiency of verifying the code is improved.
In the method, after the code is edited locally at the client, the mirror image code of the changed program code can be generated, and the mirror image code is sent to the remote warehouse to be deployed into the k8s cluster, so that the aim of quickly deploying and checking the code local to the client is fulfilled.
As an optional example, the monitoring the program code local to the client includes:
in the case where the client receives a storage instruction to save the program code, it is determined that the program code has changed.
As an optional example, the monitoring the program code local to the client includes:
determining that the program code changes under the condition that the time length of the program code which is determined to change last time reaches a first time length; or
Determining that the program code is changed in the case that the content of the program code edited exceeds a first threshold value; or
In a case where a ratio of the content of the program code edited to the total content of the program code exceeds a second threshold value, it is determined that the program code has changed.
Optionally, in this embodiment, whether the code changes in the process of locally editing the code at the client may be monitored. Various indicators may be used in monitoring.
For example, whether a store instruction is received may be used to determine whether a code change has occurred. The storage instructions may be instructions received by the client in the process of developing code. For example, when a user submits a code through a client, a storage instruction is generated, and when the client receives the storage instruction and confirms that a program code changes, a mirror image code of the program code is generated. When generating the mirror code of the program code, the mirror code may be generated according to the item. I.e. the item to which the changed code belongs. Packaging the entire project to generate the mirror code. Other code that does not change does not need to be packaged. This approach can reduce the amount of data packed. In the embodiment, codes of the whole developed application program can be packaged, so that the packaging accuracy of the codes of the application program can be improved, and packaged code errors caused by missing codes are avoided.
If multiple store instructions are received within a short time, the last received store instruction may be responded to, while the previous multiple store instructions may not be responded to. The problem that a system is busy due to the fact that codes are packaged for many times when a user stores the codes for many times is avoided.
In this embodiment, whether the code changes may be determined according to a comparison relationship between the time length of the code change and the first time length, or the number of contents of the code to be edited. For example, after 1 minute passes after the code is edited, the code is automatically saved once, and a storage instruction is automatically triggered. Or, if the code editing content is too much and exceeds 100 lines, the code is automatically stored once, and a storage instruction is automatically triggered. Or the proportion of the content edited by the code to the total content is higher than a second threshold value, the content is automatically stored once, and the storage instruction is automatically triggered.
As an alternative example, in the case that the program code is changed, generating the mirror code of the changed program code includes:
compiling the program code;
packaging the compiled program codes into code programs;
the code program is determined as a mirror code.
Optionally, in this embodiment, when generating the mirror image code of the program code, the program code may be compiled, all contents of the compiled program code are packaged to obtain a packaged code program, and the packaged code program is used as the mirror image code.
As an alternative example, the packaging the compiled program code into the code program includes:
reading the compiled program code line by line from the first line of the compiled program code;
sequentially writing the read code contents into a target file according to a reading sequence;
after the compiled program code is read and written into the object file, the object file is determined as a code program.
Optionally, in this embodiment, when the program code is packaged to obtain the code program, the program code may be compiled first, and after the program code is compiled, the program code is read. During reading, data is read from the first line of the program code, and after the data is read, the data is written into a target file. The target file is determined as a code program. Fig. 2 and 3 are schematic diagrams of the reading program code of the present embodiment. In fig. 2, the program code is read and written into file 1. In fig. 3, different portions of program code are read and written in different files in parallel.
Optionally, in this embodiment, the content of the compiled program code may also be divided into multiple parts, each part of the program code of the multiple parts of the program code is read in parallel, and the last line of each part of the program code is read from the first line of each part of the program code. And each program code is read and written into one file to obtain a plurality of target files, and the plurality of target files are used as code programs. When the compiled program code is divided into a plurality of code portions, the program code may be classified by class or object, or may be divided into a fixed number of code portions.
As an alternative example, the deploying the mirror code in the remote repository into the k8s cluster includes:
deploying the mirror code into a container in the k8s cluster;
creating a plurality of instances of mirror code;
data communication is carried out among a plurality of instances, and the mirror image code is debugged and run.
As an alternative example, the deploying the mirror code in the remote repository into the k8s cluster includes:
in the case where the mirror code includes different types of code from the code called by the mirror code, each type of code is deployed into a type of container.
Optionally, in this embodiment, the image code is deployed in the k8s cluster, the image code may be deployed in a container of the k8s cluster, multiple instances of the image code are created, and then the image code is debugged and run according to the instances. When deploying the image code, different types of image code can be deployed into different containers according to the type of the image code.
Optionally, in this embodiment, the deployment tool may use a hellm package management tool in a Kubernetes ecology, and multiple deployments may be implemented only by writing once, and only by modifying a corresponding code version number when multiple deployments are performed, and operations such as checking resources, load balancing, configuration, key, rollback and the like are performed through the ranker platform. After the local code is modified by matching with a Nocalhost tool, the code can be automatically submitted to a remote Kubernetes cluster after being stored, a remote deployment environment is multiplexed, the purpose of automatic deployment is achieved, and online problems can be debugged, operated or reproduced remotely through development tools such as local goland.
Helm is a software package management tool in a Kubernetes ecosystem, can manage a set of related configuration files as an application, well solves the management problems of editing and the like of scattered Kubernetes application configuration, and achieves the effect of distributing and reusing the Kubernetes application configuration.
Helm Chart is a series of YAML files used to encapsulate Kubernetes native applications. The Metadata of the application program can be customized when the application is deployed, so that the distribution of the application program is facilitated, and the application can be packaged by Helm, the application dependency relationship can be managed, the application version can be published, and the like. For a user, after Helm is used, the user can search, install, upgrade, rollback and uninstall the application program on Kubernets in a simple mode without writing a complex application deployment file. Helm can simplify the application management difficulty.
Nocalhost is an open-source cloud native application development tool based on IDE, can directly build, test and debug application programs in a Kubernets cluster, and keeps the same use experience as local development. The local code changes are synchronized to the remote container on the fly without requiring the image to be rebuilt or the container to be restarted.
Nocalhost consists of a single binary CLI and IDE plug-in that can directly cooperate with the debugger along with the IDE. Nocalcost does not require a server-side component because it communicates directly with the kubernets cluster through KubeConfig.
The Nocalhost Remote debugging process mainly comprises the processes of starting DevMode starting debugging mode, Association Local DIR association Local directory, breakpoint setting, Remote debugging of Remote Debug, Local request interface, information checking at the breakpoint and the like.
Fig. 4 is a system diagram of the present embodiment. In the embodiment, after the code is modified, the editor automatically stores the code, and the Nocalhost perceives that the content of the program changes, compiles and packs the program to generate a new code image version, pushes the new code image version to a remote warehouse and deploys the new code image version to a Kubernetes cluster.
By matching with technologies such as Helm, Ingress, Chart and the like of Kubernetes, the problems of the traditional deployment modes such as program pre-inspection, survival inspection, smooth expansion, program elegant exit, load balancing, failure retry and the like can be conveniently and quickly realized. A plurality of key technologies are unified into the yaml configuration file, so that research and development personnel can focus on services, the research and development efficiency is improved, the deployment difficulty is reduced, and the workload of later maintenance and upgrading is reduced.
For example, if there are A, B, C items, local debugging requires to run these 3 programs simultaneously, the programs are called each other, the process is long and complicated, and debugging is particularly troublesome. By using a Kubernets container deployment mode, a construction flow is written, a plurality of examples can be rapidly deployed and run in the container, and normal communication can be realized among the examples without depending on the external environment. By using the method, the dependence on building a development environment among multiple projects can be reduced, and the development and debugging efficiency is improved. And by matching with Nocalhost remote debugging, the collaborative development and debugging among multiple projects become smooth and convenient.
By using a Nocalhost RemoteDebug mode, a Kubernets machine can be remotely connected, a remote container environment and deployed mirror image codes are used, program breakpoints set by a local editor are matched, and a Postman simulation request is sent, so that the problems of site debugging, problem code positioning and difficulty in multiplexing on-line environment and positioning problems in traditional development modes such as on-line bug are solved.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
According to another aspect of the embodiments of the present application, there is also provided a code deployment apparatus, as shown in fig. 5, including:
a monitoring module 502, configured to monitor a local program code of the client;
a generating module 504, configured to generate a mirror image code of the changed program code when the program code is changed;
a sending module 506 for sending the image code to a remote repository of servers;
a deployment module 508, configured to deploy the mirror code in the remote repository into the k8s cluster.
Optionally, in this embodiment, code development may be performed locally at the client. The developed code content is local to the client. In the development process of the local code of the client, the method can monitor the development condition of the local code of the client. After the development of the local code of the client is completed or the code is changed, the mirror image code of the changed program code can be generated and transmitted to the remote warehouse of the server for storage. The remote repository may store the codes in categories according to their item types. The code in the remote warehouse is deployed in a Kubernetes (k8s) cluster, so that the program code can be rapidly deployed and verified, and the efficiency of verifying the code is improved.
In the method, after the code is edited locally at the client, the mirror image code of the changed program code can be generated, and the mirror image code is sent to the remote warehouse to be deployed into the k8s cluster, so that the aim of quickly deploying and checking the code local to the client is fulfilled.
As an optional example, the monitoring module includes:
the first determining unit is used for determining that the program code changes when the client receives a storage instruction for storing the program code.
As an optional example, the monitoring module includes:
the second determining unit is used for determining that the program code changes under the condition that the time length from the last time of determining that the program code changes reaches the first time length; or
A third determination unit configured to determine that the program code has changed in a case where the content of the program code edited exceeds the first threshold; or
A fourth determination unit configured to determine that the program code has changed in a case where a ratio of a content of the program code being edited to a total content of the program code exceeds a second threshold.
Optionally, in this embodiment, whether the code changes in the process of locally editing the code at the client may be monitored. Various indicators may be used in the monitoring.
For example, whether a store instruction is received may be used to determine whether a code change has occurred. The storage instructions may be instructions received by the client in the process of developing code. For example, when a user submits a code through a client, a storage instruction is generated, and when the client receives the storage instruction and confirms that a program code changes, a mirror image code of the program code is generated. When generating the mirror code of the program code, the mirror code may be generated according to the item. I.e. the item to which the changed code belongs. Packaging the entire project to generate the mirror code. Other code that does not change does not need to be packaged. This approach can reduce the amount of data packed. In the embodiment, codes of the whole developed application program can be packaged, so that the packaging accuracy of the codes of the application program can be improved, and packaged code errors caused by missing codes are avoided.
If multiple store instructions are received within a short time, the last received store instruction may be responded to, while the previous multiple store instructions may not be responded to. The problem that a system is busy due to the fact that codes are packaged for many times when a user stores the codes for many times is avoided.
In this embodiment, whether the code changes may be determined according to a comparison relationship between the time length of the code change and the first time length, or the number of contents of the code to be edited. For example, after 1 minute passes after the code is edited, the code is automatically saved once, and a storage instruction is automatically triggered. Or, if the code editing content is too much and exceeds 100 lines, the code is automatically stored once, and a storage instruction is automatically triggered. Or the proportion of the content edited by the code to the total content is higher than a second threshold value, the content is automatically stored once, and the storage instruction is automatically triggered.
As an optional example, the generating module includes:
a compiling unit for compiling the program code;
a packing unit for packing the compiled program code into a code program;
a determination unit for determining the code program as a mirror code.
Optionally, in this embodiment, when generating the mirror image code of the program code, the program code may be compiled, all contents of the compiled program code are packaged to obtain a packaged code program, and the packaged code program is used as the mirror image code.
As an alternative example, the packing unit includes:
a reading subunit, configured to read the compiled program code line by line starting from a first line of the compiled program code;
the writing subunit is used for sequentially writing the read code contents into the target file according to the reading sequence;
and the determining subunit is used for determining the target file as the code program after reading the compiled program code and writing the program code into the target file.
Optionally, in this embodiment, when the program code is packaged to obtain the code program, the program code may be compiled first, and after the program code is compiled, the program code is read. During reading, data is read from the first line of the program code, and after the data is read, the data is written into a target file. The target file is determined as a code program. Fig. 2 and 3 are schematic diagrams of the reading program code of the present embodiment.
Optionally, in this embodiment, the content of the compiled program code may also be divided into multiple parts, each part of the program code of the multiple parts of the program code is read in parallel, and the last line of each part of the program code is read from the first line of each part of the program code. And each program code is read and written into one file to obtain a plurality of target files, and the plurality of target files are used as code programs. When the compiled program code is divided into a plurality of code portions, the program code may be classified by class or object, or may be divided into a fixed number of code portions.
As an optional example, the deployment module includes:
a first deployment unit, configured to deploy the mirror code into a container in the k8s cluster;
a creating unit for creating a plurality of instances of the mirror code;
and the debugging unit is used for carrying out data communication among the multiple instances and debugging and running the mirror image code.
As an optional example, the deployment module includes:
and the second deployment unit is used for deploying each type of code into a type of container under the condition that the mirror code and the code called by the mirror code comprise different types of code.
Optionally, in this embodiment, the image code is deployed in the k8s cluster, the image code may be deployed in a container of the k8s cluster, multiple instances of the image code are created, and then the image code is debugged and run according to the instances. When deploying the image code, different types of image code can be deployed into different containers according to the type of the image code.
For other examples of this embodiment, please refer to the above examples, which are not described herein.
Fig. 6 is a block diagram of an alternative electronic device according to an embodiment of the present invention, as shown in fig. 6, including a processor 602, a communication interface 604, a memory 606, and a communication bus 608, where the processor 602, the communication interface 604, and the memory 606 communicate with each other through the communication bus 608, where,
a memory 606 for storing computer programs;
the processor 602, when executing the computer program stored in the memory 606, implements the following steps:
monitoring a local program code of the client;
under the condition that the program code is changed, generating a mirror image code of the changed program code;
sending the mirror code to a remote repository of the server;
the mirror code in the remote repository is deployed into the k8s cluster.
Alternatively, in this embodiment, the communication bus may be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 6, but this is not intended to represent only one bus or type of bus. The communication interface is used for communication between the electronic equipment and other equipment.
The memory may include RAM, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory. Alternatively, the memory may be at least one memory device located remotely from the processor.
As an example, the memory 606 may include, but is not limited to, the monitoring module 502, the generating module 504, the sending module 506, and the deploying module 508 of the code deploying apparatus. In addition, the module may further include, but is not limited to, other module units in the processing apparatus of the request, which is not described in this example again.
The processor may be a general-purpose processor, and may include but is not limited to: a CPU (Central Processing Unit), an NP (Network Processor), and the like; but also a DSP (Digital Signal Processing), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment is not described herein again.
It can be understood by those skilled in the art that the structure shown in fig. 6 is only an illustration, and the device implementing the code deployment method may be a terminal device, and the terminal device may be a terminal device such as a smart phone (e.g., an Android phone, an iOS phone, etc.), a tablet computer, a palm computer, a Mobile Internet Device (MID), a PAD, and the like. Fig. 6 is a diagram illustrating a structure of the electronic device. For example, the electronic device may also include more or fewer components (e.g., network interfaces, display devices, etc.) than shown in FIG. 6, or have a different configuration than shown in FIG. 6.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disk, ROM, RAM, magnetic or optical disk, and the like.
According to still another aspect of embodiments of the present invention, there is also provided a computer-readable storage medium having a computer program stored therein, wherein the computer program is executed by a processor to perform the steps of the code deployment method.
Alternatively, in this embodiment, a person skilled in the art may understand that all or part of the steps in the methods of the foregoing embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing one or more computer devices (which may be personal computers, servers, network devices, etc.) to execute all or part of the steps of the method according to the embodiments of the present invention.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (10)

1. A method for code deployment, comprising:
monitoring a local program code of the client;
under the condition that the program code is changed, generating a mirror image code of the changed program code;
sending the image code to a remote repository of servers;
deploying the mirror code in the remote repository into a k8s cluster.
2. The method of claim 1, wherein monitoring program code local to the client comprises:
and under the condition that the client receives a storage instruction for storing the program code, determining that the program code is changed.
3. The method of claim 1, wherein monitoring program code local to the client comprises:
determining that the program code changes under the condition that the time length of the program code which is determined to change last time reaches a first time length; or
Determining that the program code is changed if the content of the program code edited exceeds a first threshold; or
Determining that the program code is changed in a case where a ratio of contents of the program code edited to a total content of the program code exceeds a second threshold.
4. The method of claim 1, wherein generating the mirror code of the changed program code in case of the change of the program code comprises:
compiling the program code;
packing the compiled program codes into code programs;
determining the code program as the mirror code.
5. The method of claim 4, wherein packaging the compiled program code into a code program comprises:
reading the compiled program code line by line from a first line of the compiled program code;
sequentially writing the read code contents into a target file according to a reading sequence;
after reading the compiled program code and writing the program code into the object file, determining the object file as the code program.
6. The method of any of claims 1 to 5, wherein said deploying the mirrored code in the remote repository into a k8s cluster comprises:
deploying the mirror code into a container in the k8s cluster;
creating a plurality of instances of the mirror code;
and carrying out data communication among the multiple instances, and debugging and running the mirror image code.
7. The method of any of claims 1 to 5, wherein said deploying the mirrored code in the remote repository into a k8s cluster comprises:
in the case that the mirror code and the code called by the mirror code comprise different types of code, deploying each type of code into a type of container.
8. A code deployment apparatus, comprising:
the monitoring module is used for monitoring the local program code of the client;
the generating module is used for generating a mirror image code of the changed program code under the condition that the program code is changed;
a sending module for sending the mirror code to a remote repository of a server;
a deployment module, configured to deploy the mirror code in the remote repository into a k8s cluster.
9. A computer-readable storage medium, in which a computer program is stored, which, when being executed by a processor, carries out the method of any one of claims 1 to 7.
10. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method of any of claims 1 to 7 by means of the computer program.
CN202210481318.0A 2022-05-05 2022-05-05 Code deployment method, device, storage medium and electronic equipment Pending CN114895916A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210481318.0A CN114895916A (en) 2022-05-05 2022-05-05 Code deployment method, device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210481318.0A CN114895916A (en) 2022-05-05 2022-05-05 Code deployment method, device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN114895916A true CN114895916A (en) 2022-08-12

Family

ID=82718856

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210481318.0A Pending CN114895916A (en) 2022-05-05 2022-05-05 Code deployment method, device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN114895916A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116627446A (en) * 2023-07-25 2023-08-22 华控清交信息科技(北京)有限公司 Method and device for deploying application on k8s container cluster and electronic equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116627446A (en) * 2023-07-25 2023-08-22 华控清交信息科技(北京)有限公司 Method and device for deploying application on k8s container cluster and electronic equipment

Similar Documents

Publication Publication Date Title
CN108287694B (en) Application program construction method, system, computer device and storage medium
US8140905B2 (en) Incremental problem determination and resolution in cloud environments
EP3616066B1 (en) Human-readable, language-independent stack trace summary generation
CN112083948B (en) Automatic construction and deployment method and tool based on data configuration
CN111078229A (en) Application processing method and device, storage medium and electronic equipment
CN111162953A (en) Data processing method, system upgrading method and server
CN115454869A (en) Interface automation test method, device, equipment and storage medium
CN112860645A (en) Processing method and device for offline compressed file, computer equipment and medium
CN114297056A (en) Automatic testing method and system
CN111651352B (en) Warehouse code merging method and device
CN113296787A (en) Online development and code hosting system based on cloud platform and using method
CN114895916A (en) Code deployment method, device, storage medium and electronic equipment
WO2021077916A1 (en) Method and device for acquiring mirror image file
CN116599881A (en) Cloud platform tenant modeling test method, device, equipment and storage medium
CN109144524B (en) Version release method of subject game on education platform and electronic equipment
CN116244186A (en) Operating system test management method and device and computing equipment
CN114996955A (en) Target range environment construction method and device for cloud-originated chaotic engineering experiment
CN114500268A (en) Deployment method, device, server and storage medium of chart resource
CN114356396A (en) Service publishing method and device adaptive to multiple services
CN113610242A (en) Data processing method and device and server
CN114115982A (en) Code issuing method, device, equipment and storage medium
CN111651189A (en) Product delivery method and device of continuous integration system and electronic equipment
CN112667491A (en) Function test method and device of virtual machine
CN110633077A (en) Rapid development system and method based on modularization
CN115291936A (en) Deployment document generation method and device and electronic equipment

Legal Events

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