Test environment deployment method and device, equipment and storage medium
By combining Jenkins and Python, the deployment and display of the test environment are automated, solving the problems of high manpower consumption and low efficiency in test environment deployment, and realizing efficient and visualized multi-machine deployment management.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA CONSTRUCTION BANK
- Filing Date
- 2022-12-06
- Publication Date
- 2026-04-21
AI Technical Summary
In existing technologies, deploying a test environment requires a lot of manpower, has low deployment efficiency, and is easily affected by window time constraints, which can lead to delays in project verification.
Configure test environment deployment task information through Jenkins, execute deployment tasks on multiple machines in parallel or serial mode using Python, and obtain and display deployment result information, with support for automatic rollback processing.
It enables automated, scheduled deployment of multiple machines, reducing manpower consumption, improving deployment efficiency, and providing an intuitive display of deployment results, avoiding delays caused by window time limitations.
Smart Images

Figure CN115794642B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of big data processing technology, and in particular to a test environment deployment method, apparatus, equipment and storage medium. Background Technology
[0002] In related technologies, test environments require developers to deploy them individually, even on machines with identical test environments. Furthermore, test environment deployment has time windows. Developers can request temporary modifications to the test environment, but frequent requests for temporary modifications easily lead to errors, making it impossible to guarantee successful deployment of all test environments within the limited time. For example, to ensure the testing and verification work of the channel platform group, there are two daily test versions and various release versions, involving dozens of test environments and internal verification environments. Test environments have time windows (e.g., 1.5 hours or 0.5 hours after get off work), and temporary modification rights can be requested. Due to tight deadlines, developers frequently request modifications, easily leading to errors. If there are too many error types or deployment status steps are missed, it cannot be guaranteed that the application services in each environment will function normally within the limited time, thus affecting the project group's testing and verification work. Alternatively, related technologies also include pipelined test environment deployment solutions based on DevOps (a combination of Development and Operations, encompassing processes, methods, and systems). These solutions require developers to apply for passwordless access, associate DevOps packaging and compilation, and other processes. Deployment machine configurations are listed in scripts, making maintenance difficult, and the execution result logs must be checked by developers machine-by-machine, with no rollback options. Both of these methods require test environment deployment to be performed on each machine, and the deployment results also require manual checking on each machine. Therefore, these test environment deployment solutions not only consume significant manpower but also negatively impact deployment efficiency. Summary of the Invention
[0003] This application discloses a method, apparatus, device, and storage medium for deploying a test environment, to solve the technical problems of high manpower requirements and low deployment efficiency in related technologies. The technical solution of this application is as follows:
[0004] Firstly, this application discloses a method for deploying a test environment, including:
[0005] Obtain task information for deployment tasks in the test environment configured through Jenkins; wherein, the task information includes a set of machine information for which the test environment needs to be deployed, the deployment time, and test environment information; the set of machine information includes machine information corresponding to each of the multiple machines;
[0006] At the deployment time, based on the machine information set and the test environment information, a test environment deployment task is performed on each of the machines;
[0007] Obtain the deployment result information of the test environment deployment task for each of the aforementioned machines;
[0008] Displays the deployment results information of the test environment deployment task for each of the machines.
[0009] In one possible implementation, the step of performing a test environment deployment task for each machine based on the machine information set and the test environment information at the deployment time includes:
[0010] During the deployment time, the test environment deployment task is executed on each machine in parallel or serial manner using Python based on the machine information set and the test environment information.
[0011] In one possible implementation, after obtaining the deployment result information of the test environment deployment task for each of the machines, the method further includes:
[0012] For the i The machine, in the first i If the deployment result of the test environment deployment task on the first machine is a deployment failure, a rollback process is executed using Python to ensure that the first machine's test environment deployment fails. i The machine is reverted to the test environment prior to executing the aforementioned test environment deployment task; wherein... i∈ (1, n), where n is the total number of machines for which the test environment needs to be deployed.
[0013] In one possible implementation, the machine information includes a machine identifier and a test environment deployment path.
[0014] In one possible implementation, displaying the deployment result information of the test environment deployment task for each of the machines includes:
[0015] The deployment result information of the test environment deployment task for each machine is obtained using Python; wherein, the deployment result information includes deployment task status, deployment log, and machine identifier;
[0016] The deployment results of the test environment deployment task for each of the machines are rendered into an HTML file.
[0017] Display the HTML file.
[0018] In one possible implementation, displaying the HTML file includes:
[0019] Expand to display the deployment task status and machine identifier of the test environment deployment task for each machine, and collapse to display the deployment log of the test environment deployment task for each machine.
[0020] The method further includes:
[0021] Upon receiving a command to view the deployment log of the test environment deployment task for the target machine, expand and display the deployment log of the test environment deployment task for the target machine; wherein, the target machine is any one of the machines for which the test environment needs to be deployed.
[0022] If the authentication result is successful, subsequent service operations will be performed.
[0023] Secondly, this application discloses a test environment deployment apparatus, comprising:
[0024] The first information acquisition module is used to acquire task information of the test environment deployment task configured through Jenkins; wherein, the task information includes a set of machine information for which the test environment needs to be deployed, the deployment time, and the test environment information; the set of machine information includes machine information corresponding to multiple machines;
[0025] The deployment module is used to perform a test environment deployment task for each of the machines based on the machine information set and the test environment information at the deployment time.
[0026] The second information acquisition module is used to acquire the deployment result information of the test environment deployment task for each of the machines.
[0027] The first information display module is used to display the deployment result information of the test environment deployment task for each of the machines.
[0028] In one possible implementation, the deployment module is specifically used for:
[0029] During the deployment period, the test environment deployment task is executed on each machine using Python, based on the machine information set and the test environment information, either in parallel or serially.
[0030] In one possible implementation, the device further includes:
[0031] The rollback module is used for the first... i The machine, in the first i If the deployment result of the test environment deployment task on the first machine is a deployment failure, a rollback process is executed using Python to ensure that the first machine's test environment deployment fails. i The machine is reverted to the test environment prior to executing the aforementioned test environment deployment task; wherein...i∈ (1, n), where n is the total number of machines for which the test environment needs to be deployed.
[0032] In one possible implementation, the machine information includes a machine identifier and a test environment deployment path.
[0033] In one possible implementation, the first information display module includes:
[0034] The information acquisition unit is used to acquire deployment result information of the test environment deployment task for each machine using Python; wherein, the deployment result information includes deployment task status, deployment log, and machine identifier;
[0035] The file generation unit is used to render the deployment result information of the test environment deployment task of each machine into a Hypertext Markup Language (HTML) file.
[0036] The file display unit is used to display the HTML file.
[0037] In one possible implementation, the file display unit includes:
[0038] The information display subunit is used to expand and display the deployment task status and machine identifier of the test environment deployment task for each machine, and to collapse and display the deployment log of the test environment deployment task for each machine.
[0039] The device further includes:
[0040] The second information display module is used to expand and display the deployment log of the test environment deployment task of the target machine when a viewing instruction is received for the deployment log of the test environment deployment task of the target machine is received; wherein, the target machine is any one of the machines that need to deploy the test environment.
[0041] Thirdly, this application discloses an electronic device, including:
[0042] processor;
[0043] Memory used to store the processor's executable instructions;
[0044] The processor is configured to execute the instructions to implement the method described in the first aspect.
[0045] Fourthly, this application discloses a computer-readable storage medium having a computer program stored thereon, characterized in that the computer program, when executed by a processor, implements the method described in the first aspect.
[0046] Fifthly, this application discloses a computer program product, including a computer program / instructions, characterized in that the computer program / instructions, when executed by a processor, implement the method described in the first aspect.
[0047] The technical solution disclosed in this application brings at least the following beneficial effects:
[0048] In the technical solution disclosed in this application, task information for test environment deployment tasks is configured through Jenkins. This task information includes a set of machine information for which the test environment needs to be deployed, the deployment time, and test environment information. The machine information set includes the machine information corresponding to each of the multiple machines. At the deployment time, based on the machine information set and the test environment information, a test environment deployment task is executed on each machine. The deployment result information for each machine's test environment deployment task is obtained and displayed. In this way, on the one hand, Jenkins can automatically achieve scheduled deployment of test environments on multiple machines, eliminating the need for developers to deploy test environments on each machine individually or to request modification rights due to window time limitations, thus effectively reducing manpower consumption and improving test environment deployment efficiency. On the other hand, it can also display the test environment deployment result information for each machine. This allows developers to intuitively and clearly understand the test environment deployment result information for each machine.
[0049] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0050] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application, and do not constitute an undue limitation of this application.
[0051] Figure 1 A flowchart illustrating a test environment deployment method provided in the first embodiment of this application;
[0052] Figure 2 A flowchart illustrating a test environment deployment method provided in the second embodiment of this application;
[0053] Figure 3 A schematic diagram of a test environment deployment device provided in the third embodiment of this application;
[0054] Figure 4 This is a schematic diagram of the structure of an electronic device provided in the fourth embodiment of this application. Detailed Implementation
[0055] To enable those skilled in the art to better understand the technical solutions of this application, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings.
[0056] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0057] The acquisition, storage, use, and processing of data in this application all comply with the relevant provisions of national laws and regulations.
[0058] The technical solutions provided by the various embodiments of this application are described in detail below with reference to the accompanying drawings.
[0059] Figure 1 The flowchart illustrates a test environment deployment method provided in the first embodiment of this application. This method can be applied to electronic devices, which may have a test environment deployment tool installed. This test environment deployment tool can be implemented based on Jenkins and Python. Figure 1 As shown, the test environment deployment method may include the following steps:
[0060] S101 retrieves task information for deployment tasks in the test environment configured through Jenkins.
[0061] The task information can include a set of machine information for which the test environment needs to be deployed, the deployment time, and the test environment information. The machine information set includes the machine information for each of the multiple machines, and can be in list format for easy maintenance. The machine information can include the machine identifier and the test environment deployment path. The deployment time can be the deployment time of the test environment deployment task, enabling scheduled deployment of test environments across multiple machines. The test environment information can be the specific information of the test environment to be deployed in the test environment deployment task. Jenkins is an open-source software project, a continuous integration tool developed based on Java, used to monitor repetitive tasks. It aims to provide an open and easy-to-use software platform that enables continuous integration for software projects.
[0062] In the embodiments of this application, when a test environment deployment is desired, developers can configure the task information of the test environment deployment task through Jenkins, so that the test environment deployment tool can receive and obtain the task information of the test environment deployment task configured through Jenkins. For example, the task information of the test environment deployment task can be configured on the scheduled configuration page. For instance, a test environment deployment task can be created using Jenkins on the scheduled configuration page, and the specific task information of the test environment deployment task can be configured. For example, the deployment time of the test environment deployment task can be configured down to the specific hour, minute, and second of each day, thus enabling the scheduled execution of the test environment deployment task.
[0063] S102, based on the machine information set and test environment information, performs test environment deployment tasks on each machine at deployment time.
[0064] In the embodiments of this application, after obtaining the task information of the test environment deployment task configured through Jenkins, the test environment deployment task can be executed on each machine in the machine information set that needs to have the test environment deployed, based on the machine information set and the test environment information, at the deployment time. For example, Jenkins can obtain the machine identifier and test environment deployment path corresponding to each machine in the machine information set, as well as the test environment information in the task information of the test environment deployment task. Then, the machines that need to have the test environment deployed are determined according to the machine identifiers, and at the deployment time, the test environment is automatically and periodically deployed on each machine according to the test environment deployment path of each machine. In this way, the scheduled deployment of test environments on multiple machines can be achieved.
[0065] S103: Obtain the deployment result information of the test environment deployment task for each machine.
[0066] In the embodiments of this application, after executing a test environment deployment task on each machine using Python based on machine information set, deployment time, and test environment information, the deployment result information of the test environment deployment task on each machine can be obtained. For example, Python can be used to obtain the deployment task status (e.g., deployment successful, deployment failed), deployment logs, and the machine identifier of each machine for the test environment deployment task on each machine. It is understood that obtaining the deployment result information of the test environment deployment task on each machine can be done uniformly after the test environment deployment tasks on all machines have been completed, or it can be done individually after the test environment deployment tasks on each machine have been completed.
[0067] S104 displays the deployment results of the test environment deployment task for each machine.
[0068] In this embodiment, after obtaining the deployment result information of the test environment deployment task for each machine, the deployment result information of the test environment deployment task for each machine can be displayed on the page. For example, the deployment result information of the test environment deployment task for each machine can be visually displayed on the result display page. It is understood that when displaying the deployment result information of the test environment deployment task for each machine, the deployment result information can be displayed in blocks according to the deployment status. For example, the deployment result information of the test environment deployment task for successfully deployed machines can be displayed in one block, and the deployment result information of the test environment deployment task for unsuccessful machines can be displayed in another block.
[0069] In the embodiments of this application, task information for test environment deployment tasks is configured through Jenkins. This task information includes a set of machine information for which the test environment needs to be deployed, the deployment time, and test environment information. The machine information set includes the machine information corresponding to each of the multiple machines. At the deployment time, based on the machine information set and the test environment information, a test environment deployment task is executed on each machine. The deployment result information for each machine's test environment deployment task is obtained. The deployment result information for each machine's test environment deployment task is displayed. In this way, on the one hand, Jenkins can automatically achieve scheduled deployment of test environments on multiple machines, eliminating the need for developers to deploy test environments on each machine individually or to request modification rights due to window time limitations. This effectively reduces manpower consumption, improves test environment deployment efficiency, and ensures that the test environment can be updated normally within a limited time. On the other hand, it can also display the test environment deployment result information for each machine. This allows developers to intuitively and clearly understand the test environment deployment result information for each machine.
[0070] In some possible implementations, the specific way to perform the test environment deployment task for each machine based on the machine information set and test environment information at the deployment time in the above steps can be as follows:
[0071] During deployment, Python is used to perform test environment deployment tasks on each machine in parallel or serial manner, based on machine information sets and test environment information.
[0072] In the embodiments of this application, when executing the test environment deployment task for each machine based on the machine information set and test environment information at the deployment time, Jenkins can call Python to obtain the machine identifier and test environment deployment path corresponding to each machine in the machine information set, as well as the test environment information in the task information of the test environment deployment task. Then, the machine that needs to be deployed for the test environment is determined according to the machine identifier. At the deployment time, the test environment is automatically and periodically deployed for each machine that needs to be deployed for the test environment according to the test environment deployment path of each machine. When deploying the test environment for each machine that needs to be deployed for the test environment, it can be deployed sequentially for each machine, or it can be deployed in parallel for multiple machines. That is to say, the scheduled deployment of test environments for multiple machines can be realized by combining Python with Jenkins, and the test environment deployment task can be configured to be executed sequentially or concurrently for multiple machines according to actual needs.
[0073] In some possible implementations, after obtaining the deployment result information of the test environment deployment task for each machine in the above steps, the following processing can also be performed:
[0074] For the i The machine, in the first i If the deployment result of the test environment deployment task on the first machine is a deployment failure, execute the test environment rollback process via Python to ensure that the deployment fails. i The machine is rolled back to the test environment before the test environment deployment task was executed.
[0075] in, i∈ (1, n), where n is the total number of machines that need to be deployed for the test environment.
[0076] In the embodiments of this application, after obtaining the deployment result information of the test environment deployment task for each machine, version rollback processing can also be performed for machines where deployment failed. For example, for the first... i The machine can obtain the first i The deployment status of the deployment result information for the deployment task in the test environment on the 1st machine. i If the deployment status of the deployment task in the test environment on the first machine is "deployment failed," a rollback process for the test environment can be executed using Python to ensure that the deployment fails. i The machine is rolled back to the test environment before the test environment deployment task was executed. This is understandable. i Values can be selected sequentially from 1 to n, or randomly. Rollback processing can also be executed based on rollback tasks created by developers, and these rollback tasks can be configured via Jenkins. 。This avoids situations where failure to deploy the test environment affects subsequent tests, thus improving the success rate of testing.
[0077] In some possible implementations, the above steps display deployment result information for the test environment deployment task on each machine, including:
[0078] Obtain deployment result information of the test environment deployment task for each machine using Python;
[0079] Render the deployment results of the test environment deployment task for each machine into an HTML file.
[0080] Display HTML files.
[0081] The deployment result information includes deployment task status, deployment logs, and machine identifiers; understandably, the deployment result information may also include rollback logs.
[0082] In the embodiments of this application, when displaying the deployment result information of the test environment deployment task for each machine, the deployment result information of the test environment deployment task for each machine can be obtained through Python. For example, information such as the deployment task status, deployment logs, and machine identifiers of each machine's test environment deployment task can be obtained. Then, the deployment result information of the test environment deployment task for each machine can be rendered to obtain an HTML (Hypertext Markup Language) file. This HTML file can then be displayed on the interface. In this way, the deployment result information of the test environment deployment task for each machine can be visually displayed, making the deployment result information clear at a glance, less likely to be missed, and easy to view.
[0083] In some possible implementations, displaying the HTML file in the above steps may include:
[0084] Expand to display the deployment task status and machine identifier of the test environment deployment task for each machine; collapse to display the deployment log of the test environment deployment task for each machine.
[0085] Upon receiving a command to view the deployment logs of the test environment deployment task for the target machine, expand and display the deployment logs of the test environment deployment task for the target machine; where the target machine is any one of the machines for which the test environment needs to be deployed.
[0086] In the embodiments of this application, considering that the execution logs (which may be deployment logs or rollback logs) are typically extensive and detailed, the deployment result information can be displayed by expanding the deployment task status and machine identifier of the test environment deployment task for each machine, and can also be displayed by collapsing the deployment logs of the test environment deployment task for each machine. For example, deployment information can be displayed using tags. It is understood that if the deployment result information includes rollback logs, the rollback logs of each machine that performed the rollback process can also be displayed by collapsing. If a developer wants to view the deployment logs of a specific machine (target machine), they can operate the electronic device to receive a viewing instruction for the deployment logs of the test environment deployment task for the target machine. In response to this viewing instruction, the deployment logs of the test environment of the target machine can be expanded. It is understood that if rollback logs are displayed by collapsing, developers can also view the rollback logs. In this way, developers can select which logs they want to view according to their needs.
[0087] To make the test environment deployment method provided in the embodiments of this application clearer, the following is in conjunction with the appendix. Figure 2 The test environment deployment method provided in the embodiments of this application will be described.
[0088] The test environment deployment method provided in this application can be applied to electronic devices equipped with a test environment deployment tool. This tool can be implemented based on Jenkins and Python. Jenkins enables scheduled deployment and rollback, while Python enables remote deployment, rollback, log output, and result report visualization. The test environment deployment tool can consist of two parts: a front-end page and a Python processing program. The front-end page is divided into a scheduled configuration page and a result display page; the Python processing program includes three modules: a Python deployment processing program, a Python rollback processing program, and a result file visualization processing program.
[0089] The scheduled configuration page can perform the following functions: (1) Create test environment deployment tasks and test environment rollback tasks according to different test environment deployment requirements; (2) Configure the machine information set for automatic test environment deployment tasks and test environment rollback tasks, i.e., the machine information list; (3) Configure the scheduled execution time of the task, which can be specified to the hour, minute and second of each day. For deployment tasks, it is the deployment time, and for rollback tasks, it is the rollback time; (4) Configure the serial or concurrent execution of tasks (such as deployment tasks and rollback tasks). This scheduled configuration page can use Jenkins to create project scheduled tasks (such as test environment deployment tasks and rollback tasks). The execution of scheduled tasks requires calling the corresponding Python deployment handler and Python rollback handler. Based on Jenkins MultiJob, the serial execution of the same task is implemented, and the parallel execution of tasks is not allowed. The result display page can perform the following functions: statistical visualization display of task execution results (such as deployment result information and rollback result information), and display of call log details. The task execution results can include: the name of the executed task, the IP address and username of the machine that reported the execution error, the execution status (success / failure), the description of the execution result status, and the execution log details. The execution log details use tags; clicking them expands to display the detailed execution logs for the corresponding machine IP / username. This page can be implemented using Python pandas to visualize and display the deployment logs and rollback log details on an HTML page.
[0090] This Python deployment handler can read a set of machine information, i.e., a list of machines for deployment files, batch log in to remote machines to execute deployment scripts (i.e., test environment information), and write execution logs and results to a result file (i.e., deployment result information). This program can be implemented using Python Fabric, a Python-based SSH (Secure Shell) command-line tool that simplifies SSH application deployment and system management tasks. It provides basic system operation components, enabling local or remote shell commands, including batch command execution, file upload, download, and complete execution log output. The Python rollback handler can read a rollback machine list. The rollback machine list can be generated in the following ways: a. matching the machine IPs and usernames of machines that failed deployments in the deployment result file; b. manually configuring the machine file list as needed, as rollbacks are sometimes required even when deployments didn't report errors. This program can still use Fabric to achieve remote login, batch execution of rollback scripts, and generation of rollback logs and result files. The results file visualization and display program can visualize deployment logs, rollback logs, and results files, making operation results easy to understand. The visualization statistics are divided into two main sections: success (e.g., successful deployment, successful rollback) and failure (e.g., successful rollback, failed rollback), listing: task name, IP address and username of the machine that encountered the error, task status (success / failure), task result status description, and execution log details. The execution log details page can be navigated to on a separate line. The program reads data from each task's execution results file, using the pathlib library to traverse folders to find and read the target files. The read data is then formatted and rendered into an HTML file for display.
[0091] See Figure 2 When executing the test environment deployment method, the task information for the test environment deployment task can be configured first, including configuring the set of machine information to be deployed, the deployment time, and the test environment information. The machine information set includes the machine information corresponding to each of the multiple machines, and the machine information set can be in the form of a machine list. Then, the Python deployment handler can be called to execute the deployment task. Next, it is determined whether the deployment task on each machine was successful. If the deployment tasks on all machines are successfully deployed, the process can end. Conversely, if the deployment on any machine fails, it can be determined whether rollback processing is needed. For machines requiring rollback processing, the Python rollback handler can be called to perform version rollback processing. After the version rollback processing is completed, the process ends. It is understood that the deployment task and rollback task can be executed serially on each machine or in parallel on multiple machines.
[0092] Based on the same inventive concept, embodiments of this application also provide a test environment deployment device. For example... Figure 3 As shown, the test environment deployment device 300 includes:
[0093] The first information acquisition module 310 is used to acquire task information of the test environment deployment task configured through Jenkins; wherein, the task information includes a set of machine information for which the test environment needs to be deployed, the deployment time, and the test environment information; the set of machine information includes machine information corresponding to each of the multiple machines;
[0094] Deployment module 320 is used to perform a test environment deployment task for each of the machines based on the machine information set and the test environment information at the deployment time;
[0095] The second information acquisition module 330 is used to acquire the deployment result information of the test environment deployment task for each of the machines.
[0096] The first information display module 340 is used to display the deployment result information of the test environment deployment task for each of the machines.
[0097] In one possible implementation, the deployment module 320 is specifically used for:
[0098] During the deployment time, the test environment deployment task is executed on each machine in parallel or serial manner using Python based on the machine information set and the test environment information.
[0099] In one possible implementation, the device 300 further includes:
[0100] The rollback module is used for the first... i The machine, in the first i If the deployment result of the test environment deployment task on the first machine is a deployment failure, a rollback process is executed using Python to ensure that the first machine's test environment deployment fails. i The machine is reverted to the test environment prior to executing the aforementioned test environment deployment task; wherein... i∈ (1, n), where n is the total number of machines for which the test environment needs to be deployed.
[0101] In one possible implementation, the machine information includes a machine identifier and a test environment deployment path.
[0102] In one possible implementation, the first information display module 340 includes:
[0103] The information acquisition unit is used to acquire deployment result information of the test environment deployment task for each machine through the Python; wherein, the deployment result information includes deployment task status, deployment log, and machine identifier;
[0104] The file generation unit is used to render the deployment result information of the test environment deployment task of each machine into a Hypertext Markup Language (HTML) file.
[0105] The file display unit is used to display the HTML file.
[0106] In one possible implementation, the file display unit includes:
[0107] The information display subunit is used to expand and display the deployment task status and machine identifier of the test environment deployment task for each machine, and to collapse and display the deployment log of the test environment deployment task for each machine.
[0108] The device 300 further includes:
[0109] The second information display module is used to expand and display the deployment log of the test environment deployment task of the target machine when a viewing instruction is received for the deployment log of the test environment deployment task of the target machine is received; wherein, the target machine is any one of the machines that need to deploy the test environment.
[0110] The specific implementation and technical effects of the device provided in this application are similar to those of the above-described method embodiments, and will not be repeated here.
[0111] According to embodiments of this application, this application also discloses an electronic device, a computer-readable storage medium, and a computer program product.
[0112] Figure 4 A schematic block diagram of an example electronic device 400 that can be used to implement embodiments of this application is shown. Electronic device 400 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic device 400 may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the application described and / or claimed herein.
[0113] like Figure 4As shown, the electronic device 400 includes a computing unit 401, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 402 or a computer program loaded from a storage unit 408 into a random access memory (RAM) 403. The RAM 403 may also store various programs and data required for the operation of the device 400. The computing unit 401, ROM 402, and RAM 403 are interconnected via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0114] Multiple components in electronic device 400 are connected to I / O interface 405, including: input unit 406, such as keyboard, mouse, etc.; output unit 407, such as various types of displays, speakers, etc.; storage unit 408, such as disk, optical disk, etc.; and communication unit 409, such as network card, modem, wireless transceiver, etc. Communication unit 409 allows electronic device 400 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0115] The computing unit 401 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 401 performs the various methods and processes described above, such as the test environment deployment method. For example, in some embodiments, the test environment deployment method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 408. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 400 via ROM 402 and / or communication unit 409. When the computer program is loaded into RAM 403 and executed by the computing unit 401, one or more steps of the test environment deployment method described above may be performed. Alternatively, in other embodiments, the computing unit 401 may be configured to perform the test environment deployment method by any other suitable means (e.g., by means of firmware).
[0116] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0117] The program code of a computer program product used to implement the methods of this application may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0118] In the context of this application, a computer-readable storage medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium can be a machine-readable signal medium or a machine-readable storage medium. A computer-readable storage medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of computer-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0119] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0120] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), the Internet, and blockchain networks.
[0121] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service system that addresses the shortcomings of traditional physical hosts and VPS (Virtual Private Server) services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers incorporating blockchain technology.
[0122] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this application can be achieved, and this is not limited herein.
[0123] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A method for deploying a test environment, characterized in that, include: Obtain task information for deployment tasks in the test environment configured through Jenkins; wherein, the task information includes a set of machine information for which the test environment needs to be deployed, the deployment time, and test environment information; the set of machine information includes machine information corresponding to each of the multiple machines; At the deployment time, based on the machine information set and the test environment information, a test environment deployment task is performed on each of the machines; Obtain the deployment result information of the test environment deployment task for each of the aforementioned machines; Displays the deployment results of the test environment deployment task for each of the machines; The machine information includes the machine identifier and the test environment deployment path; The information displayed includes the deployment results of the test environment deployment task for each machine, including: The deployment result information of the test environment deployment task for each machine is obtained using Python; wherein, the deployment result information includes deployment task status, deployment log, and machine identifier; The deployment results of the test environment deployment task for each of the machines are rendered into an HTML file. Display the HTML file; The display of the HTML file includes: Expand to display the deployment task status and machine identifier of the test environment deployment task for each machine, and collapse to display the deployment log of the test environment deployment task for each machine. The method further includes: Upon receiving a command to view the deployment log of the test environment deployment task for the target machine, the deployment log of the test environment deployment task for the target machine is expanded and displayed; wherein, the target machine is any one of the machines for which the test environment needs to be deployed.
2. The method according to claim 1, characterized in that, The step of performing a test environment deployment task on each machine based on the machine information set and the test environment information at the deployment time includes: During the deployment time, the test environment deployment task is executed on each machine in parallel or serial manner using Python based on the machine information set and the test environment information.
3. The method according to claim 1, characterized in that, After obtaining the deployment result information of the test environment deployment task for each of the machines, the method further includes: For the i The machine, in the first i If the deployment result of the test environment deployment task on the first machine is a deployment failure, a rollback process is executed using Python to ensure that the first machine's test environment deployment fails. i The machine is reverted to the test environment prior to executing the aforementioned test environment deployment task; wherein... i∈ (1, n), where n is the total number of machines for which the test environment needs to be deployed.
4. A test environment deployment device, characterized in that, include The first information acquisition module is used to acquire task information of the test environment deployment task configured through Jenkins; wherein, the task information includes a set of machine information for which the test environment needs to be deployed, the deployment time, and the test environment information; the set of machine information includes machine information corresponding to each of the multiple machines; The deployment module is used to perform a test environment deployment task for each of the machines based on the machine information set and the test environment information at the deployment time. The second information acquisition module is used to acquire the deployment result information of the test environment deployment task for each of the machines. The first information display module is used to display the deployment result information of the test environment deployment task for each of the machines. The machine information includes the machine identifier and the test environment deployment path; The first information display module includes: The information acquisition unit is used to acquire deployment result information of the test environment deployment task for each machine using Python; wherein, the deployment result information includes deployment task status, deployment log, and machine identifier; The file generation unit is used to render the deployment result information of the test environment deployment task of each machine into a Hypertext Markup Language (HTML) file. A file display unit is used to display the HTML file; The file display unit includes: The information display subunit is used to expand and display the deployment task status and machine identifier of the test environment deployment task for each machine, and to collapse and display the deployment log of the test environment deployment task for each machine. The device further includes: The second information display module is used to expand and display the deployment log of the test environment deployment task of the target machine when a viewing instruction is received for the deployment log of the test environment deployment task of the target machine is received; wherein, the target machine is any one of the machines that need to deploy the test environment.
5. The apparatus according to claim 4, characterized in that, The deployment module is specifically used for: During the deployment time, the test environment deployment task is executed on each machine in parallel or serial manner using Python based on the machine information set and the test environment information.
6. The apparatus according to claim 4, characterized in that, The device further includes: The rollback module is used for the first... i The machine, in the first i If the deployment result of the test environment deployment task on the first machine is a deployment failure, a rollback process is executed using Python to ensure that the first machine's test environment deployment fails. i The machine is reverted to the test environment prior to executing the aforementioned test environment deployment task; wherein... i∈ (1, n), where n is the total number of machines for which the test environment needs to be deployed.
7. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the test environment deployment method as described in any one of claims 1-3.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the test environment deployment method according to any one of claims 1-3.
9. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the test environment deployment method according to any one of claims 1-3.
Citation Information
Patent Citations
Method and apparatus for deploying test environment
CN109144843A
Application environment delivery method and device
CN113485726A