CN117827665A - Project deployment method and device, storage medium and electronic device - Google Patents
Project deployment method and device, storage medium and electronic device Download PDFInfo
- Publication number
- CN117827665A CN117827665A CN202410015946.9A CN202410015946A CN117827665A CN 117827665 A CN117827665 A CN 117827665A CN 202410015946 A CN202410015946 A CN 202410015946A CN 117827665 A CN117827665 A CN 117827665A
- Authority
- CN
- China
- Prior art keywords
- deployed
- item
- test
- environment
- online environment
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 53
- 238000003860 storage Methods 0.000 title claims abstract description 12
- 238000012360 testing method Methods 0.000 claims abstract description 311
- 230000004044 response Effects 0.000 claims abstract description 12
- 238000012795 verification Methods 0.000 claims description 19
- 238000004590 computer program Methods 0.000 claims description 15
- 238000013515 script Methods 0.000 description 16
- 230000001960 triggered effect Effects 0.000 description 8
- 230000005540 biological transmission Effects 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 230000000694 effects Effects 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 238000010276 construction Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 238000012856 packing Methods 0.000 description 2
- 238000011160 research Methods 0.000 description 2
- 230000006872 improvement Effects 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000004806 packaging method and process Methods 0.000 description 1
- 230000002085 persistent effect Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 238000012827 research and development Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3664—Environments for testing or debugging software
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Debugging And Monitoring (AREA)
Abstract
The application discloses a project deployment method and device, a storage medium and an electronic device, wherein the method comprises the following steps: determining items to be deployed; deploying the items to be deployed into a testing environment for testing, and obtaining a first testing result; responding to the first test result to indicate that the item to be deployed passes the test in the test environment, and deploying the item to be deployed into the pre-online environment for testing to obtain a second test result; and in response to the second test result indicating that the item to be deployed passes the test in the pre-online environment, deploying the item to be deployed into the online environment. The technical problem that projects cannot be deployed automatically is solved.
Description
Technical Field
The present invention relates to the field of project development, and in particular, to a project deployment method and apparatus, a storage medium, and an electronic apparatus.
Background
With the development of technology and the increase of demands of people for digital life, the software industry is rapidly developed. In order to ensure the quality and stability of the software project, a test environment, a pre-online environment and a production environment are generally set to test the software project. These environments need to remain uniformly standardized to ensure that developers, testers, and operators can collaborate and deliver in different environments.
In the related technology, when a software project is developed, tested and online, because the test environment and the online environment are not unified and standardized, the software project is not easy to maintain and manage, and is easy to cause problems, only the automatic continuous deployment of one environment is solved, the underlying basic environments of the environments are different, the software project is not easy to construct, migrate and deploy, and the technical problem that the project cannot be deployed automatically exists.
Aiming at the technical problem that the project cannot be automatically deployed, no effective solution is proposed at present.
Disclosure of Invention
The embodiment of the application provides a project deployment method and device, a storage medium and an electronic device, so as to at least solve the technical problem that the project cannot be automatically deployed.
According to an aspect of the embodiments of the present application, there is provided a deployment method for an item, including: determining items to be deployed; deploying the items to be deployed into a testing environment for testing, and obtaining a first testing result; responding to the first test result to indicate that the item to be deployed passes the test in the test environment, and deploying the item to be deployed into the pre-online environment for testing to obtain a second test result; and in response to the second test result indicating that the item to be deployed passes the test in the pre-online environment, deploying the item to be deployed into the online environment.
Optionally, deploying the item to be deployed into a testing environment for testing, including: calling a test mirror image corresponding to the item to be deployed from a mirror image warehouse based on the identification information of the item to be deployed; and deploying the items to be deployed into a testing environment by using the testing mirror image for testing.
Optionally, deploying the item to be deployed into a pre-online environment for testing, including: calling a pre-uploading environment mirror image corresponding to the item to be deployed from a mirror image warehouse based on the identification information of the item to be deployed; and deploying the item to be deployed into the pre-online environment by using the pre-online environment image for testing.
Optionally, deploying the item to be deployed into an online environment includes: calling an online environment mirror image corresponding to the item to be deployed from a mirror image warehouse based on the identification information of the item to be deployed; and deploying the item to be deployed into the online environment by using the online environment mirror image.
Optionally, the deployment method of the project further comprises: carrying out gray level test on the item to be deployed in an on-line environment to obtain a third test result, wherein the gray level test is used for indicating the stability of the item to be deployed to be tested; and responding to the third test result to indicate that the stability of the item to be deployed is higher than a stability threshold value, and upgrading the item to be deployed.
Optionally, the deployment method of the project further comprises: acquiring item codes of items to be deployed; carrying out safety verification on the project codes to obtain verification results; responding to the verification result to indicate the project code safety, and respectively acquiring a first related parameter of a test environment, a second related parameter of a pre-online environment and a third related parameter of the online environment; generating a test image based on the project code and the first related parameter; generating a pre-upload environment image based on the project code and the second correlation parameter; an online environment image is generated based on the project code and the third related parameter.
Optionally, the deployment method of the project further comprises: and storing the test image, the pre-online environment image and the online environment image into an image warehouse.
According to another aspect of the embodiments of the present application, there is also provided a deployment apparatus for an item, including: the determining module is used for determining the item to be deployed; the first test module is used for deploying the items to be deployed into a test environment for testing to obtain a first test result; the second test module is used for responding to the first test result to indicate that the item to be deployed passes the test in the test environment, deploying the item to be deployed into the pre-online environment for testing, and obtaining a second test result; the deployment module is used for responding to the second test result to indicate that the item to be deployed passes the test in the pre-online environment, and deploying the item to be deployed into the online environment.
According to yet another aspect of the embodiments of the present application, there is also provided a computer readable storage medium having a computer program stored therein, wherein the computer program is configured to perform the deployment method of the above items when run.
According to still another aspect of the embodiments of the present application, there is further provided an electronic device including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the deployment method of the above items through the computer program.
According to the method and the device, the items to be deployed are determined; deploying the items to be deployed into a testing environment for testing, and obtaining a first testing result; responding to the first test result to indicate that the item to be deployed passes the test in the test environment, and deploying the item to be deployed into the pre-online environment for testing to obtain a second test result; and in response to the second test result indicating that the item to be deployed passes the test in the pre-online environment, deploying the item to be deployed into the online environment. That is, in the embodiment of the application, the items to be deployed are deployed to the test environment for testing, if the test passes, the items to be deployed are automatically deployed to the pre-online environment for testing, and if the test passes, the items to be deployed are automatically deployed to the online environment, and as the items to be deployed can be automatically deployed to the test environment, the pre-online environment and the online environment in sequence, the purpose of automatically managing and deploying the items in the whole environment is achieved, the technical problem that the items cannot be automatically deployed is solved, and the technical effect of automatically deploying the items is achieved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute an undue limitation to the application. In the drawings:
fig. 1 is a hardware configuration block diagram of a computer terminal of a deployment method of items of an embodiment of the present application;
FIG. 2 is a flow chart of a deployment method of an item according to an embodiment of the present application;
FIG. 3 is a flow chart of a method of full environment automated sustainable code deployment project release management according to an embodiment of the present application;
fig. 4 is a schematic diagram of a deployment apparatus of an item according to an embodiment of the present application.
Detailed Description
In order to make the present application solution better understood by those skilled in the art, the following description will be made in detail and with reference to the accompanying drawings in the embodiments of the present application, it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms and "first," "second," and the like in the description and claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that embodiments of the present application described herein may be implemented in sequences other than those illustrated or otherwise 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.
The method embodiments provided in the embodiments of the present application may be executed in a computer terminal or similar computing device. Taking the operation on a computer terminal as an example, fig. 1 is a block diagram of the hardware structure of the computer terminal of the deployment method of the items in the embodiment of the present application. As shown in fig. 1, the computer terminal may include one or more (only one is shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a microprocessor (Microprocessor Unit, abbreviated MPU) or programmable logic device (Programmable logic device, abbreviated PLD)) and a memory 104 for storing data, and in an exemplary embodiment, the computer terminal may further include a transmission device 106 for communication functions and an input-output device 108. It will be appreciated by those skilled in the art that the configuration shown in fig. 1 is merely illustrative and is not intended to limit the configuration of the computer terminal described above. For example, a computer terminal may also include more or fewer components than shown in FIG. 1, or have a different configuration than the equivalent functions shown in FIG. 1 or more than the functions shown in FIG. 1.
The memory 104 may be used to store a computer program, for example, a software program of application software and a module, such as a computer program corresponding to a deployment method of an item in the embodiment of the present application, and the processor 102 executes the computer program stored in the memory 104 to perform various functional applications and data processing, which corresponds to implementing the above-mentioned method. Memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory remotely located relative to the processor 102, which may be connected to the computer terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of a computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, simply referred to as NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is configured to communicate with the internet wirelessly.
In this embodiment, a method for deploying an item is provided, and fig. 2 is a flowchart of a method for deploying an item according to an embodiment of the present application, where the flowchart includes the following steps:
step S201, determining a project to be deployed.
In the technical solution provided in step S201 of the present application, the item to be deployed is determined, where the item to be deployed is an item to be deployed into the test environment and the online environment, and the item to be deployed may be a software application, which is not specifically limited herein.
In this embodiment, step S202 is performed according to the determined item to be deployed.
Step S202, deploying the items to be deployed into a testing environment for testing, and obtaining a first testing result.
In the technical scheme provided in the above step S202, after determining the item to be deployed according to step S201, the item to be deployed is deployed into a testing environment for testing, so as to obtain a first testing result. The first test result may be used to indicate whether the item to be deployed passes the test of the test environment.
In this embodiment, after determining the item to be deployed, the item to be deployed is deployed into a testing environment for testing. For example, a test image corresponding to the item to be deployed may be called from the image repository, and the item to be deployed may be deployed into the test environment by using the test image. Wherein, the mirror warehouse can be: the container image management tool (harbor), the image repository may also be referred to as an image private repository. The test image may be a container image, and may be generated in advance according to the code of the item to be deployed and the relevant parameters of the test environment.
For example, the project code of the project to be deployed and the related parameters of the test environment may be compiled in advance to generate a test image, and the generated test image is stored in the image warehouse, so that when the project to be deployed needs to be deployed in the test environment for testing later, the test image may be called from the image warehouse by using a container cluster management system (Kubernetes, abbreviated as k8 s), and the project to be deployed is deployed in the test environment by using the test image.
Optionally, after the item to be deployed is deployed in the testing environment, the testing environment may test the item to be deployed, so as to obtain a first testing result, and according to the first testing result, it may be determined whether the item to be deployed passes the test of the testing environment.
Step S203, in response to the first test result indicating that the item to be deployed passes the test in the test environment, the item to be deployed is deployed to the pre-online environment for testing, and a second test result is obtained.
In the technical scheme provided in the above step S203, after determining the first test result according to step S202, when the first test result indicates that the item to be deployed passes the test in the test environment, the item to be deployed is deployed to the pre-online environment for testing, so as to obtain the second test result. The second test result is used for indicating whether the item to be deployed passes the test of the pre-online environment.
In this embodiment, after the first test result is determined, when the first test result indicates that the item to be deployed passes the test in the test environment, the item to be deployed is deployed to the pre-online environment for the test.
For example, the project code of the project to be deployed and the related parameters of the pre-online environment may be compiled and built in advance, a pre-online image is generated, and the generated pre-online image is stored in the image warehouse, so that when the project to be deployed needs to be deployed in the pre-online environment for testing later, the pre-online image may be called from the image warehouse according to the configuration by using k8s, and the project to be deployed in the pre-online environment is deployed by using the pre-online image.
Optionally, after the item to be deployed is deployed in the pre-online environment, the pre-online environment may test the item to be deployed, so as to obtain a second test result, and according to the second test result, it may be determined whether the item to be deployed passes the test of the pre-online environment.
In step S204, in response to the second test result indicating that the item to be deployed passes the test in the pre-online environment, the item to be deployed is deployed into the online environment.
In the technical solution provided in step S204, after determining the second test result according to step S203, when the second test result indicates that the item to be deployed passes the test in the pre-online environment, the item to be deployed is deployed into the online environment.
In this embodiment, after determining the second test result, the item to be deployed is deployed into the online environment when the second test result indicates that the item to be deployed passes the test in the pre-online environment.
For example, the project code of the project to be deployed and the related parameters of the online environment may be compiled and built in advance, an online mirror image is generated, and the generated online mirror image is stored in a mirror image warehouse, so that when the project to be deployed needs to be deployed in the online environment for testing later, the online mirror image may be called from the mirror image warehouse by using k8s, and then the project to be deployed is deployed in the online environment by using the online mirror image.
According to the method and the device for automatically deploying the items to be deployed in the online environment, the items to be deployed are deployed in the test environment for testing, if the items to be deployed pass the test, the items to be deployed are automatically deployed in the online environment, and if the items to be deployed pass the test, the items to be deployed can be automatically deployed in the test environment, the online environment and the online environment in sequence, so that the aim of automatically managing and deploying the items in the whole environment is fulfilled, the technical problem that the items cannot be automatically deployed is solved, and the technical effect of automatically deploying the items is achieved.
The above-described method of this embodiment is further described below.
As an optional embodiment, step S202, deploying the item to be deployed into a testing environment for testing includes: calling a test mirror image corresponding to the item to be deployed from a mirror image warehouse based on the identification information of the item to be deployed; and deploying the items to be deployed into a testing environment by using the testing mirror image for testing.
In this embodiment, when the test image of the item to be deployed is stored in the image repository, the identification information of the item to be deployed may be used as an index to store the test image of the item to be deployed, based on which, after the identification information of the item to be deployed is obtained, the test image corresponding to the item to be deployed may be called from the image repository according to the identification information of the item to be deployed. The mirror warehouse may be a mirror private warehouse harbor, which is only an exemplary example and is not limited thereto.
Optionally, after the test image is invoked, the item to be deployed is deployed into the test environment by using the test image for testing. For example, a persistent integration tool (Jenkins) is used to execute a remote script call k8s to pull a test image from an image private repository harbor, and the test image is used to deploy the item to be deployed in the test environment for testing.
As an optional embodiment, step S203, deploying the item to be deployed into the pre-online environment for testing includes: calling a pre-uploading environment mirror image corresponding to the item to be deployed from a mirror image warehouse based on the identification information of the item to be deployed; and deploying the item to be deployed into the pre-online environment by using the pre-online environment image for testing.
In this embodiment, when the pre-online mirror image of the item to be deployed is stored in the mirror image repository, the identification information of the item to be deployed may be used as an index to store the pre-online mirror image of the item to be deployed, based on which, after the identification information of the item to be deployed is obtained, the pre-online mirror image corresponding to the item to be deployed may be called from the mirror image repository according to the identification information of the item to be deployed.
Optionally, after calling the pre-online mirror image, deploying the item to be deployed into the pre-online environment by using the pre-online mirror image for testing. For example, the Jenkins is used for executing a remote script call k8s to pull the pre-online image from the image private warehouse harbor, and the item to be deployed is deployed in the pre-online environment for testing by using the pre-online image.
As an optional embodiment, step S204, deploying the item to be deployed into an online environment includes: calling an online environment mirror image corresponding to the item to be deployed from a mirror image warehouse based on the identification information of the item to be deployed; and deploying the item to be deployed into the online environment by using the online environment mirror image.
In this embodiment, when the online mirror image of the item to be deployed is stored in the mirror image repository, the identification information of the item to be deployed may be used as an index to store the online mirror image of the item to be deployed, based on which, after the identification information of the item to be deployed is obtained, the online mirror image corresponding to the item to be deployed may be called from the mirror image repository according to the identification information of the item to be deployed.
Optionally, after invoking the online mirror, deploying the item to be deployed into the online environment using the online mirror. For example, remote script call k8s is executed using Jenkins to pull an online image from the image private repository harbor, and the item to be deployed is deployed in an online environment using the online image.
As an optional embodiment, the deployment method of the project further includes: carrying out gray level test on the item to be deployed in an on-line environment to obtain a third test result, wherein the gray level test is used for indicating the stability of the item to be deployed to be tested; and responding to the third test result to indicate that the stability of the item to be deployed is higher than a stability threshold value, and upgrading the item to be deployed.
In this embodiment, gray scale testing is performed on items to be deployed in an on-line environment, and a third test result is obtained. The gray level test is used for testing the stability of the item to be deployed, and the third test result is used for indicating the stability of the item to be deployed, which is only an exemplary example and does not limit the specific content of the third test result.
Optionally, comparing the third test result with a preset stability threshold, and when the stability of the item to be deployed in the third test result is higher than the stability threshold, indicating that the item to be deployed passes the gray scale test in the online environment, and upgrading the item to be deployed.
For example, assuming that the stability of the item to be deployed in the third test result is 80%, the stability threshold is 75%, and since 80% >75%, that is, the stability of the item to be deployed in the third test result is higher than the stability threshold, the item to be deployed is upgraded.
As an optional embodiment, the deployment method of the project further includes: acquiring item codes of items to be deployed; carrying out safety verification on the project codes to obtain verification results; responding to the verification result to indicate the project code safety, and respectively acquiring a first related parameter of a test environment, a second related parameter of a pre-online environment and a third related parameter of the online environment; generating a test image based on the project code and the first related parameter; generating a pre-upload environment image based on the project code and the second correlation parameter; an online environment image is generated based on the project code and the third related parameter.
In this embodiment, the project code of the project to be deployed is obtained, for example, the project code of the project to be deployed uploaded by a developer through a script is obtained through a code repository, which is merely an exemplary example, and a specific method for obtaining the project code of the project to be deployed is not limited.
Optionally, carrying out security verification on the item codes to obtain verification results. Wherein the verification result may be used to indicate whether the project code of the project to be deployed is secure.
For example, a custom script (hook) is triggered by code management software (gitlib), and the project code is prepared by a hook to check and test, and the project code is automatically checked, normalized, checked and tested to obtain a check result.
Optionally, when the verification result is that the project code is safe, the first related parameter of the test environment, the second related parameter of the pre-online environment and the third related parameter of the online environment are respectively obtained. The first related parameter may be related parameter data in the test environment, the second related parameter may be related parameter data in the pre-online environment, and the third related parameter may be related parameter data in the online environment. The specific contents of the first related parameter, the second related parameter, and the third related parameter are merely exemplary examples and are not limited herein.
For example, when the verification result is that the project code is safe, the Webhook is triggered, the Webhook sends a request to the Webhook URL, and the jenkins request is triggered. Jenkins invokes the data of the environment and the parameter preparation center through the interface, and further reads the related variables of the test environment to obtain the related parameter data required by the test environment; similarly, jenkins invokes the data of the environment and the parameter preparation center through the interface, and further reads the related variables of the pre-online environment to obtain the related parameter data required by the pre-online environment; similarly, jenkins invokes the data of the environment and the parameter configuration center through the interface, and further reads the related variables of the online environment to obtain the related parameter data required by the online environment.
Optionally, a test image is generated based on the project code and the first related parameter. For example, the Jenkin is utilized to package, compile and build the project code and the first related parameters by writing the prepared script, so as to generate the mirror image of the test environment. This is merely an illustrative example and is not intended to limit the particular method of generating the test image.
Optionally, a pre-live environment image is generated from the project code and the second related parameter. For example, the item codes and the second related parameters are packed, compiled and constructed by compiling the prepared script by utilizing Jenkin, and the pre-online mirror image is generated. This is merely an illustrative example and is not intended to limit the particular method of generating the pre-line image.
Optionally, an online environment image is generated from the project code and the third related parameter. For example, the Jenkin is utilized to package, compile and build the project code and the third related parameters by writing the prepared script, and a mirror image of the online environment is generated. This is merely an illustrative example and is not intended to limit the particular method of generating an online image.
As an optional embodiment, the deployment method of the project further includes: and storing the test image, the pre-online environment image and the online environment image into an image warehouse.
In this embodiment, after the test image, the pre-online environment image and the online environment image are generated, the test image, the pre-online environment image and the online environment image are stored in the image repository, so that when the item to be deployed is subsequently deployed in the test environment, the pre-online environment and the online environment, the test image, the pre-online environment image and the online environment image can be invoked in the image repository to implement the deployment of the item to be deployed in the test environment, the pre-online environment and the online environment, respectively.
For example, the generated test image, pre-live environment image, and online environment image are uploaded to an image private repository.
According to the method and the device for automatically deploying the items to be deployed in the online environment, the items to be deployed are deployed in the test environment for testing, if the items to be deployed pass the test, the items to be deployed are automatically deployed in the online environment, and if the items to be deployed pass the test, the items to be deployed can be automatically deployed in the test environment, the online environment and the online environment in sequence, so that the aim of automatically managing and deploying the items in the whole environment is fulfilled, the technical problem that the items cannot be automatically deployed is solved, and the technical effect of automatically deploying the items is achieved.
The technical solutions of the examples of the present application are exemplified below in conjunction with preferred embodiments.
The following describes a deployment method of the project in the embodiment of the present application.
FIG. 3 is a flowchart of a method for managing the release of an automation code deployment project in a full environment according to an embodiment of the present application, as shown in FIG. 3, comprising the steps of:
step S301, writing and submitting codes.
In this embodiment, project code is written and submitted to a version store, where code submission can be performed by script, and the server deploys the relevant code store software.
Optionally, after the code is submitted, the code management software gitlib triggers a custom script, performs security test on the submitted project code, and performs automatic verification test and the like.
For example, custom script hook is formulated using gitlib, and the source code repository git registers the triggers of Jenkins, triggered automatically by submitted code. After the code is written by the research personnel, the code is transferred to the Gitlab code warehouse through the passage code on the script program, and the automatic triggering construction is carried out through the git hook, namely, the project code is sent to the warehouse through the webhook of the Gitlab, and then the project is triggered to carry out the automatic construction.
In step S302, a different environment image is generated.
In this embodiment, different environment images are generated according to the project code submitted in step S301 to deploy the project code into different test environments.
Optionally, after the submitted code passes the test, compiling and constructing the code to generate an image of the test environment, an image required by the pre-online environment and an image required by the online environment through related technologies, uploading the three environment images generated by the packaging and constructing into an image warehouse, and storing the three environment images into the image warehouse.
For example, when the submitted code passes the test, the webhook is triggered, and if the submitted code does not pass the test, the test result is automatically fed back to the research personnel, and the mail is notified. The Webhook sends a request to the Webhook URL, triggering a jenkins request.
Optionally, packing and compiling the project, preparing corresponding parameter changes, packing the project code into a Docker container mirror image by using a maven tool, uploading the container mirror image to a mirror image warehouse harbor for mirror image management, and then taking the container mirror image out of the mirror image warehouse by using K8s for distributed deployment.
For example, after a jenkins request is triggered, jenkins invokes data of an environment and a parameter preparation center through an interface, reads related variables of a test environment in a database according to parameters, and obtains related parameter data of a required environment; jenkin packs, compiles and constructs codes by writing prepared scripts to generate a mirror image of a test environment;
optionally, jenkins invokes the data of the environment and the parameter configuration center through the interface, reads the related variables of the pre-upper environment in the database according to the parameters, and acquires the related parameter data of the required environment; jenkin packages, compiles and constructs codes by writing prepared scripts to generate images required by the pre-online environment.
Optionally, jenkins invokes the data of the environment and the parameter configuration center through the interface, reads the related variable of the online environment in the database according to the parameters, and acquires the related parameter data required by the online environment; jenkin packages, compiles and constructs codes by writing prepared scripts to generate images required by the online environment.
Step S303, the project is deployed and tested in the test environment.
In this embodiment, after generating the image of the test environment in step S302, the item may be deployed in the test environment for testing using the image; if the test is passed, step S304 is performed, and if the test is not passed, step S301 is returned.
Optionally, jenkins pulls the test image from the image repository by executing remote script call k8s, and further deploys in the test environment, so that the test environment completes the integrated deployment.
Optionally, when the project test environment deployment is completed, the selection of automatic test or manual test is triggered, and the selection of manual test automatically sends a notification to notify a tester to perform the test. And the automatic test is performed according to the prepared automatic test example.
Alternatively, if an automated test is selected, the automated test may be performed by an automated test tool, with the test completion managing the Bug by an integrated JIRA Bug, mail by built-in mail, and research and development. For example: the test automatically performs a pre-wiring environment release flow through a release system, and the process is the same as the release deployment of the test environment; and if the pre-wiring environment test is passed, the gray scale is deployed to the on-line formal environment.
Step S304, deploying the project in the pre-wiring environment and testing.
In this embodiment, after passing the test in the test environment, the project is automatically deployed to the pre-online environment.
Optionally, after completing the deployment of the project in the pre-line environment, the project is tested, if the test is passed, step S305 is performed, and if the test is not passed, step S301 is returned.
Step S305, deploying the project in an online environment.
In this embodiment, after the test is passed in the pre-online environment, the script will call k8S to pull the online environment image from the image warehouse, and further perform gray deployment in the online environment, if the gray deployment is not passed, automatically submit bug and feed back to the developer to perform code modification and adjustment, and return to step S301, and if the gray deployment is passed, execute step S306.
Step S306, deployment is completed.
In this embodiment, after the gray scale is successfully on-line, and after the verification is successful, the full-scale upgrade is performed, so that the continuous integrated deployment of the whole environment is completed.
According to the embodiment of the invention, a deployment device of the project is also provided. It should be noted that, the deployment apparatus of the project may be used to execute the deployment method of the project.
Fig. 4 is a schematic diagram of a deployment apparatus of an item according to an embodiment of the present application. As shown in fig. 4, the deployment apparatus 400 of the project includes: a determination module 401, a first test module 402, a second test module 403, and a deployment module 404.
A determining module 401, configured to determine an item to be deployed.
The first test module 402 is configured to deploy the item to be deployed into a test environment for testing, so as to obtain a first test result.
The second test module 403 is configured to, in response to the first test result indicating that the item to be deployed passes the test in the test environment, deploy the item to be deployed to the pre-online environment for testing, and obtain a second test result.
The deployment module 404 is configured to deploy the item to be deployed into the online environment in response to the second test result indicating that the item to be deployed passes the test in the pre-online environment.
Alternatively, the first test module 402 may include: the first calling unit is used for calling a test mirror image corresponding to the item to be deployed from the mirror image warehouse based on the identification information of the item to be deployed; the first test unit is used for deploying the items to be deployed into the test environment by using the test mirror image for testing.
Optionally, the second test module 403 may include: the second calling unit is used for calling the pre-upper line environment mirror image corresponding to the item to be deployed from the mirror image warehouse based on the identification information of the item to be deployed; and the second testing unit is used for deploying the item to be deployed into the pre-online environment by utilizing the pre-online environment mirror image for testing.
Optionally, the deployment module 404 may include: the third calling unit is used for calling the online environment mirror image corresponding to the item to be deployed from the mirror image warehouse based on the identification information of the item to be deployed; and the deployment unit is used for deploying the item to be deployed into the online environment by utilizing the online environment mirror image.
Optionally, the deployment apparatus 400 of the project may further include: the third test module is used for carrying out gray level test on the item to be deployed in an on-line environment to obtain a third test result, wherein the gray level test is used for indicating the stability of the item to be deployed to be tested; and the upgrading module is used for upgrading the item to be deployed in response to the third test result indicating that the stability of the item to be deployed is higher than the stability threshold.
Optionally, the deployment apparatus 400 of the project may further include: the first acquisition module is used for acquiring project codes of projects to be deployed; carrying out safety verification on the project codes to obtain verification results; the second acquisition module is used for responding to the verification result to indicate the project code security and respectively acquiring a first related parameter of the test environment, a second related parameter of the pre-online environment and a third related parameter of the online environment; the first generation module is used for generating a test image based on the project code and the first related parameters; the second generation module is used for generating a pre-uploading environment image based on the project codes and the second related parameters; and the third generation module is used for generating an online environment image based on the project codes and the third related parameters.
Optionally, the deployment apparatus 400 of the project may further include: and the storage module is used for storing the test mirror image, the pre-online environment mirror image and the online environment mirror image into the mirror image warehouse.
In one exemplary embodiment, the computer readable storage medium may include, but is not limited to: a usb disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing a computer program.
Specific examples in this embodiment may refer to the examples described in the foregoing embodiments and the exemplary implementation, and this embodiment is not described herein.
Embodiments of the present application also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of the deployment method embodiments of the items described above.
Alternatively, in the present embodiment, the above-described processor may be configured to execute the following steps by a computer program:
s1, determining a project to be deployed.
S2, deploying the items to be deployed into a testing environment for testing, and obtaining a first testing result.
And S3, in response to the first test result that the item to be deployed passes the test in the test environment, deploying the item to be deployed into the pre-online environment for testing, and obtaining a second test result, wherein the pre-online environment is used for simulating the online environment.
And S4, responding to the second test result to enable the item to be deployed to pass the test in the pre-online environment, and deploying the item to be deployed into the online environment.
In an exemplary embodiment, the electronic apparatus may further include a transmission device connected to the processor, and an input/output device connected to the processor.
Specific examples in this embodiment may refer to the examples described in the foregoing embodiments and the exemplary implementation, and this embodiment is not described herein.
It will be appreciated by those skilled in the art that the modules or steps of the application described above may be implemented in a general purpose computing device, they may be concentrated on a single computing device, or distributed across a network of computing devices, they may be implemented in program code executable by computing devices, so that they may be stored in a storage device for execution by computing devices, and in some cases, the steps shown or described may be performed in a different order than that shown or described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple modules or steps of them may be fabricated into a single integrated circuit module. Thus, the present application is not limited to any specific combination of hardware and software.
The foregoing is merely a preferred embodiment of the present application and is not intended to limit the present application, and various modifications and variations may be made to the present application by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application should be included in the protection scope of the present application.
Claims (10)
1. A method of deploying an item, comprising:
determining items to be deployed;
deploying the items to be deployed into a testing environment for testing, and obtaining a first testing result;
responding to the first test result that the item to be deployed passes the test in the test environment, deploying the item to be deployed into a pre-online environment for testing, and obtaining a second test result, wherein the pre-online environment is used for simulating the online environment;
and in response to the second test result, deploying the item to be deployed into the online environment by testing the item to be deployed in the pre-online environment.
2. The method of claim 1, wherein deploying the item to be deployed into a testing environment for testing comprises:
calling a test mirror image corresponding to the item to be deployed from a mirror image warehouse based on the identification information of the item to be deployed;
and deploying the item to be deployed into the test environment by using the test mirror image for testing.
3. The method of claim 1, wherein deploying the item to be deployed into a pre-online environment for testing comprises:
invoking a pre-uploading environment mirror image corresponding to the item to be deployed from a mirror image warehouse based on the identification information of the item to be deployed;
and deploying the item to be deployed into the pre-online environment by using the pre-online environment mirror image for testing.
4. The method of claim 1, wherein deploying the item to be deployed into an online environment comprises:
calling an online environment mirror image corresponding to the item to be deployed from a mirror image warehouse based on the identification information of the item to be deployed;
and deploying the item to be deployed into the online environment by utilizing the online environment mirror image.
5. The method according to claim 4, wherein the method further comprises:
carrying out gray level test on the item to be deployed in the online environment to obtain a third test result, wherein the gray level test is used for indicating to test the stability of the item to be deployed;
and upgrading the item to be deployed in response to the third test result being that the stability of the item to be deployed is higher than a stability threshold.
6. The method according to claim 1, wherein the method further comprises:
acquiring an item code of the item to be deployed;
carrying out safety verification on the item codes to obtain verification results;
responding to the verification result to obtain the project code safety, and respectively obtaining a first related parameter of the test environment, a second related parameter of the pre-online environment and a third related parameter of the online environment;
generating the test image based on the project code and the first related parameter;
generating the pre-upload environment image based on the project code and the second related parameter; the online environment image is generated based on the project code and the third related parameter.
7. The method of claim 6, wherein the method further comprises:
and storing the test image, the pre-online environment image and the online environment image into an image warehouse.
8. A deployment apparatus of an item, comprising:
the determining module is used for determining the item to be deployed;
the first test module is used for deploying the item to be deployed into a test environment for testing to obtain a first test result;
the second test module is used for responding to the first test result that the item to be deployed passes the test in the test environment, deploying the item to be deployed into a pre-online environment for testing, and obtaining a second test result, wherein the pre-online environment is used for simulating the online environment;
and the deployment module is used for deploying the item to be deployed into the online environment in response to the second test result that the item to be deployed passes the test in the pre-online environment.
9. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein a computer program, wherein the computer program is arranged to perform the deployment method of the item of any of the preceding claims 1 to 7 when run on a computer or processor.
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 run the computer program to perform the deployment method of the item as claimed in any of the preceding claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410015946.9A CN117827665A (en) | 2024-01-03 | 2024-01-03 | Project deployment method and device, storage medium and electronic device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410015946.9A CN117827665A (en) | 2024-01-03 | 2024-01-03 | Project deployment method and device, storage medium and electronic device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117827665A true CN117827665A (en) | 2024-04-05 |
Family
ID=90515139
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410015946.9A Pending CN117827665A (en) | 2024-01-03 | 2024-01-03 | Project deployment method and device, storage medium and electronic device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117827665A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118631827A (en) * | 2024-08-14 | 2024-09-10 | 天翼视联科技有限公司 | Mirror image distribution method and device, electronic device and storage medium |
-
2024
- 2024-01-03 CN CN202410015946.9A patent/CN117827665A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118631827A (en) * | 2024-08-14 | 2024-09-10 | 天翼视联科技有限公司 | Mirror image distribution method and device, electronic device and storage medium |
CN118631827B (en) * | 2024-08-14 | 2024-11-05 | 天翼视联科技有限公司 | Mirror image distribution method and device, electronic device and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109683899A (en) | A kind of software integrating method and device | |
RU2628176C2 (en) | Systems, methods and computer software products for assembly and loading process of software with use of compilation and deployment service | |
CN108319460B (en) | Method and device for generating application program installation package, electronic equipment and storage medium | |
CN113703730A (en) | Continuous integration method and device, computer equipment and storage medium | |
US20130179865A1 (en) | Automated error checking system for a software application and method therefor | |
CN113111000B (en) | Continuous integrated automatic test system and method, electronic equipment and storage medium | |
CN107092489B (en) | Processing method and system based on application version release | |
CN110532182B (en) | Automatic testing method and device for virtualization platform | |
CN112379969B (en) | Continuous integrated delivery method based on containerized application and related equipment | |
CN117370203B (en) | Automatic test method, system, electronic equipment and storage medium | |
CN112596784B (en) | Iterative version deployment method and device | |
CN117827665A (en) | Project deployment method and device, storage medium and electronic device | |
CN112579099A (en) | Code deployment method and device, storage medium and electronic equipment | |
CN111651169A (en) | Block chain intelligent contract operation method and system based on web container | |
CN114237754A (en) | Data loading method and device, electronic equipment and storage medium | |
CN111767218A (en) | Automatic testing method, equipment and storage medium for continuous integration | |
CN117270864A (en) | Code compiling method, device, equipment and storage medium | |
CN112015436A (en) | Short message platform deployment method and device, computing equipment and computer storage medium | |
CN116521530A (en) | Unit test method, device, apparatus, storage medium and product | |
CN114003257A (en) | Upgrading method and device | |
CN115729590A (en) | Service deployment method, device, equipment and computer readable storage medium | |
CN112667491B (en) | Function test method and device for virtual machine | |
CN115543491A (en) | Microservice processing method and device | |
CN114895916A (en) | Code deployment method, device, storage medium and electronic equipment | |
CN113934405A (en) | Plug-in processing method, device, equipment, storage medium and computer program product |
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 |