WO2021217868A1 - Git-based project version release method and apparatus, device, and medium - Google Patents

Git-based project version release method and apparatus, device, and medium Download PDF

Info

Publication number
WO2021217868A1
WO2021217868A1 PCT/CN2020/099527 CN2020099527W WO2021217868A1 WO 2021217868 A1 WO2021217868 A1 WO 2021217868A1 CN 2020099527 W CN2020099527 W CN 2020099527W WO 2021217868 A1 WO2021217868 A1 WO 2021217868A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
target server
version
instruction
initial
Prior art date
Application number
PCT/CN2020/099527
Other languages
French (fr)
Chinese (zh)
Inventor
耿铭
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2021217868A1 publication Critical patent/WO2021217868A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/142Reconfiguring to eliminate the error
    • G06F11/143Reconfiguring to eliminate the error with loss of software functionality
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Definitions

  • This application relates to the field of distributed deployment, and in particular to a method, device, computer equipment, and storage medium for project version release based on Git.
  • the code cannot be remotely shared to multiple target servers in the development and testing phases, and testers can only perform testing and verification in the environment of the same configuration file;
  • the project version is deployed online, it is extremely prone to file missed release and entrained release problems, and only the code is deployed when the deployment is online, and the configuration file needs to be manually deployed to each target server; at the same time, when an exception occurs after the deployment is online
  • the operation of rolling back to the historical version is complicated.
  • This application provides a Git-based project version release method, device, computer equipment, and storage medium, which realizes the environment of automatically configuring target servers based on the Git distributed control system, improves efficiency, greatly reduces manual configuration costs, and reduces Operating costs have greatly shortened the release time of the project version.
  • a Git-based project version release method including:
  • the project version creation release instruction is received, and the creation release file package is obtained;
  • the creation release file package includes an initial version number, an initial version file, and an initial deployment job file associated with each other;
  • the initial version file includes an initial code file and an initial configuration File;
  • the initial deployment job file includes a first IP address set and an initial deployment command file;
  • the first pull instruction for the version initial instruction including the initial version number that is fed back by the first target server After receiving the first pull instruction for the version initial instruction including the initial version number that is fed back by the first target server, it is transmitted to the first target server through the Git central warehouse according to the first transmission method
  • the initial version file associated with the initial version number included in the first pull instruction; the first transmission method is to associate with the initial version number included in the first pull instruction
  • the initial version file is directly transmitted to the first target server;
  • the initial deployment command file install the initial version file to the first target server through a non-interactive dialogue with the first target server;
  • a Git-based project version release device including:
  • the receiving module is used to receive the project version creation release instruction and obtain the creation release file package;
  • the creation release file package includes the initial version number, the initial version file, and the initial deployment job file related to each other;
  • the initial version file includes the initial A code file and an initial configuration file;
  • the initial deployment job file includes a first IP address set and an initial deployment command file;
  • the storage module is used to store the initial version file to the Git local warehouse, and at the same time push the initial version file to the Git central warehouse;
  • a sending module configured to send a version initial instruction containing the initial version number to all first target servers that match the first IP address in the first IP address set;
  • the transmission module is configured to, after receiving the first pull instruction for the version initial instruction including the initial version number, fed back by the first target server, to the Git central warehouse according to the first transmission method
  • the first target server transmits the initial version file associated with the initial version number included in the first pull instruction
  • the first transmission method is to combine with the initial version number included in the first pull instruction
  • the initial version file associated with the initial version number is directly transmitted to the first target server;
  • An installation module configured to install the initial version file to the first target server through a non-interactive dialogue with the first target server according to the initial deployment command file;
  • the determining module is configured to determine that the creation and release file package is successfully released after receiving all installation success instructions sent by the first target server that has fed back the first pull instruction.
  • a computer device including a memory, a processor, and a computer program stored in the memory and capable of running on the processor.
  • the processor implements the above-mentioned Git-based project version publishing method when the processor executes the computer program Steps, for example, implement the following steps:
  • the project version creation release instruction is received, and the creation release file package is obtained;
  • the creation release file package includes an initial version number, an initial version file, and an initial deployment job file associated with each other;
  • the initial version file includes an initial code file and an initial configuration File;
  • the initial deployment job file includes a first IP address set and an initial deployment command file;
  • the first pull instruction for the version initial instruction including the initial version number that is fed back by the first target server After receiving the first pull instruction for the version initial instruction including the initial version number that is fed back by the first target server, it is transmitted to the first target server through the Git central warehouse according to the first transmission method
  • the initial version file associated with the initial version number included in the first pull instruction; the first transmission method is to associate with the initial version number included in the first pull instruction
  • the initial version file is directly transmitted to the first target server;
  • the initial deployment command file install the initial version file to the first target server through a non-interactive dialogue with the first target server;
  • a computer-readable storage medium that stores a computer program that, when executed by a processor, implements the steps of the above-mentioned Git-based project version publishing method, for example, the following steps are implemented:
  • the project version creation release instruction is received, and the creation release file package is obtained;
  • the creation release file package includes an initial version number, an initial version file, and an initial deployment job file associated with each other;
  • the initial version file includes an initial code file and an initial configuration File;
  • the initial deployment job file includes a first IP address set and an initial deployment command file;
  • the first pull instruction for the version initial instruction including the initial version number that is fed back by the first target server After receiving the first pull instruction for the version initial instruction including the initial version number that is fed back by the first target server, it is transmitted to the first target server through the Git central warehouse according to the first transmission method
  • the initial version file associated with the initial version number included in the first pull instruction; the first transmission method is to associate with the initial version number included in the first pull instruction
  • the initial version file is directly transmitted to the first target server;
  • the initial deployment command file install the initial version file to the first target server through a non-interactive dialogue with the first target server;
  • This application realizes the environment of automatically configuring the target server based on the Git distributed control system, improves efficiency, greatly reduces manual configuration costs, reduces operating costs, and greatly shortens the project version release time.
  • FIG. 1 is a schematic diagram of the application environment of the Git-based project version release method in an embodiment of the present application
  • Figure 2 is a flowchart of a Git-based project version release method in an embodiment of the present application
  • FIG. 3 is a flowchart of step S60 of the Git-based project version publishing method in an embodiment of the present application
  • FIG. 4 is a flowchart of step S120 of the Git-based project version publishing method in an embodiment of the present application
  • FIG. 5 is a flowchart of step S40 of the Git-based project version publishing method in an embodiment of the present application
  • FIG. 6 is a flowchart of step S100 of the Git-based project version publishing method in an embodiment of the present application
  • FIG. 7 is a flowchart of step S110 of the Git-based project version publishing method in an embodiment of the present application.
  • Figure 8 is a functional block diagram of a Git-based project version publishing device in an embodiment of the present application.
  • FIG. 9 is a functional block diagram of the determining module 16 in the Git-based project version publishing device in an embodiment of the present application.
  • Fig. 10 is a schematic diagram of a computer device in an embodiment of the present application.
  • the technical solution of this application can be applied to the field of artificial intelligence or big data.
  • the involved data can be stored in a database, or can be distributed storage through a blockchain, which is not limited by this application.
  • the Git-based project version release method provided by this application can be applied in the application environment as shown in Figure 1, where the client (computer equipment) communicates with the server through the network.
  • the client includes, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, cameras, and portable wearable devices.
  • the server can be implemented as an independent server or a server cluster composed of multiple servers.
  • a Git-based project version release method is provided, and the technical solution mainly includes the following steps S10-S60:
  • a project version creation release instruction is received, and a creation release file package is obtained;
  • the creation release file package includes an initial version number, an initial version file, and an initial deployment job file that are related to each other;
  • the initial version file includes an initial code file and Initial configuration file;
  • the initial deployment job file includes the first IP address set and the initial deployment command file.
  • the application scenario of this application can be an operation on a webpage or an application.
  • the user uploads relevant files according to the requirements of the webpage template, that is, according to the set The order of the web page template requires that the relevant files be uploaded in sequence.
  • the application web interface refers to the interface that implements application operations through the web; after receiving all the documents related to the project version that have been determined, the project version creation and release instruction is triggered, so
  • the project version is the version corresponding to the project that needs to be released, so that all files related to the project version are merged according to the preset initial template, that is, all files related to the project version are processed in accordance with the requirements of the initial template Splitting and merging
  • the initial template refers to the template corresponding to the first release project, and is compressed according to preset initial compression parameters to generate the creation and release package.
  • the initial compression parameters can be set according to requirements, such as The initial compression parameter is a parameter converted into rar format, or the initial compression parameter is a parameter converted into zip format, etc., and the compressed creation and release file package is uploaded to a cloud server; After receiving the creation and release package, decompress the creation and release package to obtain the initial version number contained in the creation and release package and the initial version file associated with the initial version number And the initial deployment job file associated with the initial version number, in this way, by compressing the creation and release file package and uploading it to the cloud server, and then decompressing it to obtain the creation and release file package, a plurality of compressed all files can be received through the cloud server. Said creating and publishing file packages, transferring and backing up a plurality of compressed creating and publishing file packages, can avoid the risk of loss in the process of obtaining a plurality of creating and publishing file packages.
  • the initial version file includes the initial code file and the initial configuration file
  • the initial code file is the source code file of the initial version of the project
  • the initial configuration file is the configuration required to run the initial code file.
  • Files related to the operating environment the initial deployment job file includes the first IP address set and the initial deployment command file
  • the first IP address set is all target servers to which the initial version file needs to be released A collection of corresponding IP addresses.
  • S20 Store the initial version file in the Git local warehouse, and at the same time push the initial version file to the Git central warehouse.
  • the Git local warehouse is a storage warehouse set based on the Git distributed control system
  • the Git distributed control system is a system based on Git that includes a Git local warehouse and a Git central warehouse.
  • the Git local The warehouse can accept and store project version files and version records uploaded or updated by users.
  • the Git central warehouse is a temporary warehouse set based on the Git distributed control system, and the Git central warehouse receives the Git local warehouse. The initial version file pushed over and temporarily stored.
  • S30 Send a version initial instruction containing the initial version number to all first target servers that match the first IP address in the first IP address set.
  • the first target server is a target server consistent with the first IP address, and the first IP address is an element in the first IP address set, and sends to all the first target servers
  • the version initial instruction is an instruction for issuing an initial version file
  • the version initial instruction can be set according to requirements, for example, the version initial instruction is generated according to the initial instruction template provided by the Docker container management tool, etc.
  • the version initial instruction includes the initial version number.
  • the Git central warehouse After receiving the first pull instruction that includes the initial version number fed back by the first target server for the initial instruction of the version, the Git central warehouse sends the first pull instruction to the first target according to the first transmission method.
  • the server transmits the initial version file associated with the initial version number included in the first pull instruction; the first transmission method is to be related to the initial version number included in the first pull instruction
  • the associated initial version file is directly transmitted to the first target server.
  • the first target server performs a check inside the first target server for the version initial instruction.
  • the first target server feeds back the first pull instruction, indicating that the first target server needs to pull the initial version file, and the first transmission method is to push the file directly To the first target server, the initial version file is transmitted to the first target server according to the first transmission mode through the Git central warehouse.
  • the Git central warehouse is used to transmit to the first target server according to the first transmission mode.
  • the included initial version file associated with the initial version number includes:
  • S401 Transmit the initial version file to the first target server through the Git central warehouse.
  • the transmission method can be set according to requirements.
  • the Git central warehouse is connected to the first target server through SSH (Secure Shell), and the first target server is sent to the first target server after the connection.
  • the target server transmits the initial version file, and the SSH mode is to generate a public key and a private key based on an asymmetric encryption method through the SSH protocol, and establish a communication connection through password authentication or public key authentication to ensure the security and integrity of information interaction.
  • S402 Receive a creation success instruction fed back after the first target server creates the local Git file associated with the initial version number.
  • the initial version file is transmitted to the first target server through the Git central warehouse, and after receiving the initial version file, the first target server creates a local file associated with the initial version number locally.
  • a Git file marking that the first target server contains a file related to the initial version number, and feeding back the creation success instruction at the same time.
  • the initial deployment command file is a collection of guidance command instructions corresponding to the process instructions fed back by the first target server during the deployment process in all the execution deployment processes
  • the non-interactive dialogue mode requires no manual operation. Perform an interactive dialogue with the target server to execute command instructions, directly and automatically execute the corresponding command instructions according to the corresponding relationship of one question and one answer, and install the initial version file to the first target server through a non-interactive dialogue mode, so, There is no need to manually configure the first target server manually, and the initial configuration file and the initial code file are automatically installed.
  • the first target server that has fed back the first pull instruction triggers the installation success instruction after the installation of the initial configuration file and the initial code file is completed, and all the first pull instructions that have been fed back are received After the installation success instruction fed back by the first target server of the instruction, it is confirmed that the creation and release file package is successfully released.
  • This application obtains the creation and release package by receiving the project version creation release instruction; the creation release package includes the initial version number, the initial version file, and the initial deployment job file that are related to each other; the initial version file includes the initial code file And the initial configuration file; the initial deployment job file contains the first IP address set and the initial deployment command file; the initial version file is stored in the Git local warehouse, and the initial version file is pushed to the Git central warehouse at the same time; All the first target servers that match the first IP address in the first IP address set send the initial version instruction containing the initial version number; the first target server receives the inclusion of the initial version instruction feedback After the first pull instruction of the initial version number, the Git central warehouse transmits the association with the initial version number contained in the first pull instruction to the first target server according to the first transmission method The initial version file; the first transmission method is to directly transmit the initial version file associated with the initial version number contained in the first pull instruction to the first target server; The initial deployment command file, install the initial version file to the first target server through a non-interactive
  • this application realizes that by obtaining the creation and release package, the initial version file in the creation and release package is stored in the Git local warehouse, and at the same time, it is pushed to the Git central warehouse, and the initial version is sent to all the first target servers.
  • the Git central warehouse After receiving the first pull instruction feedback from the first target server for the initial instruction of the version, the Git central warehouse transmits the data to the first target server according to the first transmission method.
  • the initial deployment command file during the deployment process, the initial file is installed to the first target server through a non-interactive dialogue mode, and all the first pull instructions that have been fed back to the first target server are received.
  • the method includes:
  • the project version update release instruction is received, and the update release file package is obtained;
  • the update release file package includes an associated update version number, a branch version file, and an update deployment file;
  • the branch version file includes an update code file and an update Configuration file;
  • the update deployment file contains the second IP address set and the update deployment command file.
  • the user uploads related files that need to be updated according to the requirements of the web template, that is, according to the order of the set web template Upload related files to be updated in sequence; after receiving all files related to the project update version that have been determined, trigger the project version update release instruction, and the project update version is the version corresponding to the update and upgrade of the released project , So that all files related to the updated version of the project are merged according to the preset update template, that is, all files related to the updated version of the project are split and merged according to the requirements of the updated template.
  • the update compression parameters can be set according to requirements, such as the update compression parameters It is a parameter converted into rar format, or the updated compression parameter is a parameter converted into zip format, etc., wherein the updated compression parameter and the initial compression parameter may be consistent or inconsistent, and all compressed parameters
  • the update release file package is uploaded to the cloud server; after the update release file package is received through the cloud server, the update release file package is decompressed, so as to obtain the update release file package.
  • the update version number, the branch version file associated with the update version number, and the update deployment file associated with the update version number are compressed and uploaded to the cloud server by compressing the update release file package, and then decompressing the file to obtain
  • the update release file package can receive multiple compressed update release file packages through a cloud server, and transfer and back up multiple compressed update release file packages, which can avoid obtaining multiple update release file packages. Risk of loss in the process.
  • the branch version file includes the update code file and the update configuration file
  • the update code file is a source code file corresponding to the project update version
  • the update configuration file is used to run the update code file.
  • Files related to the operating environment that need to be configured the update deployment job file includes the second IP address set and the update deployment command file, and the second IP address set is for all files that need to be released to the branch version The set of IP addresses corresponding to the target server.
  • S80 Store the branch version file in the Git local warehouse, and at the same time push the branch version file to the Git central warehouse.
  • the Git local warehouse is a storage warehouse set based on the Git distributed control system
  • the Git distributed control system is a system based on Git that includes a Git local warehouse and a Git central warehouse.
  • the Git local The warehouse can accept and store project version files and version records uploaded or updated by users.
  • the Git central warehouse is a temporary warehouse set based on the Git distributed control system, and the Git central warehouse receives the Git local warehouse. The branch version file pushed over and temporarily stored.
  • S90 Send a version update instruction containing the branch version number to all second target servers that match the second IP address in the second IP address set.
  • the second target server is a target server consistent with the second IP address, and the second IP address is an element in the second IP address set, and sends to all the second target servers
  • the version update instruction is an instruction for publishing a branch version file
  • the version update instruction can be set according to requirements, such as generating a version update instruction according to an update instruction template provided by a Docker container management tool, etc.
  • the version update instruction includes the update version number, and there may be a first IP address that is the same as the second IP address in the second IP address set, or there may be a first IP address that is the same as the first IP address in the first IP address set. A second IP address that is not the same as the first IP address.
  • the Git central warehouse After receiving the second pull instruction that includes the branch version number fed back by the second target server for the version update instruction, the Git central warehouse uses the second transmission method to send the second pull instruction to the second target.
  • the server transmits the difference file corresponding to the second target server; the second transmission method is to determine the difference file with the second target server according to the local Git file associated with the branch version number in the second pull instruction Corresponding difference files, and transmitting the difference files corresponding to the second target server to the second target server.
  • the second target server detects the version update instruction inside the second target server, and the second target server feeds back In the second pull instruction, the second transmission method is based on the local Git file associated with the branch version number in the second pull instruction, and the local Git file associated with the branch version number is stored
  • the file recorded in the Git folder directory format that reflects the association relationship between the folders in the second target server is determined, and the difference file corresponding to the second target server is determined and compared with the second target server.
  • the corresponding difference file is transmitted to the second target server, that is, when the second target server detects that it does not contain any local Git file associated with the branch version number, it will feedback that there is no local Git file associated with the branch version number.
  • the second target server needs to pull the entire branch version file according to the second pull instruction, so that the branch version file is sent to the second target server;
  • the second target server detects that it locally contains the local Git file associated with the branch version number and the local Git file associated with the branch version number, that is, the branch version is determined by the degree of matching with the branch version number
  • the local Git file associated with the branch version number, the second pull instruction containing the local Git file associated with the branch version number is fed back, and the received local Git file associated with the branch version number is combined with the branch version
  • the files are compared, and the difference file after comparing the local Git file associated with the branch version number with the branch version file is obtained, so as to determine the difference file corresponding to the second target server.
  • the second target The difference file corresponding to the server includes a code difference file and a configuration difference file.
  • the code difference file is between the code file in the local Git file associated with the branch version number and the updated code file in the branch version file
  • the configuration difference file is the file of the difference content between the configuration file in the local Git file associated with the branch version number and the updated configuration file in the branch version file.
  • the difference file corresponding to the second target server is transmitted to the second target server.
  • step S100 that is, after the second pull instruction that includes the branch version number fed back by the second target server for the version update instruction is received , Transmitting the difference file corresponding to the second target server to the second target server according to the second transmission mode through the Git central warehouse, including:
  • the second target server locally searches for the relevant local Git file matching the branch version number according to the branch version number, and determines the second pull instruction according to the query result, that is, in the The second target server detects that it does not contain any local Git file associated with the branch version number, and then feeds back that there is no second pull instruction for the local Git file associated with the branch version number; check on the second target server When the local Git file associated with the branch version number is contained locally, the second pull instruction containing the local Git file associated with the branch version number is fed back.
  • the Git tool is a comparison tool for Git files in the Git central warehouse.
  • the branch version file is converted into a Git file corresponding to the branch version file, and the local The Git file and the Git file corresponding to the branch version file are input into the Git tool for comparison, and the difference file corresponding to the second target server is obtained.
  • the difference file is the local Git file and the Files with different content between the Git files corresponding to the branch version files.
  • the difference file is transmitted to the second target server through the Git central warehouse, and after that, the second target server updates the received difference file to the original version number.
  • the associated local Git file that is, the difference file with the same name as the local Git file associated with the initial version number in the difference file overwrites the local Git file, and the difference file is compared with the initial version
  • the difference file with different names of the local Git file associated with the number is directly stored in the storage path of the local Git file associated with the initial version number, and the update success instruction is fed back after the update of the second target server is completed.
  • the update success instruction refers to an instruction triggered after the second target server completes the update of the difference file.
  • the present application can reduce the transmission content, improve the transmission efficiency, and reduce the risk of information loss by transmitting the different file content based on the Git distributed control system.
  • the update deployment command file is a collection of update guidance command instructions corresponding to the update process instructions fed back by the second target server during the update deployment process in the update deployment process.
  • the non-interactive dialogue The method is that there is no need for manual interactive dialogue with the target server to execute the command instructions, and the corresponding command instructions are directly executed automatically according to the corresponding relationship of one question and one answer, and the branch version file is installed to the second target through a non-interactive dialogue mode.
  • the server in this way, does not need to manually configure the second target server manually, and realizes the automatic installation and update of the configuration file and the update of the code file.
  • the received branch version is exchanged with the second target server in a non-interactive dialogue manner.
  • the file update to the second target server includes:
  • S1101 Receive a transmission completion instruction issued by the second target server after the branch version file is completed, and send a stop instruction and a deployment instruction in the update deployment command file to the second target server.
  • the second target server triggers the transfer completion instruction after confirming that the branch version file is received, and after receiving the transfer completion instruction, sends the stop instruction and the stop instruction to the second target server in sequence.
  • the deployment instruction, the stop instruction is an instruction in the update deployment command file to stop running the local Git file associated with the initial version number in the second target server, and the deployment instruction is the update
  • the deployment command file executes instructions related to the deployment operation of the branch version file in the second target server.
  • the abnormal instruction corresponding to the abnormal situation is fed back, such as
  • the abnormal instruction is an instruction corresponding to the downtime.
  • search for a repair instruction matching the abnormal instruction from the update deployment command file and send the repair instruction to the second
  • the repair instruction is an instruction to restart the server corresponding to the solution of the downtime, etc.
  • the update process refers to the process of executing the stop instruction and the deployment instruction until the second target server feedback is received
  • the completion instruction is an instruction triggered after the second target server completes the update process.
  • S1103 Upon receiving the completion instruction fed back after the second target server completes all the deployment instructions, send the start instruction in the update deployment command file to the second target server, and confirm that the branch version file is updated To the second target server.
  • the start instruction is sent to the second target server, and the start instruction is in the update deployment command file and the start The instruction related to the branch version file determines that the branch version file has been updated to the second target server.
  • the present application completes the non-interactive dialogue with the second target server.
  • the second target server does not need to be manually configured in the deployment process, so that the update code in the branch version file is automatically updated.
  • Documents and update configuration files greatly reduce manual operations, improve the efficiency of project version release, and reduce operating costs.
  • the second target server that has fed back the second pull instruction triggers the update success instruction after completing the installation of the branch version file, and receives all the second pull instructions that have fed back the second pull instruction. After the update success instruction fed back by the second target server, it is confirmed that the update release file package is successfully released.
  • this application realizes that by obtaining the update release file package, the branch version file in the update release file package is stored in the Git local warehouse, and at the same time, it is pushed to the Git central warehouse, and the updated version is sent to all second target servers. After receiving the second pull instruction fed back by the second target server, the updated version file is transmitted to the second target server according to the second transmission method through the Git central warehouse.
  • the update file is installed to the second target server in a non-interactive dialogue mode, and all updates sent by the second target server that have fed back the second pull instruction are received After the successful instruction, it is determined that the update release file package is successfully released, and the Git distributed control system is based on the second transmission method to release the update code file and the update configuration file.
  • the transmission is completed through non-interactive dialogue.
  • the update code file and update configuration file of each target server are automatically updated, so as to automatically configure the environment corresponding to the updated version number of the target server, improve efficiency, reduce operating costs, and greatly shorten the project version release time.
  • the method includes:
  • a project version rollback release instruction is received, and a rollback release file package is obtained; the rollback release file package includes a rollback version number and a rollback deployment job file; the rollback deployment job file includes a third IP address Collect and roll back deployment command files.
  • the update release file package is successfully released, it is found that there is an abnormality in the operation process, and it needs to be rolled back to a certain version number in the history, or according to the demand, it needs to be rolled back to a certain version number in the history.
  • select the rollback version number from all the historical version numbers and the rollback version number is the initial version number and all historical update version numbers (that is, except for the current update version number).
  • the rollback deployment job file contains the third IP address set and the rollback deployment command file, and the third IP address set can be as needed Setting is performed, for example, the third IP address set is the same as the second IP address set.
  • S140 Query and obtain a version file associated with a version number consistent with the rollback version number from the local Git warehouse.
  • the Git local warehouse stores version numbers of all project versions and version files associated with the version numbers, where the version numbers include the initial version number and at least one of the updated version numbers, and the version files include The initial version file and at least one of the updated version files, the version number is associated with the version file one by one, that is, the initial version number is associated with the initial version file, and the updated version number is associated with the update Version file association.
  • S160 Send a version rollback instruction containing the rollback version number to all third target servers that match the third IP address in the third IP address set.
  • the third target server is a target server that is consistent with the third IP address
  • the third IP address is an element in the third IP address set, which is sent to all third target servers
  • the version rollback instruction, the version rollback instruction is an instruction for the second target server that has been released to roll back to the historical project version
  • the initial version instruction can be set according to requirements, for example, according to The rollback instruction template provided by the Docker container management tool generates a version rollback instruction, etc.
  • the version initial instruction includes the rollback version number
  • the third IP address set may be the same as the second IP address set.
  • the Git central warehouse After receiving the third pull instruction that includes the rollback version number that is fed back by the third target server for the version rollback instruction, the Git central warehouse sends the third transmission method to the The third target server transmits the difference file corresponding to the third target server; the third transmission method is also based on the local Git file associated with the rollback version number in the third pull instruction to determine the The difference file corresponding to the third target server is transmitted, and the difference file corresponding to the third target server is transmitted to the third target server.
  • the third target server detects the version rollback instruction inside the third target server, and the third target server
  • the third pull instruction is fed back, and the third transmission method is based on the local Git file associated with the rollback version number in the third pull instruction, and the local Git file associated with the rollback version number Git files are files stored in the third target server and recorded in the Git folder directory format that reflects the association relationship between folders.
  • the difference file corresponding to the third target server is determined, and the difference file is compared with the third target server.
  • the difference file corresponding to the third target server is transmitted to the third target server, that is, when the third target server detects that it does not contain any local Git file associated with the rollback version number, the feedback is not related to the rollback version number.
  • Roll the third pull instruction of the local Git file associated with the version number and determine according to the third pull instruction that the third target server needs to pull the entire version file associated with the version number that is consistent with the rollback version number, thereby
  • the version file associated with the version number consistent with the rollback version number is sent to the third target server; the third target server detects that the local Git file associated with the rollback version number locally contains the local Git file associated with the rollback version number, that is, through The degree of matching with the branch version number determines the local Git file associated with the rollback version number, and then the third pull instruction containing the local Git file is fed back, and the received version is the same as the rollback version number.
  • the associated local Git file is compared with the obtained version file, and the difference file between the local Git file associated with the rollback version number and the obtained version file is obtained, and the difference file is determined to be the third The difference file corresponding to the target server, and the difference file corresponding to the third target server.
  • the rollback deployment command file is a collection of all rollback guidance command instructions corresponding to the rollback process instructions fed back by the third target server during the rollback deployment process in the rollback deployment process, so
  • the non-interactive dialogue mode is to execute the command instruction without manual interactive dialogue with the target server, and directly and automatically execute the corresponding command instruction according to the corresponding relationship of one question and one answer, and the version number will be rolled back through the non-interactive dialogue mode.
  • the version file associated with the consistent version number is installed to the third target server, so that there is no need to manually configure the third target server manually, and the version associated with the version number consistent with the rollback version number is automatically installed. document.
  • the rollback success instruction is triggered, and all the completed rollback instructions are received. After the rollback success instruction fed back by the third target server that feeds back the third pull instruction, it is confirmed that the rollback release file package is successfully released.
  • this application realizes that the version file is queried and obtained from the Git local warehouse by obtaining the rollback version number.
  • the version file associated with the rollback version number is released through the third transmission method, and the rollback deployment file is passed Complete the automatic rollback of version files transferred to multiple target servers in a non-interactive dialog mode, so as to automatically configure the target server and the environment corresponding to the rollback version number, and quickly roll back in the case of abnormalities after the project version is released To the historical version, reducing operating costs.
  • a Git-based project version publishing device is provided, and the Git-based project version publishing device corresponds to the Git-based project version publishing method in the foregoing embodiment in a one-to-one correspondence.
  • the Git-based project version release device includes a receiving module 11, a storage module 12, a sending module 13, a transmission module 14, an installation module 15 and a determination module 16. The detailed description of each functional module is as follows:
  • the receiving module 11 is configured to receive a project version creation and release instruction, and obtain a creation and release file package;
  • the creation and release file package includes an initial version number, an initial version file, and an initial deployment job file associated with each other;
  • the initial version file includes An initial code file and an initial configuration file;
  • the initial deployment job file includes a first IP address set and an initial deployment command file;
  • the storage module 12 is used to store the initial version file in the Git local warehouse, and at the same time push the initial version file to the Git central warehouse;
  • the sending module 13 is configured to send a version initial instruction containing the initial version number to all first target servers that match the first IP address in the first IP address set;
  • the transmission module 14 is configured to, after receiving the first pull instruction that includes the initial version number fed back by the first target server for the initial instruction of the version, send it to the office in accordance with the first transmission method through the Git central warehouse.
  • the first target server transmits the initial version file associated with the initial version number included in the first pull instruction;
  • the first transmission method is to communicate with all the files included in the first pull instruction Directly transmitting the initial version file associated with the initial version number to the first target server;
  • the installation module 15 is configured to install the initial version file to the first target server through a non-interactive dialogue with the first target server according to the initial deployment command file;
  • the determining module 16 is configured to determine that the creation and release file package is successfully released after receiving all installation success instructions sent by the first target server that has fed back the first pull instruction.
  • the determining module 16 includes:
  • the receiving unit 61 is configured to receive the project version update release instruction and obtain the update release file package; the update release file package includes the associated update version number, the branch version file, and the update deployment file; the branch version file includes the update A code file and an update configuration file; the update deployment file includes a second IP address set and an update deployment command file;
  • the storage unit 62 is configured to store the branch version file to the Git local warehouse, and at the same time push the branch version file to the Git central warehouse;
  • the sending unit 63 is configured to send a version update instruction containing the branch version number to all second target servers that match the second IP address in the second IP address set;
  • the transmission unit 64 is configured to, after receiving the second pull instruction containing the branch version number that is fed back by the second target server for the version update instruction, to the Git central warehouse according to the second transmission method.
  • the second target server transmits the difference file corresponding to the second target server;
  • the second transmission method is to determine the difference file corresponding to the branch version number according to the local Git file associated with the branch version number in the second pull instruction A difference file corresponding to the second target server, and transmitting the difference file corresponding to the second target server to the second target server;
  • the update unit 65 is configured to update the received branch version file to the second target server through a non-interactive dialogue with the second target server according to the update deployment command file;
  • the determining unit 66 is configured to determine that the update release file package is successfully released after receiving all the update success instructions sent by the second target server that has fed back the second pull instruction.
  • the determining unit 66 includes:
  • the first receiving subunit is configured to receive the project version rollback release instruction and obtain the rollback release file package;
  • the rollback release file package includes the rollback version number and the rollback deployment job file;
  • the rollback deployment job The file contains the third IP address set and the rollback deployment command file;
  • the query subunit is used to query and obtain the version file associated with the version number consistent with the rollback version number from the Git local warehouse;
  • a sending subunit configured to send a version rollback instruction containing the rollback version number to all third target servers that match the third IP address in the third IP address set;
  • the first transmission subunit is configured to receive the third pull instruction containing the rollback version number that is fed back by the third target server for the version rollback instruction, and then use the Git central warehouse to follow the first
  • the third transmission mode transmits the difference file corresponding to the third target server to the third target server; the third transmission mode is also based on the local version associated with the rollback version number in the third pull instruction. Git file, determining a difference file corresponding to the third target server, and transmitting the difference file corresponding to the third target server to the third target server;
  • a rollback subunit configured to roll back the version file to the third target server through a non-interactive dialogue with the third target server according to the rollback deployment command file;
  • the determining subunit is configured to determine that the rollback release file package is successfully released after receiving all the rollback success instructions sent by the third target server that has fed back the third pull instruction.
  • the transmission module 14 includes:
  • a transmitting unit configured to transmit the initial version file to the first target server through the Git central warehouse
  • the feedback unit is configured to receive a creation success instruction fed back after the first target server creates the local Git file associated with the initial version number.
  • the transmission unit 64 includes:
  • a second receiving subunit configured to receive the second pull instruction sent after the second target server determines the local Git file related to the branch version according to the branch version number;
  • the comparison subunit is used to compare the local Git file with the branch version file through the Git tool in the Git central warehouse to obtain a difference file corresponding to the second target server;
  • the second transmission subunit is used to update the initial version number association after receiving the second target server after transmitting the difference file corresponding to the second target server to the second target server through the Git central warehouse After the local Git file, the update success instruction is fed back.
  • the update unit 65 includes:
  • the third receiving subunit is configured to receive the transmission completion instruction issued by the second target server after the branch version file is completed, and send the stop instruction and the deployment instruction in the update deployment command file to the second target server;
  • the execution update subunit is configured to, upon receiving the abnormal instruction fed back by the second target server during the execution of the stop instruction and the deployment instruction, search for a match with the abnormal instruction from the update deployment command file And send the repair instruction to the second target server to complete the update process until the completion instruction fed back by the second target server is received;
  • the update completion subunit is configured to send the start instruction in the update deployment command file to the second target server when receiving the completion instruction fed back after the second target server completes all the deployment instructions, and confirm all The branch version file is updated to the second target server.
  • Each module in the Git-based project version release device can be implemented in whole or in part by software, hardware, and a combination thereof.
  • the above-mentioned modules may be embedded in the form of hardware or independent of the processor in the computer equipment, or may be stored in the memory of the computer equipment in the form of software, so that the processor can call and execute the operations corresponding to the above-mentioned modules.
  • a computer device is provided.
  • the computer device may be a server, and its internal structure diagram may be as shown in FIG. 10.
  • the computer equipment includes a processor, a memory, a network interface, and a database connected through a system bus.
  • the processor of the computer device is used to provide calculation and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system, a computer program, and a database.
  • the internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium.
  • the network interface of the computer device is used to communicate with an external terminal through a network connection.
  • the computer program is executed by the processor to implement a Git-based project version release method.
  • a computer device including a memory, a processor, and a computer program stored in the memory and capable of running on the processor.
  • the processor executes the computer program, the Git-based project version in the above-mentioned embodiment is implemented. Publishing method.
  • a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the Git-based project version publishing method in the foregoing embodiment is implemented.
  • the storage medium involved in this application such as a computer-readable storage medium, may be non-volatile or volatile.
  • Non-volatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • Volatile memory may include random access memory (RAM) or external cache memory.
  • RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Channel (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

Abstract

A Git-based project version release method and apparatus, a device, and a medium. The method comprises: upon receiving a project version creation release instruction, obtaining a creation release file package, wherein the creation release file package comprises an initial version number, an initial version file, and an initial deployment operation file associated with each other; storing the initial version file to a Git local repository and pushing same to a Git central repository; sending to first target servers a version initial instruction comprising the initial version number; upon receiving a first pulling instruction of the first target servers, transmitting the initial version file to the first target servers by means of the Git central repository according to a first transmission mode; installing the initial version file to the first target servers according to an initial deployment command file; and upon receiving all installation success instructions, determining that the creation release file package is successfully released. The method implements the automatic configuration of an environment of a target server on the basis of a Git distributed control system, improves efficiency, and reduces costs.

Description

基于Git的项目版本发布方法、装置、设备及介质Git-based project version release method, device, equipment and medium
本申请要求于2020年4月30日提交中国专利局、申请号为202010366362.8,发明名称为“基于Git的项目版本发布方法、装置、设备及介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on April 30, 2020, the application number is 202010366362.8, and the invention title is "Git-based project version release method, device, equipment, and medium". The entire content is approved The reference is incorporated in this application.
技术领域Technical field
本申请涉及分布式部署领域,尤其涉及一种基于Git的项目版本发布方法、装置、计算机设备及存储介质。This application relates to the field of distributed deployment, and in particular to a method, device, computer equipment, and storage medium for project version release based on Git.
背景技术Background technique
目前,在项目开发领域,从项目测试到项目上线,项目开发人员或者项目委托方会针对项目提出不同的需求,因此,往往会出现多个项目版本,发明人意识到,在现有技术中,通常基于svn(subversion,是一个开放源代码的版本控制系统)单一主干集中式的发布系统,以如下方式实现对多个项目版本的管理:所有开发人员在一个svn仓库的相同主干上进行开发,测试人员在同一个测试环境进行测试验证,最终手动将所修改的文件增量部署上线。发明人发现,现有技术方案的不足之处在于:首先,开发和测试阶段无法实现代码远程共享至多台目标服务器,且测试人员只能在同一个配置文件的环境下进行测试验证;其次,在将项目版本部署上线时,极容易出现文件漏发布和夹带发布问题,并且部署上线时只有代码进行了部署,而配置文件则需要人工对每台目标服务器进行部署;同时,部署上线后出现异常时回滚至历史版本的操作复杂。At present, in the field of project development, from project testing to project launch, project developers or project commissioners will put forward different requirements for the project. Therefore, there are often multiple project versions. The inventor realized that in the existing technology, Usually based on svn (subversion, an open source version control system) single backbone centralized release system, the management of multiple project versions is realized in the following way: all developers develop on the same backbone of a svn warehouse, Testers conduct test verification in the same test environment, and finally manually deploy the modified files on the line incrementally. The inventor found that the shortcomings of the existing technical solutions are: first, the code cannot be remotely shared to multiple target servers in the development and testing phases, and testers can only perform testing and verification in the environment of the same configuration file; When the project version is deployed online, it is extremely prone to file missed release and entrained release problems, and only the code is deployed when the deployment is online, and the configuration file needs to be manually deployed to each target server; at the same time, when an exception occurs after the deployment is online The operation of rolling back to the historical version is complicated.
发明内容Summary of the invention
本申请提供一种基于Git的项目版本发布方法、装置、计算机设备及存储介质,实现了基于Git分布式控制系统自动配置目标服务器的环境,提高了效率,大大较少了人工配置成本,减少了运营成本,极大缩短了项目版本发布时间。This application provides a Git-based project version release method, device, computer equipment, and storage medium, which realizes the environment of automatically configuring target servers based on the Git distributed control system, improves efficiency, greatly reduces manual configuration costs, and reduces Operating costs have greatly shortened the release time of the project version.
一种基于Git的项目版本发布方法,包括:A Git-based project version release method, including:
接收到项目版本创建发布指令,获取创建发布文件包;所述创建发布文件包中包括相互关联的初始版本号、初始版本文件和初始部署作业文件;所述初始版本文件包括初始代码文件和初始配置文件;所述初始部署作业文件中包含第一IP地址集合和初始部署命令文件;The project version creation release instruction is received, and the creation release file package is obtained; the creation release file package includes an initial version number, an initial version file, and an initial deployment job file associated with each other; the initial version file includes an initial code file and an initial configuration File; the initial deployment job file includes a first IP address set and an initial deployment command file;
将所述初始版本文件存储至Git本地仓库,同时将所述初始版本文件推送至Git中央仓库;Store the initial version file in the Git local warehouse, and push the initial version file to the Git central warehouse at the same time;
向所有与所述第一IP地址集合中的第一IP地址匹配的第一目标服务器发送含有所述初始版本号的版本初始指令;Sending a version initial instruction containing the initial version number to all first target servers that match the first IP address in the first IP address set;
接收到所述第一目标服务器反馈的针对所述版本初始指令包含所述初始版本号的第一拉取指令之后,通过所述Git中央仓库,按照第一传输方式向所述第一目标服务器传输与所述第一拉取指令中包含的所述初始版本号关联的所述初始版本文件;所述第一传输方式为将与所述第一拉取指令中包含的所述初始版本号关联的所述初始版本文件直接传输至所述第一目标服务器;After receiving the first pull instruction for the version initial instruction including the initial version number that is fed back by the first target server, it is transmitted to the first target server through the Git central warehouse according to the first transmission method The initial version file associated with the initial version number included in the first pull instruction; the first transmission method is to associate with the initial version number included in the first pull instruction The initial version file is directly transmitted to the first target server;
根据所述初始部署命令文件,与所述第一目标服务器通过非交互式对话方式将所述初始版本文件安装至所述第一目标服务器;According to the initial deployment command file, install the initial version file to the first target server through a non-interactive dialogue with the first target server;
接收到所有已反馈所述第一拉取指令的所述第一目标服务器发送的安装成功指令之后,确定所述创建发布文件包发布成功。After receiving all installation success instructions sent by the first target server that has fed back the first pull instruction, it is determined that the creation and release file package is successfully released.
一种基于Git的项目版本发布装置,包括:A Git-based project version release device, including:
接收模块,用于接收到项目版本创建发布指令,获取创建发布文件包;所述创建发布文件包中包括相互关联的初始版本号、初始版本文件和初始部署作业文件;所述初始版本文件包括初始代码文件和初始配置文件;所述初始部署作业文件中包含第一IP地址集合和 初始部署命令文件;The receiving module is used to receive the project version creation release instruction and obtain the creation release file package; the creation release file package includes the initial version number, the initial version file, and the initial deployment job file related to each other; the initial version file includes the initial A code file and an initial configuration file; the initial deployment job file includes a first IP address set and an initial deployment command file;
存储模块,用于将所述初始版本文件存储至Git本地仓库,同时将所述初始版本文件推送至Git中央仓库;The storage module is used to store the initial version file to the Git local warehouse, and at the same time push the initial version file to the Git central warehouse;
发送模块,用于向所有与所述第一IP地址集合中的第一IP地址匹配的第一目标服务器发送含有所述初始版本号的版本初始指令;A sending module, configured to send a version initial instruction containing the initial version number to all first target servers that match the first IP address in the first IP address set;
传输模块,用于接收到所述第一目标服务器反馈的针对所述版本初始指令包含所述初始版本号的第一拉取指令之后,通过所述Git中央仓库,按照第一传输方式向所述第一目标服务器传输与所述第一拉取指令中包含的所述初始版本号关联的所述初始版本文件;所述第一传输方式为将与所述第一拉取指令中包含的所述初始版本号关联的所述初始版本文件直接传输至所述第一目标服务器;The transmission module is configured to, after receiving the first pull instruction for the version initial instruction including the initial version number, fed back by the first target server, to the Git central warehouse according to the first transmission method The first target server transmits the initial version file associated with the initial version number included in the first pull instruction; the first transmission method is to combine with the initial version number included in the first pull instruction The initial version file associated with the initial version number is directly transmitted to the first target server;
安装模块,用于根据所述初始部署命令文件,与所述第一目标服务器通过非交互式对话方式将所述初始版本文件安装至所述第一目标服务器;An installation module, configured to install the initial version file to the first target server through a non-interactive dialogue with the first target server according to the initial deployment command file;
确定模块,用于接收到所有已反馈所述第一拉取指令的所述第一目标服务器发送的安装成功指令之后,确定所述创建发布文件包发布成功。The determining module is configured to determine that the creation and release file package is successfully released after receiving all installation success instructions sent by the first target server that has fed back the first pull instruction.
一种计算机设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现上述基于Git的项目版本发布方法的步骤,例如,实现以下步骤:A computer device including a memory, a processor, and a computer program stored in the memory and capable of running on the processor. The processor implements the above-mentioned Git-based project version publishing method when the processor executes the computer program Steps, for example, implement the following steps:
接收到项目版本创建发布指令,获取创建发布文件包;所述创建发布文件包中包括相互关联的初始版本号、初始版本文件和初始部署作业文件;所述初始版本文件包括初始代码文件和初始配置文件;所述初始部署作业文件中包含第一IP地址集合和初始部署命令文件;The project version creation release instruction is received, and the creation release file package is obtained; the creation release file package includes an initial version number, an initial version file, and an initial deployment job file associated with each other; the initial version file includes an initial code file and an initial configuration File; the initial deployment job file includes a first IP address set and an initial deployment command file;
将所述初始版本文件存储至Git本地仓库,同时将所述初始版本文件推送至Git中央仓库;Store the initial version file in the Git local warehouse, and push the initial version file to the Git central warehouse at the same time;
向所有与所述第一IP地址集合中的第一IP地址匹配的第一目标服务器发送含有所述初始版本号的版本初始指令;Sending a version initial instruction containing the initial version number to all first target servers that match the first IP address in the first IP address set;
接收到所述第一目标服务器反馈的针对所述版本初始指令包含所述初始版本号的第一拉取指令之后,通过所述Git中央仓库,按照第一传输方式向所述第一目标服务器传输与所述第一拉取指令中包含的所述初始版本号关联的所述初始版本文件;所述第一传输方式为将与所述第一拉取指令中包含的所述初始版本号关联的所述初始版本文件直接传输至所述第一目标服务器;After receiving the first pull instruction for the version initial instruction including the initial version number that is fed back by the first target server, it is transmitted to the first target server through the Git central warehouse according to the first transmission method The initial version file associated with the initial version number included in the first pull instruction; the first transmission method is to associate with the initial version number included in the first pull instruction The initial version file is directly transmitted to the first target server;
根据所述初始部署命令文件,与所述第一目标服务器通过非交互式对话方式将所述初始版本文件安装至所述第一目标服务器;According to the initial deployment command file, install the initial version file to the first target server through a non-interactive dialogue with the first target server;
接收到所有已反馈所述第一拉取指令的所述第一目标服务器发送的安装成功指令之后,确定所述创建发布文件包发布成功。After receiving all installation success instructions sent by the first target server that has fed back the first pull instruction, it is determined that the creation and release file package is successfully released.
一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现上述基于Git的项目版本发布方法的步骤,例如,实现以下步骤:A computer-readable storage medium that stores a computer program that, when executed by a processor, implements the steps of the above-mentioned Git-based project version publishing method, for example, the following steps are implemented:
接收到项目版本创建发布指令,获取创建发布文件包;所述创建发布文件包中包括相互关联的初始版本号、初始版本文件和初始部署作业文件;所述初始版本文件包括初始代码文件和初始配置文件;所述初始部署作业文件中包含第一IP地址集合和初始部署命令文件;The project version creation release instruction is received, and the creation release file package is obtained; the creation release file package includes an initial version number, an initial version file, and an initial deployment job file associated with each other; the initial version file includes an initial code file and an initial configuration File; the initial deployment job file includes a first IP address set and an initial deployment command file;
将所述初始版本文件存储至Git本地仓库,同时将所述初始版本文件推送至Git中央仓库;Store the initial version file in the Git local warehouse, and push the initial version file to the Git central warehouse at the same time;
向所有与所述第一IP地址集合中的第一IP地址匹配的第一目标服务器发送含有所述初始版本号的版本初始指令;Sending a version initial instruction containing the initial version number to all first target servers that match the first IP address in the first IP address set;
接收到所述第一目标服务器反馈的针对所述版本初始指令包含所述初始版本号的第一拉取指令之后,通过所述Git中央仓库,按照第一传输方式向所述第一目标服务器传输与所述第一拉取指令中包含的所述初始版本号关联的所述初始版本文件;所述第一传输方式为将与所述第一拉取指令中包含的所述初始版本号关联的所述初始版本文件直接传输至所述第一目标服务器;After receiving the first pull instruction for the version initial instruction including the initial version number that is fed back by the first target server, it is transmitted to the first target server through the Git central warehouse according to the first transmission method The initial version file associated with the initial version number included in the first pull instruction; the first transmission method is to associate with the initial version number included in the first pull instruction The initial version file is directly transmitted to the first target server;
根据所述初始部署命令文件,与所述第一目标服务器通过非交互式对话方式将所述初始版本文件安装至所述第一目标服务器;According to the initial deployment command file, install the initial version file to the first target server through a non-interactive dialogue with the first target server;
接收到所有已反馈所述第一拉取指令的所述第一目标服务器发送的安装成功指令之后,确定所述创建发布文件包发布成功。After receiving all installation success instructions sent by the first target server that has fed back the first pull instruction, it is determined that the creation and release file package is successfully released.
本申请实现基于Git分布式控制系统自动配置目标服务器的环境,提高了效率,大大较少了人工配置成本,减少了运营成本,极大缩短了项目版本发布时间。This application realizes the environment of automatically configuring the target server based on the Git distributed control system, improves efficiency, greatly reduces manual configuration costs, reduces operating costs, and greatly shortens the project version release time.
附图说明Description of the drawings
图1是本申请一实施例中基于Git的项目版本发布方法的应用环境示意图;FIG. 1 is a schematic diagram of the application environment of the Git-based project version release method in an embodiment of the present application;
图2是本申请一实施例中基于Git的项目版本发布方法的流程图;Figure 2 is a flowchart of a Git-based project version release method in an embodiment of the present application;
图3是本申请一实施例中基于Git的项目版本发布方法的步骤S60的流程图;FIG. 3 is a flowchart of step S60 of the Git-based project version publishing method in an embodiment of the present application;
图4是本申请一实施例中基于Git的项目版本发布方法的步骤S120的流程图;FIG. 4 is a flowchart of step S120 of the Git-based project version publishing method in an embodiment of the present application;
图5是本申请一实施例中基于Git的项目版本发布方法的步骤S40的流程图;FIG. 5 is a flowchart of step S40 of the Git-based project version publishing method in an embodiment of the present application;
图6是本申请一实施例中基于Git的项目版本发布方法的步骤S100的流程图;FIG. 6 is a flowchart of step S100 of the Git-based project version publishing method in an embodiment of the present application;
图7是本申请一实施例中基于Git的项目版本发布方法的步骤S110的流程图;FIG. 7 is a flowchart of step S110 of the Git-based project version publishing method in an embodiment of the present application;
图8是本申请一实施例中基于Git的项目版本发布装置的原理框图;Figure 8 is a functional block diagram of a Git-based project version publishing device in an embodiment of the present application;
图9是本申请一实施例中基于Git的项目版本发布装置中的确定模块16的原理框图;FIG. 9 is a functional block diagram of the determining module 16 in the Git-based project version publishing device in an embodiment of the present application;
图10是本申请一实施例中计算机设备的示意图。Fig. 10 is a schematic diagram of a computer device in an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
本申请的技术方案可应用于人工智能或大数据领域,如涉及分布式人工智能技术,涉及的数据可存储于数据库中,或者可以通过区块链分布式存储,本申请不做限定。The technical solution of this application can be applied to the field of artificial intelligence or big data. For example, when it involves distributed artificial intelligence technology, the involved data can be stored in a database, or can be distributed storage through a blockchain, which is not limited by this application.
本申请提供的基于Git的项目版本发布方法,可应用在如图1的应用环境中,其中,客户端(计算机设备)通过网络与服务器进行通信。其中,客户端(计算机设备)包括但不限于为各种个人计算机、笔记本电脑、智能手机、平板电脑、摄像头和便携式可穿戴设备。服务器可以用独立的服务器或者是多个服务器组成的服务器集群来实现。The Git-based project version release method provided by this application can be applied in the application environment as shown in Figure 1, where the client (computer equipment) communicates with the server through the network. Among them, the client (computer equipment) includes, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, cameras, and portable wearable devices. The server can be implemented as an independent server or a server cluster composed of multiple servers.
在一实施例中,如图2所示,提供一种基于Git的项目版本发布方法,其技术方案主要包括以下步骤S10-S60:In one embodiment, as shown in FIG. 2, a Git-based project version release method is provided, and the technical solution mainly includes the following steps S10-S60:
S10,接收到项目版本创建发布指令,获取创建发布文件包;所述创建发布文件包中包括相互关联的初始版本号、初始版本文件和初始部署作业文件;所述初始版本文件包括初始代码文件和初始配置文件;所述初始部署作业文件中包含第一IP地址集合和初始部署命令文件。S10. A project version creation release instruction is received, and a creation release file package is obtained; the creation release file package includes an initial version number, an initial version file, and an initial deployment job file that are related to each other; the initial version file includes an initial code file and Initial configuration file; the initial deployment job file includes the first IP address set and the initial deployment command file.
可理解地,本申请的应用场景可以为网页上操作,也可以为在应用程序上操作,在一实施例中,通过应用网页界面,用户按照网页模板要求上传相关的文件,即按照设定的网页模板的顺序要求依次上传相关的文件,所述应用网页界面指通过网页实现应用操作的界面;在接收到已确定的所有与项目版本相关的文件之后,触发所述项目版本创建发布指令,所述项目版本为需要发布的项目对应的版本,从而将所有与所述项目版本相关的文件根据预设的初始模板进行合并,即将所有与所述项目版本相关的文件按照所述初始模板的要求进行拆分及合并,所述初始模板指第一次发布项目对应的模板,并且根据预设的初始压缩参数进行压缩生成所述创建发布文件包,所述初始压缩参数可以根据需求进行设定,比如 所述初始压缩参数为转换成rar格式的参数,或者所述初始压缩参数为转换成zip格式的参数等等,以及将压缩之后的所述创建发布文件包上传至云端服务器;通过所述云端服务器接收到所述创建发布文件包之后,对所述创建发布文件包进行解压,从而获取所述创建发布文件包中包含的所述初始版本号、与所述初始版本号关联的所述初始版本文件和与所述初始版本号关联的初始部署作业文件,如此通过对所述创建发布文件包进行压缩上传至云端服务器,再解压获取所述创建发布文件包,能够通过云端服务器接收多个压缩的所述创建发布文件包,对多个压缩的所述创建发布文件包进行中转和备份,能够避免了获取多个所述创建发布文件包过程中丢失的风险。Understandably, the application scenario of this application can be an operation on a webpage or an application. In one embodiment, through the application webpage interface, the user uploads relevant files according to the requirements of the webpage template, that is, according to the set The order of the web page template requires that the relevant files be uploaded in sequence. The application web interface refers to the interface that implements application operations through the web; after receiving all the documents related to the project version that have been determined, the project version creation and release instruction is triggered, so The project version is the version corresponding to the project that needs to be released, so that all files related to the project version are merged according to the preset initial template, that is, all files related to the project version are processed in accordance with the requirements of the initial template Splitting and merging, the initial template refers to the template corresponding to the first release project, and is compressed according to preset initial compression parameters to generate the creation and release package. The initial compression parameters can be set according to requirements, such as The initial compression parameter is a parameter converted into rar format, or the initial compression parameter is a parameter converted into zip format, etc., and the compressed creation and release file package is uploaded to a cloud server; After receiving the creation and release package, decompress the creation and release package to obtain the initial version number contained in the creation and release package and the initial version file associated with the initial version number And the initial deployment job file associated with the initial version number, in this way, by compressing the creation and release file package and uploading it to the cloud server, and then decompressing it to obtain the creation and release file package, a plurality of compressed all files can be received through the cloud server. Said creating and publishing file packages, transferring and backing up a plurality of compressed creating and publishing file packages, can avoid the risk of loss in the process of obtaining a plurality of creating and publishing file packages.
其中,所述初始版本文件包含所述初始代码文件和所述初始配置文件,所述初始代码文件为项目初始版本的源代码文件,所述初始配置文件为运行所述初始代码文件所需配置的运行环境相关的文件,所述初始部署作业文件包含有所述第一IP地址集合和所述初始部署命令文件,所述第一IP地址集合为所有需要将所述初始版本文件发布至的目标服务器对应的IP地址的集合。Wherein, the initial version file includes the initial code file and the initial configuration file, the initial code file is the source code file of the initial version of the project, and the initial configuration file is the configuration required to run the initial code file. Files related to the operating environment, the initial deployment job file includes the first IP address set and the initial deployment command file, and the first IP address set is all target servers to which the initial version file needs to be released A collection of corresponding IP addresses.
S20,将所述初始版本文件存储至Git本地仓库,同时将所述初始版本文件推送至Git中央仓库。S20: Store the initial version file in the Git local warehouse, and at the same time push the initial version file to the Git central warehouse.
可理解地,所述Git本地仓库为基于Git分布式控制系统进行设定的存储仓库,所述Git分布式控制系统为基于Git建立的包括Git本地仓库和Git中央仓库的系统,所述Git本地仓库可以接受用户上传或更新的项目版本文件和版本记录并进行存储,所述Git中央仓库为基于Git分布式控制系统进行设定的暂存仓库,所述Git中央仓库为接收所述Git本地仓库推送过来的所述初始版本文件,并进行暂存。Understandably, the Git local warehouse is a storage warehouse set based on the Git distributed control system, and the Git distributed control system is a system based on Git that includes a Git local warehouse and a Git central warehouse. The Git local The warehouse can accept and store project version files and version records uploaded or updated by users. The Git central warehouse is a temporary warehouse set based on the Git distributed control system, and the Git central warehouse receives the Git local warehouse. The initial version file pushed over and temporarily stored.
S30,向所有与所述第一IP地址集合中的第一IP地址匹配的第一目标服务器发送含有所述初始版本号的版本初始指令。S30: Send a version initial instruction containing the initial version number to all first target servers that match the first IP address in the first IP address set.
可理解地,所述第一目标服务器为与所述第一IP地址一致的目标服务器,所述第一IP地址为所述第一IP地址集合中的元素,向所有所述第一目标服务器发送所述版本初始指令,所述版本初始指令为针对于发布初始版本文件的指令,所述版本初始指令可以根据需求进行设定,比如根据Docker容器管理工具提供的初始指令模板生成版本初始指令等,所述版本初始指令包括所述初始版本号。Understandably, the first target server is a target server consistent with the first IP address, and the first IP address is an element in the first IP address set, and sends to all the first target servers The version initial instruction, the version initial instruction is an instruction for issuing an initial version file, the version initial instruction can be set according to requirements, for example, the version initial instruction is generated according to the initial instruction template provided by the Docker container management tool, etc., The version initial instruction includes the initial version number.
S40,接收到所述第一目标服务器针对所述版本初始指令反馈的包含所述初始版本号的第一拉取指令之后,通过所述Git中央仓库,按照第一传输方式向所述第一目标服务器传输与所述第一拉取指令中包含的所述初始版本号关联的所述初始版本文件;所述第一传输方式为将与所述第一拉取指令中包含的所述初始版本号关联的所述初始版本文件直接传输至所述第一目标服务器。S40. After receiving the first pull instruction that includes the initial version number fed back by the first target server for the initial instruction of the version, the Git central warehouse sends the first pull instruction to the first target according to the first transmission method. The server transmits the initial version file associated with the initial version number included in the first pull instruction; the first transmission method is to be related to the initial version number included in the first pull instruction The associated initial version file is directly transmitted to the first target server.
可理解地,所述第一目标服务器接收到所述版本初始指令之后,所述第一目标服务器针对所述版本初始指令在所述第一目标服务器内部进行检测,在未检测出包含任何与所述初始版本号相关的文件时,所述第一目标服务器反馈所述第一拉取指令,表明所述第一目标服务器需要拉取所述初始版本文件,所述第一传输方式为直接推送文件至所述第一目标服务器,通过所述Git中央仓库,按照所述第一传输方式向所述第一目标服务器传输所述初始版本文件。Understandably, after the first target server receives the version initial instruction, the first target server performs a check inside the first target server for the version initial instruction. When referring to the file related to the initial version number, the first target server feeds back the first pull instruction, indicating that the first target server needs to pull the initial version file, and the first transmission method is to push the file directly To the first target server, the initial version file is transmitted to the first target server according to the first transmission mode through the Git central warehouse.
在一实施例中,如图5所示,所述步骤S40中,即所述通过所述Git中央仓库,按照第一传输方式向所述第一目标服务器传输与所述第一拉取指令中包含的所述初始版本号关联的所述初始版本文件,包括:In one embodiment, as shown in FIG. 5, in the step S40, the Git central warehouse is used to transmit to the first target server according to the first transmission mode. The included initial version file associated with the initial version number includes:
S401,通过所述Git中央仓库向所述第一目标服务器传输所述初始版本文件。S401: Transmit the initial version file to the first target server through the Git central warehouse.
可理解地,所述传输方式可以根据需求进行设定,比如通过SSH(Secure Shell,安全外壳协议)方式将所述Git中央仓库与所述第一目标服务器进行连接,连接之后向所述第 一目标服务器传输所述初始版本文件,所述SSH方式为通过SSH协议,基于非对称加密方法生成公钥和私钥,通过密码认证或公钥认证建立通信连接,保证信息交互的安全和完整。Understandably, the transmission method can be set according to requirements. For example, the Git central warehouse is connected to the first target server through SSH (Secure Shell), and the first target server is sent to the first target server after the connection. The target server transmits the initial version file, and the SSH mode is to generate a public key and a private key based on an asymmetric encryption method through the SSH protocol, and establish a communication connection through password authentication or public key authentication to ensure the security and integrity of information interaction.
S402,接收到所述第一目标服务器创建与所述初始版本号关联的本地Git文件之后反馈的创建成功指令。S402: Receive a creation success instruction fed back after the first target server creates the local Git file associated with the initial version number.
可理解地,通过所述Git中央仓库向所述第一目标服务器传输所述初始版本文件,所述第一目标服务器接收到所述初始版本文件后在本地创建与所述初始版本号关联的本地Git文件,标记所述第一目标服务器含有与所述初始版本号相关的文件,同时反馈所述创建成功指令。Understandably, the initial version file is transmitted to the first target server through the Git central warehouse, and after receiving the initial version file, the first target server creates a local file associated with the initial version number locally. A Git file, marking that the first target server contains a file related to the initial version number, and feeding back the creation success instruction at the same time.
S50,根据所述初始部署命令文件,与所述第一目标服务器通过非交互式对话方式将所述初始版本文件安装至所述第一目标服务器。S50, according to the initial deployment command file, install the initial version file to the first target server in a non-interactive dialogue manner with the first target server.
可理解地,所述初始部署命令文件为所有执行部署流程中的根据所述第一目标服务器在部署过程中反馈的过程指令对应的指导命令指令的集合,所述非交互式对话方式为无需人工与目标服务器进行交互对话进行执行命令指令,直接自动根据一问一答的对应关系执行相应的命令指令,通过非交互式对话方式将所述初始版本文件安装至所述第一目标服务器,如此,无需人工在所述第一目标服务器进行手动配置,实现了自动安装初始配置文件和初始代码文件。Understandably, the initial deployment command file is a collection of guidance command instructions corresponding to the process instructions fed back by the first target server during the deployment process in all the execution deployment processes, and the non-interactive dialogue mode requires no manual operation. Perform an interactive dialogue with the target server to execute command instructions, directly and automatically execute the corresponding command instructions according to the corresponding relationship of one question and one answer, and install the initial version file to the first target server through a non-interactive dialogue mode, so, There is no need to manually configure the first target server manually, and the initial configuration file and the initial code file are automatically installed.
S60,接收到所有已反馈所述第一拉取指令的所述第一目标服务器发送的安装成功指令之后,确定所述创建发布文件包发布成功。S60: After receiving all installation success instructions sent by the first target server that has fed back the first pull instruction, it is determined that the creation and release file package is successfully released.
可理解地,已反馈所述第一拉取指令的所述第一目标服务器安装完成所述初始配置文件和初始代码文件之后触发所述安装成功指令,接收到所有已反馈所述第一拉取指令的所述第一目标服务器反馈的所述安装成功指令之后,确认所述创建发布文件包发布成功。Understandably, the first target server that has fed back the first pull instruction triggers the installation success instruction after the installation of the initial configuration file and the initial code file is completed, and all the first pull instructions that have been fed back are received After the installation success instruction fed back by the first target server of the instruction, it is confirmed that the creation and release file package is successfully released.
本申请通过接收到项目版本创建发布指令,获取创建发布文件包;所述创建发布文件包中包括相互关联的初始版本号、初始版本文件和初始部署作业文件;所述初始版本文件包括初始代码文件和初始配置文件;所述初始部署作业文件中包含第一IP地址集合和初始部署命令文件;将所述初始版本文件存储至Git本地仓库,同时将所述初始版本文件推送至Git中央仓库;向所有与所述第一IP地址集合中的第一IP地址匹配的第一目标服务器发送含有所述初始版本号的版本初始指令;接收到所述第一目标服务器针对所述版本初始指令反馈的包含所述初始版本号的第一拉取指令之后,通过所述Git中央仓库,按照第一传输方式向所述第一目标服务器传输与所述第一拉取指令中包含的所述初始版本号关联的所述初始版本文件;所述第一传输方式为将与所述第一拉取指令中包含的所述初始版本号关联的所述初始版本文件直接传输至所述第一目标服务器;根据所述初始部署命令文件,与所述第一目标服务器通过非交互式对话方式将所述初始版本文件安装至所述第一目标服务器;接收到所有已反馈所述第一拉取指令的所述第一目标服务器发送的安装成功指令之后,确定所述创建发布文件包发布成功。This application obtains the creation and release package by receiving the project version creation release instruction; the creation release package includes the initial version number, the initial version file, and the initial deployment job file that are related to each other; the initial version file includes the initial code file And the initial configuration file; the initial deployment job file contains the first IP address set and the initial deployment command file; the initial version file is stored in the Git local warehouse, and the initial version file is pushed to the Git central warehouse at the same time; All the first target servers that match the first IP address in the first IP address set send the initial version instruction containing the initial version number; the first target server receives the inclusion of the initial version instruction feedback After the first pull instruction of the initial version number, the Git central warehouse transmits the association with the initial version number contained in the first pull instruction to the first target server according to the first transmission method The initial version file; the first transmission method is to directly transmit the initial version file associated with the initial version number contained in the first pull instruction to the first target server; The initial deployment command file, install the initial version file to the first target server through a non-interactive dialogue with the first target server; receive all the first pull instructions that have fed back the first pull instruction After a successful installation instruction sent by a target server, it is determined that the creation and release file package is successfully released.
如此,本申请实现了通过获取创建发布文件包,将所述创建发布文件包中的所述初始版本文件存储至Git本地仓库,同时推送至Git中央仓库,向所有第一目标服务器发送含有初始版本号的版本初始指令,接收到所述第一目标服务器针对所述版本初始指令反馈的第一拉取指令之后,通过所述Git中央仓库,按照第一传输方式向所述第一目标服务器传输所述初始版本文件,在部署过程中,根据初始部署命令文件,通过非交互式对话方式将所述初始文件安装至所述第一目标服务器,接收到所有已反馈第一拉取指令的所述第一目标服务器发送的安装成功指令之后,从而确定所述创建发布文件包发布成功,实现了基于Git分布式控制系统通过第一传输方式发布初始代码文件和初始配置文件,根据初始部署文件通过非交互式对话方式完成准确地传输至目标服务器的初始代码文件和初始配置文件的自动安装,从而实现基于Git分布式控制系统自动配置目标服务器的环境,提高了效率,大 大较少了人工配置成本,减少了运营成本,极大缩短了项目版本发布时间。In this way, this application realizes that by obtaining the creation and release package, the initial version file in the creation and release package is stored in the Git local warehouse, and at the same time, it is pushed to the Git central warehouse, and the initial version is sent to all the first target servers. After receiving the first pull instruction feedback from the first target server for the initial instruction of the version, the Git central warehouse transmits the data to the first target server according to the first transmission method. According to the initial deployment command file, during the deployment process, the initial file is installed to the first target server through a non-interactive dialogue mode, and all the first pull instructions that have been fed back to the first target server are received. After a successful installation instruction sent by a target server, it is determined that the creation and release file package is successfully released, and the initial code file and initial configuration file are released through the first transmission method based on the Git distributed control system, and the initial deployment file is based on non-interactive The automatic installation of the initial code file and initial configuration file accurately transmitted to the target server is completed in a dialogue mode, thereby realizing the environment of automatically configuring the target server based on the Git distributed control system, which improves efficiency, greatly reduces manual configuration costs, and reduces This reduces operating costs and greatly shortens the release time of the project version.
在一实施例中,如图3所示,所述步骤S60之后,即所述确定所述创建发布文件包发布成功之后,包括:In an embodiment, as shown in FIG. 3, after the step S60, that is, after the determining that the creation and release file package is successfully released, the method includes:
S70,接收到项目版本更新发布指令,获取更新发布文件包;所述更新发布文件包中包括相互关联的更新版本号、分支版本文件和更新部署文件;所述分支版本文件包括更新代码文件和更新配置文件;所述更新部署文件中包含第二IP地址集合和更新部署命令文件。S70. The project version update release instruction is received, and the update release file package is obtained; the update release file package includes an associated update version number, a branch version file, and an update deployment file; the branch version file includes an update code file and an update Configuration file; the update deployment file contains the second IP address set and the update deployment command file.
可理解地,在项目开发过程中有更新的版本需要发布时,优先地,通过所述应用网页界面,用户按照网页模板要求上传相关的需更新的文件,即按照设定的网页模板的顺序要求依次上传相关的需更新的文件;在接收到已确定的所有与项目更新版本相关的文件之后,触发所述项目版本更新发布指令,所述项目更新版本为对发布的项目进行更新升级对应的版本,从而将所有与所述项目更新版本相关的文件根据预设的更新模板进行合并,即将所有与所述项目更新版本相关的文件按照所述更新模板的要求进行拆分及合并,所述更新模板指与更新升级已经发布过的项目进行对应的模板,并且根据预设的更新压缩参数进行压缩生成所述创建发布文件包,所述更新压缩参数可以根据需求进行设定,比如所述更新压缩参数为转换成rar格式的参数,或者所述更新压缩参数为转换成zip格式的参数等等,其中,所述更新压缩参数与所述初始压缩参数可以一致,亦可以不一致,以及将压缩之后的所述更新发布文件包上传至所述云端服务器;通过所述云端服务器接收到所述更新发布文件包之后,对所述更新发布文件包进行解压,从而获取所述更新发布文件包中包含的所述更新版本号、与所述更新版本号关联的所述分支版本文件和与所述更新版本号关联的更新部署文件,如此通过对所述更新发布文件包进行压缩上传至云端服务器,再解压获取所述更新发布文件包,能够通过云端服务器接收多个压缩的所述更新发布文件包,对多个压缩的所述更新发布文件包进行中转和备份,能够避免了获取多个所述更新发布文件包过程中丢失的风险。Understandably, when there is an updated version that needs to be released during the project development process, firstly, through the application web interface, the user uploads related files that need to be updated according to the requirements of the web template, that is, according to the order of the set web template Upload related files to be updated in sequence; after receiving all files related to the project update version that have been determined, trigger the project version update release instruction, and the project update version is the version corresponding to the update and upgrade of the released project , So that all files related to the updated version of the project are merged according to the preset update template, that is, all files related to the updated version of the project are split and merged according to the requirements of the updated template. Refers to a template corresponding to the updated project that has been released, and compressed according to preset update compression parameters to generate the creation and release file package. The update compression parameters can be set according to requirements, such as the update compression parameters It is a parameter converted into rar format, or the updated compression parameter is a parameter converted into zip format, etc., wherein the updated compression parameter and the initial compression parameter may be consistent or inconsistent, and all compressed parameters The update release file package is uploaded to the cloud server; after the update release file package is received through the cloud server, the update release file package is decompressed, so as to obtain the update release file package. The update version number, the branch version file associated with the update version number, and the update deployment file associated with the update version number are compressed and uploaded to the cloud server by compressing the update release file package, and then decompressing the file to obtain The update release file package can receive multiple compressed update release file packages through a cloud server, and transfer and back up multiple compressed update release file packages, which can avoid obtaining multiple update release file packages. Risk of loss in the process.
其中,所述分支版本文件包含所述更新代码文件和所述更新配置文件,所述更新代码文件为所述项目更新版本对应的源代码文件,所述更新配置文件为运行所述更新代码文件所需配置的运行环境相关的文件,所述更新部署作业文件包含有所述第二IP地址集合和所述更新部署命令文件,所述第二IP地址集合为所有需要将所述分支版本文件发布至的目标服务器对应的IP地址的集合。Wherein, the branch version file includes the update code file and the update configuration file, the update code file is a source code file corresponding to the project update version, and the update configuration file is used to run the update code file. Files related to the operating environment that need to be configured, the update deployment job file includes the second IP address set and the update deployment command file, and the second IP address set is for all files that need to be released to the branch version The set of IP addresses corresponding to the target server.
S80,将所述分支版本文件存储至所述Git本地仓库,同时将所述分支版本文件推送至所述Git中央仓库。S80: Store the branch version file in the Git local warehouse, and at the same time push the branch version file to the Git central warehouse.
可理解地,所述Git本地仓库为基于Git分布式控制系统进行设定的存储仓库,所述Git分布式控制系统为基于Git建立的包括Git本地仓库和Git中央仓库的系统,所述Git本地仓库可以接受用户上传或更新的项目版本文件和版本记录并进行存储,所述Git中央仓库为基于Git分布式控制系统进行设定的暂存仓库,所述Git中央仓库为接收所述Git本地仓库推送过来的所述分支版本文件,并进行暂存。Understandably, the Git local warehouse is a storage warehouse set based on the Git distributed control system, and the Git distributed control system is a system based on Git that includes a Git local warehouse and a Git central warehouse. The Git local The warehouse can accept and store project version files and version records uploaded or updated by users. The Git central warehouse is a temporary warehouse set based on the Git distributed control system, and the Git central warehouse receives the Git local warehouse. The branch version file pushed over and temporarily stored.
S90,向所有与所述第二IP地址集合中的第二IP地址匹配的第二目标服务器发送含有所述分支版本号的版本更新指令。S90: Send a version update instruction containing the branch version number to all second target servers that match the second IP address in the second IP address set.
可理解地,所述第二目标服务器为与所述第二IP地址一致的目标服务器,所述第二IP地址为所述第二IP地址集合中的元素,向所有所述第二目标服务器发送所述版本更新指令,所述版本更新指令为针对于发布分支版本文件的指令,所述版本更新指令可以根据需求进行设定,比如根据Docker容器管理工具提供的更新指令模板生成版本更新指令等,所述版本更新指令包括所述更新版本号,所述第二IP地址集合中可能存在与所述第二IP地址相同的第一IP地址,也可能存在与所述第一IP地址集合中的所有第一IP地址都不相同的第二IP地址。Understandably, the second target server is a target server consistent with the second IP address, and the second IP address is an element in the second IP address set, and sends to all the second target servers The version update instruction, the version update instruction is an instruction for publishing a branch version file, the version update instruction can be set according to requirements, such as generating a version update instruction according to an update instruction template provided by a Docker container management tool, etc., The version update instruction includes the update version number, and there may be a first IP address that is the same as the second IP address in the second IP address set, or there may be a first IP address that is the same as the first IP address in the first IP address set. A second IP address that is not the same as the first IP address.
S100,接收到所述第二目标服务器针对所述版本更新指令反馈的包含所述分支版本号的第二拉取指令之后,通过所述Git中央仓库,按照第二传输方式向所述第二目标服务器传输与所述第二目标服务器对应的差异文件;所述第二传输方式为根据所述第二拉取指令中与所述分支版本号关联的本地Git文件,确定与所述第二目标服务器对应的差异文件,并将与所述第二目标服务器对应的差异文件传输至所述第二目标服务器。S100. After receiving the second pull instruction that includes the branch version number fed back by the second target server for the version update instruction, the Git central warehouse uses the second transmission method to send the second pull instruction to the second target. The server transmits the difference file corresponding to the second target server; the second transmission method is to determine the difference file with the second target server according to the local Git file associated with the branch version number in the second pull instruction Corresponding difference files, and transmitting the difference files corresponding to the second target server to the second target server.
可理解地,所述第二目标服务器接收到所述版本更新指令之后,所述第二目标服务器针对所述版本更新指令在所述第二目标服务器内部进行检测,所述第二目标服务器反馈所述第二拉取指令,所述第二传输方式为根据所述第二拉取指令中与所述分支版本号关联的本地Git文件,所述与所述分支版本号关联的本地Git文件为存储在所述第二目标服务器内部的以体现各文件夹之间关联关系的Git文件夹目录格式记录的文件,确定与所述第二目标服务器对应的差异文件,并将与所述第二目标服务器对应的差异文件传输至所述第二目标服务器,即在所述第二目标服务器检测到未包含任何与所述分支版本号关联的本地Git文件,则反馈无与所述分支版本号关联的本地Git文件的第二拉取指令,根据所述第二拉取指令确定该第二目标服务器需要拉取整个所述分支版本文件,从而将所述分支版本文件发送至该第二目标服务器;在所述第二目标服务器检测到本地含有与所述分支版本号关联的本地Git文件与所述分支版本号关联的本地Git文件,即通过与所述分支版本号的匹配度确定出与所述分支版本号关联的本地Git文件,则反馈含有与所述分支版本号关联的本地Git文件的第二拉取指令,将接收到的所述与所述分支版本号关联的本地Git文件跟所述分支版本文件进行比对,获取所述与所述分支版本号关联的本地Git文件跟所述分支版本文件比对后的差异文件,从而确定为该第二目标服务器对应的差异文件,所述第二目标服务器对应的差异文件包括代码差异文件和配置差异文件,所述代码差异文件为所述与所述分支版本号关联的本地Git文件中的代码文件与所述分支版本文件中的更新代码文件之间的差异内容的文件,所述配置差异文件为所述与所述分支版本号关联的本地Git文件中的配置文件与所述分支版本文件中的更新配置文件之间的差异内容的文件,将该第二目标服务器对应的差异文件传输至该第二目标服务器。Understandably, after the second target server receives the version update instruction, the second target server detects the version update instruction inside the second target server, and the second target server feeds back In the second pull instruction, the second transmission method is based on the local Git file associated with the branch version number in the second pull instruction, and the local Git file associated with the branch version number is stored The file recorded in the Git folder directory format that reflects the association relationship between the folders in the second target server is determined, and the difference file corresponding to the second target server is determined and compared with the second target server. The corresponding difference file is transmitted to the second target server, that is, when the second target server detects that it does not contain any local Git file associated with the branch version number, it will feedback that there is no local Git file associated with the branch version number. According to the second pull instruction of the Git file, it is determined that the second target server needs to pull the entire branch version file according to the second pull instruction, so that the branch version file is sent to the second target server; The second target server detects that it locally contains the local Git file associated with the branch version number and the local Git file associated with the branch version number, that is, the branch version is determined by the degree of matching with the branch version number The local Git file associated with the branch version number, the second pull instruction containing the local Git file associated with the branch version number is fed back, and the received local Git file associated with the branch version number is combined with the branch version The files are compared, and the difference file after comparing the local Git file associated with the branch version number with the branch version file is obtained, so as to determine the difference file corresponding to the second target server. The second target The difference file corresponding to the server includes a code difference file and a configuration difference file. The code difference file is between the code file in the local Git file associated with the branch version number and the updated code file in the branch version file The configuration difference file is the file of the difference content between the configuration file in the local Git file associated with the branch version number and the updated configuration file in the branch version file. The difference file corresponding to the second target server is transmitted to the second target server.
在一实施例中,如图6所示,所述步骤S100中,即所述接收到所述第二目标服务器针对所述版本更新指令反馈的包含所述分支版本号的第二拉取指令之后,通过所述Git中央仓库,按照第二传输方式向所述第二目标服务器传输与所述第二目标服务器对应的差异文件,包括:In one embodiment, as shown in FIG. 6, in the step S100, that is, after the second pull instruction that includes the branch version number fed back by the second target server for the version update instruction is received , Transmitting the difference file corresponding to the second target server to the second target server according to the second transmission mode through the Git central warehouse, including:
S1001,接收到所述第二目标服务器根据所述分支版本号而确定与所述分支版本号关联的本地Git文件之后发送的所述第二拉取指令;S1001. Receive the second pull instruction sent after the second target server determines the local Git file associated with the branch version number according to the branch version number;
可理解地,所述第二目标服务器根据所述分支版本号在本地进行查找与所述分支版本号匹配的相关的本地Git文件,根据查询结果确定所述第二拉取指令,即在所述第二目标服务器检测到未包含任何与所述分支版本号关联的本地Git文件,则反馈无与所述分支版本号关联的本地Git文件的第二拉取指令;在所述第二目标服务器检测到本地含有与所述分支版本号关联的本地Git文件,则反馈含有与所述分支版本号关联的本地Git文件的第二拉取指令。Understandably, the second target server locally searches for the relevant local Git file matching the branch version number according to the branch version number, and determines the second pull instruction according to the query result, that is, in the The second target server detects that it does not contain any local Git file associated with the branch version number, and then feeds back that there is no second pull instruction for the local Git file associated with the branch version number; check on the second target server When the local Git file associated with the branch version number is contained locally, the second pull instruction containing the local Git file associated with the branch version number is fed back.
S1002,通过所述Git中央仓库中的Git工具对所述本地Git文件与所述分支版本文件进行比对,得出与所述第二目标服务器对应的差异文件;S1002, comparing the local Git file with the branch version file by using the Git tool in the Git central warehouse to obtain a difference file corresponding to the second target server;
可理解地,所述Git工具为所述Git中央仓库中的一种针对Git文件的比对工具,将所述分支版本文件进行转换成与所述分支版本文件对应的Git文件,将所述本地Git文件与所述分支版本文件对应的Git文件输入所述Git工具进行比对,得出与所述第二目标服务器对应的所述差异文件,所述差异文件为所述本地Git文件与所述分支版本文件对应的Git文件之间存在差异内容的文件。Understandably, the Git tool is a comparison tool for Git files in the Git central warehouse. The branch version file is converted into a Git file corresponding to the branch version file, and the local The Git file and the Git file corresponding to the branch version file are input into the Git tool for comparison, and the difference file corresponding to the second target server is obtained. The difference file is the local Git file and the Files with different content between the Git files corresponding to the branch version files.
S1003,通过所述Git中央仓库将所述第二目标服务器对应的差异文件传输至所述第二目标服务器之后,接收到所述第二目标服务器更新所述初始版本号关联的本地Git文件之后反馈的更新成功指令。S1003. After the difference file corresponding to the second target server is transmitted to the second target server through the Git central warehouse, a feedback is received after the second target server updates the local Git file associated with the initial version number The successful update instruction.
可理解地,通过所述Git中央仓库将所述差异文件传输至所述第二目标服务器,在此之后,所述第二目标服务器将接收到的所述差异文件更新至与所述初始版本号关联的本地Git文件,即将所述差异文件中与所述初始版本号关联的所述本地Git文件相同名称的所述差异文件覆盖所述本地Git文件,将所述差异文件中与所述初始版本号关联的所述本地Git文件不同名称的所述差异文件直接存储至所述初始版本号关联的所述本地Git文件的存储路径下,所述第二目标服务器更新完成之后反馈所述更新成功指令,所述更新成功指令指所述第二目标服务器对所述差异文件更新完成之后触发的指令。Understandably, the difference file is transmitted to the second target server through the Git central warehouse, and after that, the second target server updates the received difference file to the original version number. The associated local Git file, that is, the difference file with the same name as the local Git file associated with the initial version number in the difference file overwrites the local Git file, and the difference file is compared with the initial version The difference file with different names of the local Git file associated with the number is directly stored in the storage path of the local Git file associated with the initial version number, and the update success instruction is fed back after the update of the second target server is completed. The update success instruction refers to an instruction triggered after the second target server completes the update of the difference file.
如此,本申请通过基于Git分布式控制系统传输差异的文件内容,可以减少传输内容,提高传输效率,减少了信息丢失风险。In this way, the present application can reduce the transmission content, improve the transmission efficiency, and reduce the risk of information loss by transmitting the different file content based on the Git distributed control system.
S110,根据所述更新部署命令文件,与所述第二目标服务器通过非交互式对话方式将接收到的所述分支版本文件更新至所述第二目标服务器。S110: According to the update deployment command file, update the received branch version file to the second target server through a non-interactive dialogue with the second target server.
可理解地,所述更新部署命令文件为所有执行更新部署流程中的根据所述第二目标服务器在更新部署过程中反馈的更新过程指令对应的更新指导命令指令的集合,所述非交互式对话方式为无需人工与目标服务器进行交互对话进行执行命令指令,直接自动根据一问一答的对应关系执行相应的命令指令,通过非交互式对话方式将所述分支版本文件安装至所述第二目标服务器,如此,无需人工在所述第二目标服务器进行手动配置,实现了自动安装更新配置文件和更新代码文件。Understandably, the update deployment command file is a collection of update guidance command instructions corresponding to the update process instructions fed back by the second target server during the update deployment process in the update deployment process. The non-interactive dialogue The method is that there is no need for manual interactive dialogue with the target server to execute the command instructions, and the corresponding command instructions are directly executed automatically according to the corresponding relationship of one question and one answer, and the branch version file is installed to the second target through a non-interactive dialogue mode. The server, in this way, does not need to manually configure the second target server manually, and realizes the automatic installation and update of the configuration file and the update of the code file.
在一实施例中,如图7所示,所述步骤S110中,即所述根据所述更新部署命令文件,与所述第二目标服务器通过非交互式对话方式将接收到的所述分支版本文件更新至所述第二目标服务器,包括:In one embodiment, as shown in FIG. 7, in the step S110, that is, according to the update deployment command file, the received branch version is exchanged with the second target server in a non-interactive dialogue manner. The file update to the second target server includes:
S1101,接收到所述第二目标服务器接收所述分支版本文件完成之后发出的传输完成指令,发送所述更新部署命令文件中的停止指令和部署指令至所述第二目标服务器。S1101: Receive a transmission completion instruction issued by the second target server after the branch version file is completed, and send a stop instruction and a deployment instruction in the update deployment command file to the second target server.
可理解地,所述第二目标服务器确认接收完所述分支版本文件之后触发所述传输完成指令,接收到所述传输完成指令之后,向所述第二目标服务器顺次发送所述停止指令和所述部署指令,所述停止指令为所述更新部署命令文件中停止所述第二目标服务器中运行与所述初始版本号关联的所述本地Git文件的指令,所述部署指令为所述更新部署命令文件中执行所述分支版本文件在所述第二目标服务器中部署操作相关的指令。Understandably, the second target server triggers the transfer completion instruction after confirming that the branch version file is received, and after receiving the transfer completion instruction, sends the stop instruction and the stop instruction to the second target server in sequence. The deployment instruction, the stop instruction is an instruction in the update deployment command file to stop running the local Git file associated with the initial version number in the second target server, and the deployment instruction is the update The deployment command file executes instructions related to the deployment operation of the branch version file in the second target server.
S1102,在接收到所述第二目标服务器在执行所述停止指令和所述部署指令过程中反馈的异常指令时,自所述更新部署命令文件中查找与所述异常指令匹配的修复指令,并将所述修复指令发送至所述第二目标服务器以完成更新过程,直至接收到所述第二目标服务器反馈的完成指令。S1102: When receiving the abnormal instruction fed back by the second target server during the execution of the stop instruction and the deployment instruction, search for a repair instruction matching the abnormal instruction from the update deployment command file, and The repair instruction is sent to the second target server to complete the update process until the completion instruction fed back by the second target server is received.
可理解地,在所述第二目标服务器在执行所述停止指令和所述部署指令过程中存在异常情况时,比如异常情况为宕机,反馈与所述异常情况对应的所述异常指令,比如所述异常指令为与宕机对应的指令,接收到所述异常指令之后,从所述更新部署命令文件中查找与所述异常指令匹配的修复指令,将所述修复指令发送至所述第二目标服务器,比如所述修复指令为针对解决宕机对应的重启服务器的指令等等,所述更新过程指执行所述停止指令和所述部署指令的过程,直至接收到所述第二目标服务器反馈所述完成指令,所述完成指令为所述第二目标服务器完成更新过程之后触发的指令。Understandably, when the second target server has an abnormal situation during the execution of the stop instruction and the deployment instruction, for example, the abnormal situation is downtime, the abnormal instruction corresponding to the abnormal situation is fed back, such as The abnormal instruction is an instruction corresponding to the downtime. After receiving the abnormal instruction, search for a repair instruction matching the abnormal instruction from the update deployment command file, and send the repair instruction to the second For the target server, for example, the repair instruction is an instruction to restart the server corresponding to the solution of the downtime, etc., and the update process refers to the process of executing the stop instruction and the deployment instruction until the second target server feedback is received The completion instruction is an instruction triggered after the second target server completes the update process.
S1103,在接收到所述第二目标服务器完成所有所述部署指令之后反馈的完成指令时,发送所述更新部署命令文件中的启动指令至所述第二目标服务器,确认所述分支版本文件更新至所述第二目标服务器。S1103: Upon receiving the completion instruction fed back after the second target server completes all the deployment instructions, send the start instruction in the update deployment command file to the second target server, and confirm that the branch version file is updated To the second target server.
可理解地,在接收到所述第二目标服务器反馈的所述完成指令时,发送所述启动指令至所述第二目标服务器,所述启动指令为所述更新部署命令文件中与启动所述分支版本文件相关的指令,确定所述分支版本文件已经更新至所述第二目标服务器。Understandably, when the completion instruction fed back by the second target server is received, the start instruction is sent to the second target server, and the start instruction is in the update deployment command file and the start The instruction related to the branch version file determines that the branch version file has been updated to the second target server.
如此,本申请通过与所述第二目标服务器进行非交互式对话方式完成所述第二目标服务器在部署流程中无需人工进行手动配置,实现了自动更新所述分支版本文件中的所述更新代码文件和更新配置文件,大大减少了人工操作,提高了项目版本发布的效率,减少了运营成本。In this way, the present application completes the non-interactive dialogue with the second target server. The second target server does not need to be manually configured in the deployment process, so that the update code in the branch version file is automatically updated. Documents and update configuration files greatly reduce manual operations, improve the efficiency of project version release, and reduce operating costs.
S120,接收到所有已反馈所述第二拉取指令的所述第二目标服务器发送的更新成功指令之后,确定所述更新发布文件包发布成功。S120: After receiving all the update success instructions sent by the second target server that has fed back the second pull instruction, it is determined that the update release file package is successfully released.
可理解地,已反馈所述第二拉取指令的所述第二目标服务器安装完成所述分支版本文件之后触发所述更新成功指令,接收到所有已反馈所述第二拉取指令的所述第二目标服务器反馈的所述更新成功指令之后,确认所述更新发布文件包发布成功。Understandably, the second target server that has fed back the second pull instruction triggers the update success instruction after completing the installation of the branch version file, and receives all the second pull instructions that have fed back the second pull instruction. After the update success instruction fed back by the second target server, it is confirmed that the update release file package is successfully released.
如此,本申请实现了通过获取更新发布文件包,将所述更新发布文件包中的所述分支版本文件存储至Git本地仓库,同时推送至Git中央仓库,向所有第二目标服务器发送含有更新版本号的版本更新指令,接收到所述第二目标服务器反馈的第二拉取指令之后,通过所述Git中央仓库,按照第二传输方式向所述第二目标服务器传输所述更新版本文件,在部署过程中,根据更新部署命令文件,通过非交互式对话方式将所述更新文件安装至所述第二目标服务器,接收到所有已反馈第二拉取指令的所述第二目标服务器发送的更新成功指令之后,从而确定所述更新发布文件包发布成功,实现了基于Git分布式控制系统通过第二传输方式发布更新代码文件和更新配置文件,根据更新部署文件通过非交互式对话方式完成传输至多个目标服务器的更新代码文件和更新配置文件的自动更新,从而实现自动对目标服务器进行配置与更新版本号对应的环境,提高了效率,减少了运营成本,极大缩短了项目版本发布时间。In this way, this application realizes that by obtaining the update release file package, the branch version file in the update release file package is stored in the Git local warehouse, and at the same time, it is pushed to the Git central warehouse, and the updated version is sent to all second target servers. After receiving the second pull instruction fed back by the second target server, the updated version file is transmitted to the second target server according to the second transmission method through the Git central warehouse. During the deployment process, according to the update deployment command file, the update file is installed to the second target server in a non-interactive dialogue mode, and all updates sent by the second target server that have fed back the second pull instruction are received After the successful instruction, it is determined that the update release file package is successfully released, and the Git distributed control system is based on the second transmission method to release the update code file and the update configuration file. According to the update deployment file, the transmission is completed through non-interactive dialogue. The update code file and update configuration file of each target server are automatically updated, so as to automatically configure the environment corresponding to the updated version number of the target server, improve efficiency, reduce operating costs, and greatly shorten the project version release time.
在一实施例中,如图4所示,所述步骤S120之后,即所述确定所述更新发布文件包发布成功之后,包括:In an embodiment, as shown in FIG. 4, after the step S120, that is, after determining that the update release file package is successfully released, the method includes:
S130,接收到项目版本回滚发布指令,获取回滚发布文件包;所述回滚发布文件包中包括回滚版本号和回滚部署作业文件;所述回滚部署作业文件包含第三IP地址集合和回滚部署命令文件。S130. A project version rollback release instruction is received, and a rollback release file package is obtained; the rollback release file package includes a rollback version number and a rollback deployment job file; the rollback deployment job file includes a third IP address Collect and roll back deployment command files.
可理解地,在所述更新发布文件包发布成功之后发现运行过程中存在异常,需要回退到历史的某一个的版本号,或者根据需求需回退到历史的某一个的版本号,就需要在所述应用网页界面中在所有的历史的版本号中选取回滚版本号,所述回滚版本号为所述初始版本号和所有历史的所述更新版本号(即除当前的所述更新版本号以外)之中的其中一个,并输入回滚部署作业文件,所述回滚部署作业文件包含所述第三IP地址集合和回滚部署命令文件,所述第三IP地址集合可以根据需要进行设定,比如所述第三IP地址集合与所述第二IP地址集合相同。Understandably, after the update release file package is successfully released, it is found that there is an abnormality in the operation process, and it needs to be rolled back to a certain version number in the history, or according to the demand, it needs to be rolled back to a certain version number in the history. In the application web interface, select the rollback version number from all the historical version numbers, and the rollback version number is the initial version number and all historical update version numbers (that is, except for the current update version number). The rollback deployment job file contains the third IP address set and the rollback deployment command file, and the third IP address set can be as needed Setting is performed, for example, the third IP address set is the same as the second IP address set.
S140,自所述Git本地仓库中查询并获取与所述回滚版本号一致的版本号关联的版本文件。S140: Query and obtain a version file associated with a version number consistent with the rollback version number from the local Git warehouse.
可理解地,所述Git本地仓库存储所有项目版本的版本号以及与版本号相关联的版本文件,所述版本号包括所述初始版本号和至少一个所述更新版本号,所述版本文件包括所述初始版本文件和至少一个所述更新版本文件,所述版本号与所述版本文件一一关联,即所述初始版本号与所述初始版本文件关联,所述更新版本号与所述更新版本文件关联。Understandably, the Git local warehouse stores version numbers of all project versions and version files associated with the version numbers, where the version numbers include the initial version number and at least one of the updated version numbers, and the version files include The initial version file and at least one of the updated version files, the version number is associated with the version file one by one, that is, the initial version number is associated with the initial version file, and the updated version number is associated with the update Version file association.
S150,将与所述回滚版本号一致的版本号关联的版本文件推送至所述Git中央仓库。S150: Push the version file associated with the version number consistent with the rollback version number to the Git central warehouse.
可理解地,将获取的与所述回滚版本号一致的版本号关联的所述版本文件推送至所述Git中央仓库。Understandably, the obtained version file associated with the version number consistent with the rollback version number is pushed to the Git central warehouse.
S160,向所有与所述第三IP地址集合中的第三IP地址匹配的第三目标服务器发送含有所述回滚版本号的版本回滚指令。S160: Send a version rollback instruction containing the rollback version number to all third target servers that match the third IP address in the third IP address set.
可理解地,所述第三目标服务器为与所述第三IP地址一致的目标服务器,所述第三IP地址为所述第三IP地址集合中的元素,向所有所述第三目标服务器发送所述版本回滚指令,所述版本回滚指令为对已经发布过的所述第二目标服务器发布回滚至历史的项目版本的指令,所述版本初始指令可以根据需求进行设定,比如根据Docker容器管理工具提供的回滚指令模板生成版本回滚指令等,所述版本初始指令包括所述回滚版本号,所述第三IP地址集合可以与所述第二IP地址集合相同。Understandably, the third target server is a target server that is consistent with the third IP address, and the third IP address is an element in the third IP address set, which is sent to all third target servers The version rollback instruction, the version rollback instruction is an instruction for the second target server that has been released to roll back to the historical project version, and the initial version instruction can be set according to requirements, for example, according to The rollback instruction template provided by the Docker container management tool generates a version rollback instruction, etc., the version initial instruction includes the rollback version number, and the third IP address set may be the same as the second IP address set.
S170,接收到所述第三目标服务器针对所述版本回滚指令反馈的包含有所述回滚版本号的第三拉取指令之后,通过所述Git中央仓库,按照第三传输方式向所述第三目标服务器传输与所述第三目标服务器对应的差异文件;所述第三传输方式还为根据所述第三拉取指令中与所述回滚版本号关联的本地Git文件,确定与所述第三目标服务器对应的差异文件,并将与所述第三目标服务器对应的差异文件传输至所述第三目标服务器。S170. After receiving the third pull instruction that includes the rollback version number that is fed back by the third target server for the version rollback instruction, the Git central warehouse sends the third transmission method to the The third target server transmits the difference file corresponding to the third target server; the third transmission method is also based on the local Git file associated with the rollback version number in the third pull instruction to determine the The difference file corresponding to the third target server is transmitted, and the difference file corresponding to the third target server is transmitted to the third target server.
可理解地,所述第三目标服务器接收到所述版本回滚指令之后,所述第三目标服务器针对所述版本回滚指令在所述第三目标服务器内部进行检测,所述第三目标服务器反馈所述第三拉取指令,所述第三传输方式为根据所述第三拉取指令中与所述回滚版本号关联的本地Git文件,所述与所述回滚版本号关联的本地Git文件为存储在所述第三目标服务器内部的以体现各文件夹之间关联关系的Git文件夹目录格式记录的文件,确定与所述第三目标服务器对应的差异文件,并将与所述第三目标服务器对应的差异文件传输至所述第三目标服务器,即在所述第三目标服务器检测到未包含任何与所述回滚版本号关联的本地Git文件,则反馈无与所述回滚版本号关联的本地Git文件的第三拉取指令,根据所述第三拉取指令确定该第三目标服务器需要拉取整个与所述回滚版本号一致的版本号关联的版本文件,从而将与所述回滚版本号一致的版本号关联的版本文件发送至该第三目标服务器;在所述第三目标服务器检测到本地含有与所述回滚版本号关联的本地Git文件,即通过与所述分支版本号的匹配度确定出与所述回滚版本号关联的本地Git文件,则反馈含有所述本地Git文件的第三拉取指令,将接收到的与所述回滚版本号关联的本地Git文件跟获取的所述版本文件件进行比对,获取与所述回滚版本号关联的本地Git文件跟获取的所述版本文件比对后的差异文件,从而确定为该第三目标服务器对应的差异文件,所述第三目标服务器对应的差异文件。Understandably, after the third target server receives the version rollback instruction, the third target server detects the version rollback instruction inside the third target server, and the third target server The third pull instruction is fed back, and the third transmission method is based on the local Git file associated with the rollback version number in the third pull instruction, and the local Git file associated with the rollback version number Git files are files stored in the third target server and recorded in the Git folder directory format that reflects the association relationship between folders. The difference file corresponding to the third target server is determined, and the difference file is compared with the third target server. The difference file corresponding to the third target server is transmitted to the third target server, that is, when the third target server detects that it does not contain any local Git file associated with the rollback version number, the feedback is not related to the rollback version number. Roll the third pull instruction of the local Git file associated with the version number, and determine according to the third pull instruction that the third target server needs to pull the entire version file associated with the version number that is consistent with the rollback version number, thereby The version file associated with the version number consistent with the rollback version number is sent to the third target server; the third target server detects that the local Git file associated with the rollback version number locally contains the local Git file associated with the rollback version number, that is, through The degree of matching with the branch version number determines the local Git file associated with the rollback version number, and then the third pull instruction containing the local Git file is fed back, and the received version is the same as the rollback version number. The associated local Git file is compared with the obtained version file, and the difference file between the local Git file associated with the rollback version number and the obtained version file is obtained, and the difference file is determined to be the third The difference file corresponding to the target server, and the difference file corresponding to the third target server.
S180,根据所述回滚部署命令文件,与所述第三目标服务器通过非交互式对话方式将所述版本文件回滚至所述第三目标服务器。S180, according to the rollback deployment command file, roll back the version file to the third target server in a non-interactive dialogue manner with the third target server.
可理解地,所述回滚部署命令文件为所有执行回滚部署流程中的根据所述第三目标服务器在回滚部署过程中反馈的回滚过程指令对应的回滚指导命令指令的集合,所述非交互式对话方式为无需人工与目标服务器进行交互对话进行执行命令指令,直接自动根据一问一答的对应关系执行相应的命令指令,通过非交互式对话方式将与所述回滚版本号一致的版本号关联的版本文件安装至所述第三目标服务器,如此,无需人工在所述第三目标服务器进行手动配置,实现了自动安装与所述回滚版本号一致的版本号关联的版本文件。Understandably, the rollback deployment command file is a collection of all rollback guidance command instructions corresponding to the rollback process instructions fed back by the third target server during the rollback deployment process in the rollback deployment process, so The non-interactive dialogue mode is to execute the command instruction without manual interactive dialogue with the target server, and directly and automatically execute the corresponding command instruction according to the corresponding relationship of one question and one answer, and the version number will be rolled back through the non-interactive dialogue mode. The version file associated with the consistent version number is installed to the third target server, so that there is no need to manually configure the third target server manually, and the version associated with the version number consistent with the rollback version number is automatically installed. document.
S190,接收到所有已反馈所述第三拉取指令的所述第三目标服务器发送的回滚成功指令之后,确定所述回滚发布文件包发布成功。S190: After receiving all the rollback success instructions sent by the third target server that has fed back the third pull instruction, it is determined that the rollback release file package is successfully released.
可理解地,已反馈所述第三拉取指令的所述第三目标服务器安装完成与所述回滚版本号一致的版本号关联的版本文件之后触发所述回滚成功指令,接收到所有已反馈所述第三拉取指令的所述第三目标服务器反馈的所述回滚成功指令之后,确认所述回滚发布文件包发布成功。Understandably, after the third target server that has fed back the third pull instruction completes the installation of the version file associated with the version number that is consistent with the rollback version number, the rollback success instruction is triggered, and all the completed rollback instructions are received. After the rollback success instruction fed back by the third target server that feeds back the third pull instruction, it is confirmed that the rollback release file package is successfully released.
如此,本申请实现了通过获取回滚版本号自Git本地仓库查询并获取版本文件,基于 Git分布式控制系统通过第三传输方式发布与回滚版本号关联的版本文件,根据回滚部署文件通过非交互式对话方式完成传输至多个目标服务器的版本文件的自动回滚,从而实现自动对目标服务器进行配置与回滚版本号对应的环境,在项目版本发布后出现异常的情况下,快速回滚至历史版本,减少了运营成本。In this way, this application realizes that the version file is queried and obtained from the Git local warehouse by obtaining the rollback version number. Based on the Git distributed control system, the version file associated with the rollback version number is released through the third transmission method, and the rollback deployment file is passed Complete the automatic rollback of version files transferred to multiple target servers in a non-interactive dialog mode, so as to automatically configure the target server and the environment corresponding to the rollback version number, and quickly roll back in the case of abnormalities after the project version is released To the historical version, reducing operating costs.
在一实施例中,提供一种基于Git的项目版本发布装置,该基于Git的项目版本发布装置与上述实施例中基于Git的项目版本发布方法一一对应。如图8所示,该基于Git的项目版本发布装置包括接收模块11、存储模块12、发送模块13、传输模块14、安装模块15和确定模块16。各功能模块详细说明如下:In one embodiment, a Git-based project version publishing device is provided, and the Git-based project version publishing device corresponds to the Git-based project version publishing method in the foregoing embodiment in a one-to-one correspondence. As shown in FIG. 8, the Git-based project version release device includes a receiving module 11, a storage module 12, a sending module 13, a transmission module 14, an installation module 15 and a determination module 16. The detailed description of each functional module is as follows:
接收模块11,用于接收到项目版本创建发布指令,获取创建发布文件包;所述创建发布文件包中包括相互关联的初始版本号、初始版本文件和初始部署作业文件;所述初始版本文件包括初始代码文件和初始配置文件;所述初始部署作业文件中包含第一IP地址集合和初始部署命令文件;The receiving module 11 is configured to receive a project version creation and release instruction, and obtain a creation and release file package; the creation and release file package includes an initial version number, an initial version file, and an initial deployment job file associated with each other; the initial version file includes An initial code file and an initial configuration file; the initial deployment job file includes a first IP address set and an initial deployment command file;
存储模块12,用于将所述初始版本文件存储至Git本地仓库,同时将所述初始版本文件推送至Git中央仓库;The storage module 12 is used to store the initial version file in the Git local warehouse, and at the same time push the initial version file to the Git central warehouse;
发送模块13,用于向所有与所述第一IP地址集合中的第一IP地址匹配的第一目标服务器发送含有所述初始版本号的版本初始指令;The sending module 13 is configured to send a version initial instruction containing the initial version number to all first target servers that match the first IP address in the first IP address set;
传输模块14,用于接收到所述第一目标服务器针对所述版本初始指令反馈的包含所述初始版本号的第一拉取指令之后,通过所述Git中央仓库,按照第一传输方式向所述第一目标服务器传输与所述第一拉取指令中包含的所述初始版本号关联的所述初始版本文件;所述第一传输方式为将与所述第一拉取指令中包含的所述初始版本号关联的所述初始版本文件直接传输至所述第一目标服务器;The transmission module 14 is configured to, after receiving the first pull instruction that includes the initial version number fed back by the first target server for the initial instruction of the version, send it to the office in accordance with the first transmission method through the Git central warehouse. The first target server transmits the initial version file associated with the initial version number included in the first pull instruction; the first transmission method is to communicate with all the files included in the first pull instruction Directly transmitting the initial version file associated with the initial version number to the first target server;
安装模块15,用于根据所述初始部署命令文件,与所述第一目标服务器通过非交互式对话方式将所述初始版本文件安装至所述第一目标服务器;The installation module 15 is configured to install the initial version file to the first target server through a non-interactive dialogue with the first target server according to the initial deployment command file;
确定模块16,用于接收到所有已反馈所述第一拉取指令的所述第一目标服务器发送的安装成功指令之后,确定所述创建发布文件包发布成功。The determining module 16 is configured to determine that the creation and release file package is successfully released after receiving all installation success instructions sent by the first target server that has fed back the first pull instruction.
在一实施例中,如图9所示,所述确定模块16包括:In an embodiment, as shown in FIG. 9, the determining module 16 includes:
接收单元61,用于接收到项目版本更新发布指令,获取更新发布文件包;所述更新发布文件包中包括相互关联的更新版本号、分支版本文件和更新部署文件;所述分支版本文件包括更新代码文件和更新配置文件;所述更新部署文件中包含第二IP地址集合和更新部署命令文件;The receiving unit 61 is configured to receive the project version update release instruction and obtain the update release file package; the update release file package includes the associated update version number, the branch version file, and the update deployment file; the branch version file includes the update A code file and an update configuration file; the update deployment file includes a second IP address set and an update deployment command file;
存储单元62,用于将所述分支版本文件存储至所述Git本地仓库,同时将所述分支版本文件推送至所述Git中央仓库;The storage unit 62 is configured to store the branch version file to the Git local warehouse, and at the same time push the branch version file to the Git central warehouse;
发送单元63,用于向所有与所述第二IP地址集合中的第二IP地址匹配的第二目标服务器发送含有所述分支版本号的版本更新指令;The sending unit 63 is configured to send a version update instruction containing the branch version number to all second target servers that match the second IP address in the second IP address set;
传输单元64,用于接收到所述第二目标服务器针对所述版本更新指令反馈的包含所述分支版本号的第二拉取指令之后,通过所述Git中央仓库,按照第二传输方式向所述第二目标服务器传输与所述第二目标服务器对应的差异文件;所述第二传输方式为根据所述第二拉取指令中与所述分支版本号关联的本地Git文件,确定与所述第二目标服务器对应的差异文件,并将与所述第二目标服务器对应的差异文件传输至所述第二目标服务器;The transmission unit 64 is configured to, after receiving the second pull instruction containing the branch version number that is fed back by the second target server for the version update instruction, to the Git central warehouse according to the second transmission method. The second target server transmits the difference file corresponding to the second target server; the second transmission method is to determine the difference file corresponding to the branch version number according to the local Git file associated with the branch version number in the second pull instruction A difference file corresponding to the second target server, and transmitting the difference file corresponding to the second target server to the second target server;
更新单元65,用于根据所述更新部署命令文件,与所述第二目标服务器通过非交互式对话方式将接收到的所述分支版本文件更新至所述第二目标服务器;The update unit 65 is configured to update the received branch version file to the second target server through a non-interactive dialogue with the second target server according to the update deployment command file;
确定单元66,用于接收到所有已反馈所述第二拉取指令的所述第二目标服务器发送的更新成功指令之后,确定所述更新发布文件包发布成功。The determining unit 66 is configured to determine that the update release file package is successfully released after receiving all the update success instructions sent by the second target server that has fed back the second pull instruction.
在一实施例中,所述确定单元66包括:In an embodiment, the determining unit 66 includes:
第一接收子单元,用于接收到项目版本回滚发布指令,获取回滚发布文件包;所述回滚发布文件包中包括回滚版本号和回滚部署作业文件;所述回滚部署作业文件包含第三IP地址集合和回滚部署命令文件;The first receiving subunit is configured to receive the project version rollback release instruction and obtain the rollback release file package; the rollback release file package includes the rollback version number and the rollback deployment job file; the rollback deployment job The file contains the third IP address set and the rollback deployment command file;
查询子单元,用于自所述Git本地仓库中查询并获取与所述回滚版本号一致的版本号关联的版本文件;The query subunit is used to query and obtain the version file associated with the version number consistent with the rollback version number from the Git local warehouse;
推送子单元,用于将与所述回滚版本号一致的版本号关联的版本文件推送至所述Git中央仓库;A push sub-unit for pushing version files associated with a version number consistent with the rollback version number to the Git central warehouse;
发送子单元,用于向所有与所述第三IP地址集合中的第三IP地址匹配的第三目标服务器发送含有所述回滚版本号的版本回滚指令;A sending subunit, configured to send a version rollback instruction containing the rollback version number to all third target servers that match the third IP address in the third IP address set;
第一传输子单元,用于接收到所述第三目标服务器针对所述版本回滚指令反馈的包含有所述回滚版本号的第三拉取指令之后,通过所述Git中央仓库,按照第三传输方式向所述第三目标服务器传输与所述第三目标服务器对应的差异文件;所述第三传输方式还为根据所述第三拉取指令中与所述回滚版本号关联的本地Git文件,确定与所述第三目标服务器对应的差异文件,并将与所述第三目标服务器对应的差异文件传输至所述第三目标服务器;The first transmission subunit is configured to receive the third pull instruction containing the rollback version number that is fed back by the third target server for the version rollback instruction, and then use the Git central warehouse to follow the first The third transmission mode transmits the difference file corresponding to the third target server to the third target server; the third transmission mode is also based on the local version associated with the rollback version number in the third pull instruction. Git file, determining a difference file corresponding to the third target server, and transmitting the difference file corresponding to the third target server to the third target server;
回滚子单元,用于根据所述回滚部署命令文件,与所述第三目标服务器通过非交互式对话方式将所述版本文件回滚至所述第三目标服务器;A rollback subunit, configured to roll back the version file to the third target server through a non-interactive dialogue with the third target server according to the rollback deployment command file;
确定子单元,用于接收到所有已反馈所述第三拉取指令的所述第三目标服务器发送的回滚成功指令之后,确定所述回滚发布文件包发布成功。在一实施例中,所述传输模块14包括:The determining subunit is configured to determine that the rollback release file package is successfully released after receiving all the rollback success instructions sent by the third target server that has fed back the third pull instruction. In an embodiment, the transmission module 14 includes:
传送单元,用于通过所述Git中央仓库向所述第一目标服务器传输所述初始版本文件;A transmitting unit, configured to transmit the initial version file to the first target server through the Git central warehouse;
反馈单元,用于接收到所述第一目标服务器创建与所述初始版本号关联的本地Git文件之后反馈的创建成功指令。The feedback unit is configured to receive a creation success instruction fed back after the first target server creates the local Git file associated with the initial version number.
在一实施例中,所述传输单元64包括:In an embodiment, the transmission unit 64 includes:
第二接收子单元,用于接收到所述第二目标服务器根据所述分支版本号而确定与所述分支版本相关的本地Git文件之后发送的所述第二拉取指令;A second receiving subunit, configured to receive the second pull instruction sent after the second target server determines the local Git file related to the branch version according to the branch version number;
比对子单元,用于通过所述Git中央仓库中的Git工具对所述本地Git文件与所述分支版本文件进行比对,得出与所述第二目标服务器对应的差异文件;The comparison subunit is used to compare the local Git file with the branch version file through the Git tool in the Git central warehouse to obtain a difference file corresponding to the second target server;
第二传输子单元,用于通过所述Git中央仓库将所述第二目标服务器对应的差异文件传输至所述第二目标服务器之后,接收到所述第二目标服务器更新所述初始版本号关联的本地Git文件之后反馈的更新成功指令。The second transmission subunit is used to update the initial version number association after receiving the second target server after transmitting the difference file corresponding to the second target server to the second target server through the Git central warehouse After the local Git file, the update success instruction is fed back.
在一实施例中,所述更新单元65包括:In an embodiment, the update unit 65 includes:
第三接收子单元,用于接收到所述第二目标服务器接收所述分支版本文件完成之后发出的传输完成指令,发送所述更新部署命令文件中的停止指令和部署指令至所述第二目标服务器;The third receiving subunit is configured to receive the transmission completion instruction issued by the second target server after the branch version file is completed, and send the stop instruction and the deployment instruction in the update deployment command file to the second target server;
执行更新子单元,用于在接收到所述第二目标服务器在执行所述停止指令和所述部署指令过程中反馈的异常指令时,自所述更新部署命令文件中查找与所述异常指令匹配的修复指令,并将所述修复指令发送至所述第二目标服务器以完成更新过程,直至接收到所述第二目标服务器反馈的完成指令;The execution update subunit is configured to, upon receiving the abnormal instruction fed back by the second target server during the execution of the stop instruction and the deployment instruction, search for a match with the abnormal instruction from the update deployment command file And send the repair instruction to the second target server to complete the update process until the completion instruction fed back by the second target server is received;
完成更新子单元,用于在接收到所述第二目标服务器完成所有所述部署指令之后反馈的完成指令时,发送所述更新部署命令文件中的启动指令至所述第二目标服务器,确认所述分支版本文件更新至所述第二目标服务器。The update completion subunit is configured to send the start instruction in the update deployment command file to the second target server when receiving the completion instruction fed back after the second target server completes all the deployment instructions, and confirm all The branch version file is updated to the second target server.
关于基于Git的项目版本发布装置的具体限定可以参见上文中对于基于Git的项目版本发布方法的限定,在此不再赘述。上述基于Git的项目版本发布装置中的各个模块可全部 或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。For the specific limitation of the Git-based project version release device, please refer to the above limitation on the Git-based project version release method, which will not be repeated here. Each module in the Git-based project version release device can be implemented in whole or in part by software, hardware, and a combination thereof. The above-mentioned modules may be embedded in the form of hardware or independent of the processor in the computer equipment, or may be stored in the memory of the computer equipment in the form of software, so that the processor can call and execute the operations corresponding to the above-mentioned modules.
在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图可以如图10所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种基于Git的项目版本发布方法。In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. 10. The computer equipment includes a processor, a memory, a network interface, and a database connected through a system bus. Among them, the processor of the computer device is used to provide calculation and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. The computer program is executed by the processor to implement a Git-based project version release method.
在一个实施例中,提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行计算机程序时实现上述实施例中基于Git的项目版本发布方法。In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor. When the processor executes the computer program, the Git-based project version in the above-mentioned embodiment is implemented. Publishing method.
在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现上述实施例中基于Git的项目版本发布方法。可选的,本申请涉及的存储介质如计算机可读存储介质可以是非易失性的,也可以是易失性的。In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the Git-based project version publishing method in the foregoing embodiment is implemented. Optionally, the storage medium involved in this application, such as a computer-readable storage medium, may be non-volatile or volatile.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage. In the medium, when the computer program is executed, it may include the processes of the above-mentioned method embodiments. Wherein, any reference to memory, storage, database, or other media used in the embodiments provided in this application may include non-volatile and/or volatile memory. Non-volatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not a limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Channel (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。Those skilled in the art can clearly understand that, for the convenience and conciseness of description, only the division of the above functional units and modules is used as an example. In practical applications, the above functions can be allocated to different functional units and modules as needed. Module completion, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above.
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The above-mentioned embodiments are only used to illustrate the technical solutions of the present application, not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, a person of ordinary skill in the art should understand that it can still implement the foregoing The technical solutions recorded in the examples are modified, or some of the technical features are equivalently replaced; these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the application, and should be included in Within the scope of protection of this application.

Claims (20)

  1. 一种基于Git的项目版本发布方法,其中,包括:A Git-based project version release method, which includes:
    接收到项目版本创建发布指令,获取创建发布文件包;所述创建发布文件包中包括相互关联的初始版本号、初始版本文件和初始部署作业文件;所述初始版本文件包括初始代码文件和初始配置文件;所述初始部署作业文件中包含第一IP地址集合和初始部署命令文件;The project version creation release instruction is received, and the creation release file package is obtained; the creation release file package includes an initial version number, an initial version file, and an initial deployment job file associated with each other; the initial version file includes an initial code file and an initial configuration File; the initial deployment job file includes a first IP address set and an initial deployment command file;
    将所述初始版本文件存储至Git本地仓库,同时将所述初始版本文件推送至Git中央仓库;Store the initial version file in the Git local warehouse, and push the initial version file to the Git central warehouse at the same time;
    向所有与所述第一IP地址集合中的第一IP地址匹配的第一目标服务器发送含有所述初始版本号的版本初始指令;Sending a version initial instruction containing the initial version number to all first target servers that match the first IP address in the first IP address set;
    接收到所述第一目标服务器针对所述版本初始指令反馈的包含所述初始版本号的第一拉取指令之后,通过所述Git中央仓库,按照第一传输方式向所述第一目标服务器传输与所述第一拉取指令中包含的所述初始版本号关联的所述初始版本文件;所述第一传输方式为将与所述第一拉取指令中包含的所述初始版本号关联的所述初始版本文件直接传输至所述第一目标服务器;After receiving the first pull instruction that includes the initial version number that is fed back by the first target server for the version initial instruction, the Git central warehouse transmits it to the first target server according to the first transmission method The initial version file associated with the initial version number included in the first pull instruction; the first transmission method is to associate with the initial version number included in the first pull instruction The initial version file is directly transmitted to the first target server;
    根据所述初始部署命令文件,与所述第一目标服务器通过非交互式对话方式将所述初始版本文件安装至所述第一目标服务器;According to the initial deployment command file, install the initial version file to the first target server through a non-interactive dialogue with the first target server;
    接收到所有已反馈所述第一拉取指令的所述第一目标服务器发送的安装成功指令之后,确定所述创建发布文件包发布成功。After receiving all installation success instructions sent by the first target server that has fed back the first pull instruction, it is determined that the creation and release file package is successfully released.
  2. 如权利要求1所述的基于Git的项目版本发布方法,其中,所述确定所述创建发布文件包发布成功之后,包括:The Git-based project version release method of claim 1, wherein after the determining that the creation and release file package is successfully released, it comprises:
    接收到项目版本更新发布指令,获取更新发布文件包;所述更新发布文件包中包括相互关联的更新版本号、分支版本文件和更新部署文件;所述分支版本文件包括更新代码文件和更新配置文件;所述更新部署文件中包含第二IP地址集合和更新部署命令文件;The project version update release instruction is received, and the update release file package is obtained; the update release file package includes an associated update version number, a branch version file, and an update deployment file; the branch version file includes an update code file and an update configuration file ; The update deployment file includes a second IP address set and an update deployment command file;
    将所述分支版本文件存储至所述Git本地仓库,同时将所述分支版本文件推送至所述Git中央仓库;Storing the branch version file in the Git local warehouse, and at the same time pushing the branch version file to the Git central warehouse;
    向所有与所述第二IP地址集合中的第二IP地址匹配的第二目标服务器发送含有所述分支版本号的版本更新指令;Sending a version update instruction containing the branch version number to all second target servers that match the second IP address in the second IP address set;
    接收到所述第二目标服务器针对所述版本更新指令反馈的包含所述分支版本号的第二拉取指令之后,通过所述Git中央仓库,按照第二传输方式向所述第二目标服务器传输与所述第二目标服务器对应的差异文件;所述第二传输方式为根据所述第二拉取指令中与所述分支版本号关联的本地Git文件,确定与所述第二目标服务器对应的差异文件,并将与所述第二目标服务器对应的差异文件传输至所述第二目标服务器;After receiving the second pull instruction containing the branch version number that the second target server returns for the version update instruction, the Git central warehouse transmits it to the second target server in the second transmission mode The difference file corresponding to the second target server; the second transmission method is to determine the file corresponding to the second target server according to the local Git file associated with the branch version number in the second pull instruction A difference file, and transmitting the difference file corresponding to the second target server to the second target server;
    根据所述更新部署命令文件,与所述第二目标服务器通过非交互式对话方式将接收到的所述分支版本文件更新至所述第二目标服务器;According to the update deployment command file, update the received branch version file to the second target server through a non-interactive dialogue with the second target server;
    接收到所有已反馈所述第二拉取指令的所述第二目标服务器发送的更新成功指令之后,确定所述更新发布文件包发布成功。After receiving all the update success instructions sent by the second target server that has fed back the second pull instruction, it is determined that the update release file package is successfully released.
  3. 如权利要求2所述的基于Git的项目版本发布方法,其中,所述确定所述更新发布文件包发布成功之后,包括:3. The Git-based project version release method of claim 2, wherein, after determining that the update release file package is successfully released, the method comprises:
    接收到项目版本回滚发布指令,获取回滚发布文件包;所述回滚发布文件包中包括回滚版本号和回滚部署作业文件;所述回滚部署作业文件包含第三IP地址集合和回滚部署命令文件;The project version rollback release instruction is received, and the rollback release file package is obtained; the rollback release file package includes the rollback version number and the rollback deployment job file; the rollback deployment job file contains the third IP address set and Roll back the deployment command file;
    自所述Git本地仓库中查询并获取与所述回滚版本号一致的版本号关联的版本文件;Query and obtain the version file associated with the version number consistent with the rollback version number from the local Git warehouse;
    将与所述回滚版本号一致的版本号关联的版本文件推送至所述Git中央仓库;Push the version file associated with the version number consistent with the rollback version number to the Git central warehouse;
    向所有与所述第三IP地址集合中的第三IP地址匹配的第三目标服务器发送含有所述回滚版本号的版本回滚指令;Sending a version rollback instruction containing the rollback version number to all third target servers that match the third IP address in the third IP address set;
    接收到所述第三目标服务器针对所述版本回滚指令反馈的包含有所述回滚版本号的第三拉取指令之后,通过所述Git中央仓库,按照第三传输方式向所述第三目标服务器传输与所述第三目标服务器对应的差异文件;所述第三传输方式还为根据所述第三拉取指令中与所述回滚版本号关联的本地Git文件,确定与所述第三目标服务器对应的差异文件,并将与所述第三目标服务器对应的差异文件传输至所述第三目标服务器;After receiving the third pull instruction that contains the rollback version number that is fed back by the third target server for the version rollback instruction, the Git central warehouse uses the third transmission method to send the third pull instruction. The target server transmits the difference file corresponding to the third target server; the third transmission method is also to determine the difference file with the Three difference files corresponding to the target server, and transmitting the difference file corresponding to the third target server to the third target server;
    根据所述回滚部署命令文件,与所述第三目标服务器通过非交互式对话方式将所述版本文件回滚至所述第三目标服务器;According to the rollback deployment command file, roll back the version file to the third target server through a non-interactive dialogue with the third target server;
    接收到所有已反馈所述第三拉取指令的所述第三目标服务器发送的回滚成功指令之后,确定所述回滚发布文件包发布成功。After receiving all the rollback success instructions sent by the third target server that has fed back the third pull instruction, it is determined that the rollback release file package is successfully released.
  4. 如权利要求1所述的基于Git的项目版本发布方法,其中,所述通过所述Git中央仓库,按照第一传输方式向所述第一目标服务器传输与所述第一拉取指令中包含的所述初始版本号关联的所述初始版本文件,包括:The Git-based project version release method of claim 1, wherein the Git central warehouse transmits the data contained in the first pull instruction to the first target server in a first transmission mode. The initial version file associated with the initial version number includes:
    通过所述Git中央仓库向所述第一目标服务器传输所述初始版本文件;Transmitting the initial version file to the first target server through the Git central warehouse;
    接收到所述第一目标服务器创建与所述初始版本号关联的本地Git文件之后反馈的创建成功指令。The creation success instruction fed back after the first target server creates the local Git file associated with the initial version number is received.
  5. 如权利要求2所述的基于Git的项目版本发布方法,其中,所述接收到所述第二目标服务器反馈的包含所述分支版本号的第二拉取指令之后,通过所述Git中央仓库,按照第二传输方式向所述第二目标服务器传输与所述第二目标服务器对应的差异文件,包括:The Git-based project version release method according to claim 2, wherein after receiving the second pull instruction that contains the branch version number fed back by the second target server, the Git central warehouse is used, The transmission of the difference file corresponding to the second target server to the second target server according to the second transmission mode includes:
    接收到所述第二目标服务器根据所述分支版本号而确定与所述分支版本相关的本地Git文件之后发送的所述第二拉取指令;Receiving the second pull instruction sent after the second target server determines the local Git file related to the branch version according to the branch version number;
    通过所述Git中央仓库中的Git工具对所述本地Git文件与所述分支版本文件进行比对,得出与所述第二目标服务器对应的差异文件;Comparing the local Git file with the branch version file by using the Git tool in the Git central warehouse to obtain a difference file corresponding to the second target server;
    通过所述Git中央仓库将所述第二目标服务器对应的差异文件传输至所述第二目标服务器之后,接收到所述第二目标服务器更新所述初始版本号关联的本地Git文件之后反馈的更新成功指令。After the difference file corresponding to the second target server is transmitted to the second target server through the Git central warehouse, the update fed back after the second target server updates the local Git file associated with the initial version number is received Successful instruction.
  6. 如权利要求2所述的基于Git的项目版本发布方法,其中,所述根据所述更新部署命令文件,与所述第二目标服务器通过非交互式对话方式将接收到的所述分支版本文件更新至所述第二目标服务器,包括:The Git-based project version release method according to claim 2, wherein, according to the update deployment command file, the received branch version file is updated through a non-interactive dialogue with the second target server To the second target server, including:
    接收到所述第二目标服务器接收所述分支版本文件完成之后发出的传输完成指令,发送所述更新部署命令文件中的停止指令和部署指令至所述第二目标服务器;Receiving the transmission completion instruction issued by the second target server after the branch version file is completed, and sending the stop instruction and the deployment instruction in the update deployment command file to the second target server;
    在接收到所述第二目标服务器在执行所述停止指令和所述部署指令过程中反馈的异常指令时,自所述更新部署命令文件中查找与所述异常指令匹配的修复指令,并将所述修复指令发送至所述第二目标服务器以完成更新过程,直至接收到所述第二目标服务器反馈的完成指令;When receiving the abnormal instruction fed back by the second target server during the execution of the stop instruction and the deployment instruction, it searches for a repair instruction matching the abnormal instruction from the update deployment command file, and restores all the instructions. The repair instruction is sent to the second target server to complete the update process until the completion instruction fed back by the second target server is received;
    在接收到所述第二目标服务器完成所有所述部署指令之后反馈的完成指令时,发送所述更新部署命令文件中的启动指令至所述第二目标服务器,确认所述分支版本文件更新至所述第二目标服务器。Upon receiving the completion instruction fed back after the second target server completes all the deployment instructions, send the start instruction in the update deployment command file to the second target server to confirm that the branch version file is updated to all The second target server.
  7. 一种基于Git的项目版本发布装置,其中,包括:A Git-based project version release device, which includes:
    接收模块,用于接收到项目版本创建发布指令,获取创建发布文件包;所述创建发布文件包中包括相互关联的初始版本号、初始版本文件和初始部署作业文件;所述初始版本文件包括初始代码文件和初始配置文件;所述初始部署作业文件中包含第一IP地址集合和初始部署命令文件;The receiving module is used to receive the project version creation release instruction and obtain the creation release file package; the creation release file package includes the initial version number, the initial version file, and the initial deployment job file related to each other; the initial version file includes the initial A code file and an initial configuration file; the initial deployment job file includes a first IP address set and an initial deployment command file;
    存储模块,用于将所述初始版本文件存储至Git本地仓库,同时将所述初始版本文件推送至Git中央仓库;The storage module is used to store the initial version file to the Git local warehouse, and at the same time push the initial version file to the Git central warehouse;
    发送模块,用于向所有与所述第一IP地址集合中的第一IP地址匹配的第一目标服务器发送含有所述初始版本号的版本初始指令;A sending module, configured to send a version initial instruction containing the initial version number to all first target servers that match the first IP address in the first IP address set;
    传输模块,用于接收到所述第一目标服务器针对所述版本初始指令反馈的包含所述初始版本号的第一拉取指令之后,通过所述Git中央仓库,按照第一传输方式向所述第一目标服务器传输与所述第一拉取指令中包含的所述初始版本号关联的所述初始版本文件;所述第一传输方式为将与所述第一拉取指令中包含的所述初始版本号关联的所述初始版本文件直接传输至所述第一目标服务器;The transmission module is configured to, after receiving the first pull instruction that includes the initial version number fed back by the first target server for the initial instruction of the version, use the Git central warehouse to send the first transmission method to the The first target server transmits the initial version file associated with the initial version number included in the first pull instruction; the first transmission method is to combine with the initial version number included in the first pull instruction The initial version file associated with the initial version number is directly transmitted to the first target server;
    安装模块,用于根据所述初始部署命令文件,与所述第一目标服务器通过非交互式对话方式将所述初始版本文件安装至所述第一目标服务器;An installation module, configured to install the initial version file to the first target server through a non-interactive dialogue with the first target server according to the initial deployment command file;
    确定模块,用于接收到所有已反馈所述第一拉取指令的所述第一目标服务器发送的安装成功指令之后,确定所述创建发布文件包发布成功。The determining module is configured to determine that the creation and release file package is successfully released after receiving all installation success instructions sent by the first target server that has fed back the first pull instruction.
  8. 如权利要求7所述的基于Git的项目版本发布装置,其特征在于,包括:The Git-based project version publishing device according to claim 7, characterized in that it comprises:
    接收单元,用于接收到项目版本更新发布指令,获取更新发布文件包;所述更新发布文件包中包括相互关联的更新版本号、分支版本文件和更新部署文件;所述分支版本文件包括更新代码文件和更新配置文件;所述更新部署文件中包含第二IP地址集合和更新部署命令文件;The receiving unit is configured to receive the project version update release instruction and obtain the update release file package; the update release file package includes the associated update version number, the branch version file, and the update deployment file; the branch version file includes the update code File and an update configuration file; the update deployment file includes a second IP address set and an update deployment command file;
    存储单元,用于将所述分支版本文件存储至所述Git本地仓库,同时将所述分支版本文件推送至所述Git中央仓库;The storage unit is configured to store the branch version file in the Git local warehouse, and at the same time push the branch version file to the Git central warehouse;
    发送单元,用于向所有与所述第二IP地址集合中的第二IP地址匹配的第二目标服务器发送含有所述分支版本号的版本更新指令;A sending unit, configured to send a version update instruction containing the branch version number to all second target servers that match the second IP address in the second IP address set;
    传输单元,用于接收到所述第二目标服务器针对所述版本更新指令反馈的包含所述分支版本号的第二拉取指令之后,通过所述Git中央仓库,按照第二传输方式向所述第二目标服务器传输与所述第二目标服务器对应的差异文件;所述第二传输方式为根据所述第二拉取指令中与所述分支版本号关联的本地Git文件,确定与所述第二目标服务器对应的差异文件,并将与所述第二目标服务器对应的差异文件传输至所述第二目标服务器;The transmission unit is configured to, after receiving the second pull instruction including the branch version number fed back by the second target server for the version update instruction, to the Git central warehouse according to the second transmission method The second target server transmits the difference file corresponding to the second target server; the second transmission method is based on the local Git file associated with the branch version number in the second pull instruction to determine the difference file with the first 2. a difference file corresponding to the target server, and transmitting the difference file corresponding to the second target server to the second target server;
    更新单元,用于根据所述更新部署命令文件,与所述第二目标服务器通过非交互式对话方式将接收到的所述分支版本文件更新至所述第二目标服务器;The update unit is configured to update the received branch version file to the second target server through non-interactive dialogue with the second target server according to the update deployment command file;
    确定单元,用于接收到所有已反馈所述第二拉取指令的所述第二目标服务器发送的更新成功指令之后,确定所述更新发布文件包发布成功。The determining unit is configured to determine that the update release file package is successfully released after receiving all the update success instructions sent by the second target server that has fed back the second pull instruction.
  9. 一种计算机设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其中,所述处理器执行所述计算机程序时实现以下步骤:A computer device includes a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the following steps when the processor executes the computer program:
    接收到项目版本创建发布指令,获取创建发布文件包;所述创建发布文件包中包括相互关联的初始版本号、初始版本文件和初始部署作业文件;所述初始版本文件包括初始代码文件和初始配置文件;所述初始部署作业文件中包含第一IP地址集合和初始部署命令文件;The project version creation release instruction is received, and the creation release file package is obtained; the creation release file package includes an initial version number, an initial version file, and an initial deployment job file associated with each other; the initial version file includes an initial code file and an initial configuration File; the initial deployment job file includes a first IP address set and an initial deployment command file;
    将所述初始版本文件存储至Git本地仓库,同时将所述初始版本文件推送至Git中央仓库;Store the initial version file in the Git local warehouse, and push the initial version file to the Git central warehouse at the same time;
    向所有与所述第一IP地址集合中的第一IP地址匹配的第一目标服务器发送含有所述初始版本号的版本初始指令;Sending a version initial instruction containing the initial version number to all first target servers that match the first IP address in the first IP address set;
    接收到所述第一目标服务器针对所述版本初始指令反馈的包含所述初始版本号的第一拉取指令之后,通过所述Git中央仓库,按照第一传输方式向所述第一目标服务器传输与所述第一拉取指令中包含的所述初始版本号关联的所述初始版本文件;所述第一传输方式 为将与所述第一拉取指令中包含的所述初始版本号关联的所述初始版本文件直接传输至所述第一目标服务器;After receiving the first pull instruction that includes the initial version number that is fed back by the first target server for the version initial instruction, the Git central warehouse transmits it to the first target server according to the first transmission method The initial version file associated with the initial version number included in the first pull instruction; the first transmission method is to associate with the initial version number included in the first pull instruction The initial version file is directly transmitted to the first target server;
    根据所述初始部署命令文件,与所述第一目标服务器通过非交互式对话方式将所述初始版本文件安装至所述第一目标服务器;According to the initial deployment command file, install the initial version file to the first target server through a non-interactive dialogue with the first target server;
    接收到所有已反馈所述第一拉取指令的所述第一目标服务器发送的安装成功指令之后,确定所述创建发布文件包发布成功。After receiving all installation success instructions sent by the first target server that has fed back the first pull instruction, it is determined that the creation and release file package is successfully released.
  10. 如权利要求9所述的计算机设备,其中,所述确定所述创建发布文件包发布成功之后,所述处理器执行所述计算机程序时还实现以下步骤:9. The computer device according to claim 9, wherein, after said determining that the creation and release file package is successfully released, the processor further implements the following steps when executing the computer program:
    接收到项目版本更新发布指令,获取更新发布文件包;所述更新发布文件包中包括相互关联的更新版本号、分支版本文件和更新部署文件;所述分支版本文件包括更新代码文件和更新配置文件;所述更新部署文件中包含第二IP地址集合和更新部署命令文件;The project version update release instruction is received, and the update release file package is obtained; the update release file package includes an associated update version number, a branch version file, and an update deployment file; the branch version file includes an update code file and an update configuration file ; The update deployment file includes a second IP address set and an update deployment command file;
    将所述分支版本文件存储至所述Git本地仓库,同时将所述分支版本文件推送至所述Git中央仓库;Storing the branch version file in the Git local warehouse, and at the same time pushing the branch version file to the Git central warehouse;
    向所有与所述第二IP地址集合中的第二IP地址匹配的第二目标服务器发送含有所述分支版本号的版本更新指令;Sending a version update instruction containing the branch version number to all second target servers that match the second IP address in the second IP address set;
    接收到所述第二目标服务器针对所述版本更新指令反馈的包含所述分支版本号的第二拉取指令之后,通过所述Git中央仓库,按照第二传输方式向所述第二目标服务器传输与所述第二目标服务器对应的差异文件;所述第二传输方式为根据所述第二拉取指令中与所述分支版本号关联的本地Git文件,确定与所述第二目标服务器对应的差异文件,并将与所述第二目标服务器对应的差异文件传输至所述第二目标服务器;After receiving the second pull instruction that contains the branch version number that is fed back by the second target server for the version update instruction, the Git central warehouse transmits it to the second target server in the second transmission mode The difference file corresponding to the second target server; the second transmission method is to determine the file corresponding to the second target server according to the local Git file associated with the branch version number in the second pull instruction A difference file, and transmitting the difference file corresponding to the second target server to the second target server;
    根据所述更新部署命令文件,与所述第二目标服务器通过非交互式对话方式将接收到的所述分支版本文件更新至所述第二目标服务器;According to the update deployment command file, update the received branch version file to the second target server through a non-interactive dialogue with the second target server;
    接收到所有已反馈所述第二拉取指令的所述第二目标服务器发送的更新成功指令之后,确定所述更新发布文件包发布成功。After receiving all the update success instructions sent by the second target server that has fed back the second pull instruction, it is determined that the update release file package is successfully released.
  11. 如权利要求10所述的计算机设备,其中,所述确定所述更新发布文件包发布成功之后,所述处理器执行所述计算机程序时还实现以下步骤:10. The computer device according to claim 10, wherein after said determining that the update release file package is successfully released, the processor further implements the following steps when executing the computer program:
    接收到项目版本回滚发布指令,获取回滚发布文件包;所述回滚发布文件包中包括回滚版本号和回滚部署作业文件;所述回滚部署作业文件包含第三IP地址集合和回滚部署命令文件;The project version rollback release instruction is received, and the rollback release file package is obtained; the rollback release file package includes the rollback version number and the rollback deployment job file; the rollback deployment job file contains the third IP address set and Roll back the deployment command file;
    自所述Git本地仓库中查询并获取与所述回滚版本号一致的版本号关联的版本文件;Query and obtain the version file associated with the version number consistent with the rollback version number from the local Git warehouse;
    将与所述回滚版本号一致的版本号关联的版本文件推送至所述Git中央仓库;Push the version file associated with the version number consistent with the rollback version number to the Git central warehouse;
    向所有与所述第三IP地址集合中的第三IP地址匹配的第三目标服务器发送含有所述回滚版本号的版本回滚指令;Sending a version rollback instruction containing the rollback version number to all third target servers that match the third IP address in the third IP address set;
    接收到所述第三目标服务器针对所述版本回滚指令反馈的包含有所述回滚版本号的第三拉取指令之后,通过所述Git中央仓库,按照第三传输方式向所述第三目标服务器传输与所述第三目标服务器对应的差异文件;所述第三传输方式还为根据所述第三拉取指令中与所述回滚版本号关联的本地Git文件,确定与所述第三目标服务器对应的差异文件,并将与所述第三目标服务器对应的差异文件传输至所述第三目标服务器;After receiving the third pull instruction that contains the rollback version number that is fed back by the third target server for the version rollback instruction, the Git central warehouse uses the third transmission method to send the third pull instruction. The target server transmits the difference file corresponding to the third target server; the third transmission method is also to determine the difference file corresponding to the first Three difference files corresponding to the target server, and transmitting the difference file corresponding to the third target server to the third target server;
    根据所述回滚部署命令文件,与所述第三目标服务器通过非交互式对话方式将所述版本文件回滚至所述第三目标服务器;According to the rollback deployment command file, roll back the version file to the third target server through a non-interactive dialogue with the third target server;
    接收到所有已反馈所述第三拉取指令的所述第三目标服务器发送的回滚成功指令之后,确定所述回滚发布文件包发布成功。After receiving all the rollback success instructions sent by the third target server that has fed back the third pull instruction, it is determined that the rollback release file package is successfully released.
  12. 如权利要求9所述的计算机设备,其中,所述通过所述Git中央仓库,按照第一传输方式向所述第一目标服务器传输与所述第一拉取指令中包含的所述初始版本号关联的所 述初始版本文件时,具体实现以下步骤:9. The computer device according to claim 9, wherein the initial version number contained in the first pull instruction is transmitted to the first target server through the Git central warehouse in a first transmission manner When associating the initial version file, the following steps are specifically implemented:
    通过所述Git中央仓库向所述第一目标服务器传输所述初始版本文件;Transmitting the initial version file to the first target server through the Git central warehouse;
    接收到所述第一目标服务器创建与所述初始版本号关联的本地Git文件之后反馈的创建成功指令。The creation success instruction fed back after the first target server creates the local Git file associated with the initial version number is received.
  13. 如权利要求10所述的计算机设备,其中,所述接收到所述第二目标服务器反馈的包含所述分支版本号的第二拉取指令之后,通过所述Git中央仓库,按照第二传输方式向所述第二目标服务器传输与所述第二目标服务器对应的差异文件时,具体实现以下步骤:The computer device according to claim 10, wherein after receiving the second pull instruction containing the branch version number fed back by the second target server, the Git central warehouse is used to perform the second transmission method When transmitting the difference file corresponding to the second target server to the second target server, the following steps are specifically implemented:
    接收到所述第二目标服务器根据所述分支版本号而确定与所述分支版本相关的本地Git文件之后发送的所述第二拉取指令;Receiving the second pull instruction sent after the second target server determines the local Git file related to the branch version according to the branch version number;
    通过所述Git中央仓库中的Git工具对所述本地Git文件与所述分支版本文件进行比对,得出与所述第二目标服务器对应的差异文件;Comparing the local Git file with the branch version file by using the Git tool in the Git central warehouse to obtain a difference file corresponding to the second target server;
    通过所述Git中央仓库将所述第二目标服务器对应的差异文件传输至所述第二目标服务器之后,接收到所述第二目标服务器更新所述初始版本号关联的本地Git文件之后反馈的更新成功指令。After the difference file corresponding to the second target server is transmitted to the second target server through the Git central warehouse, the update fed back after the second target server updates the local Git file associated with the initial version number is received Successful instruction.
  14. 如权利要求10所述的计算机设备,其中,所述根据所述更新部署命令文件,与所述第二目标服务器通过非交互式对话方式将接收到的所述分支版本文件更新至所述第二目标服务器时,具体实现以下步骤:The computer device according to claim 10, wherein, according to the update deployment command file, the received branch version file is updated to the second target server through non-interactive dialogue with the second target server. For the target server, implement the following steps:
    接收到所述第二目标服务器接收所述分支版本文件完成之后发出的传输完成指令,发送所述更新部署命令文件中的停止指令和部署指令至所述第二目标服务器;Receiving the transmission completion instruction issued by the second target server after the branch version file is completed, and sending the stop instruction and the deployment instruction in the update deployment command file to the second target server;
    在接收到所述第二目标服务器在执行所述停止指令和所述部署指令过程中反馈的异常指令时,自所述更新部署命令文件中查找与所述异常指令匹配的修复指令,并将所述修复指令发送至所述第二目标服务器以完成更新过程,直至接收到所述第二目标服务器反馈的完成指令;When receiving the abnormal instruction fed back by the second target server during the execution of the stop instruction and the deployment instruction, it searches for the repair instruction matching the abnormal instruction from the update deployment command file, and compares all the instructions. The repair instruction is sent to the second target server to complete the update process until the completion instruction fed back by the second target server is received;
    在接收到所述第二目标服务器完成所有所述部署指令之后反馈的完成指令时,发送所述更新部署命令文件中的启动指令至所述第二目标服务器,确认所述分支版本文件更新至所述第二目标服务器。Upon receiving the completion instruction fed back after the second target server completes all the deployment instructions, send the start instruction in the update deployment command file to the second target server to confirm that the branch version file is updated to all The second target server.
  15. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其中,所述计算机程序被处理器执行时实现以下步骤:A computer-readable storage medium storing a computer program, wherein the computer program is executed by a processor to implement the following steps:
    接收到项目版本创建发布指令,获取创建发布文件包;所述创建发布文件包中包括相互关联的初始版本号、初始版本文件和初始部署作业文件;所述初始版本文件包括初始代码文件和初始配置文件;所述初始部署作业文件中包含第一IP地址集合和初始部署命令文件;The project version creation release instruction is received, and the creation release file package is obtained; the creation release file package includes an initial version number, an initial version file, and an initial deployment job file associated with each other; the initial version file includes an initial code file and an initial configuration File; the initial deployment job file includes a first IP address set and an initial deployment command file;
    将所述初始版本文件存储至Git本地仓库,同时将所述初始版本文件推送至Git中央仓库;Store the initial version file in the Git local warehouse, and push the initial version file to the Git central warehouse at the same time;
    向所有与所述第一IP地址集合中的第一IP地址匹配的第一目标服务器发送含有所述初始版本号的版本初始指令;Sending a version initial instruction containing the initial version number to all first target servers that match the first IP address in the first IP address set;
    接收到所述第一目标服务器针对所述版本初始指令反馈的包含所述初始版本号的第一拉取指令之后,通过所述Git中央仓库,按照第一传输方式向所述第一目标服务器传输与所述第一拉取指令中包含的所述初始版本号关联的所述初始版本文件;所述第一传输方式为将与所述第一拉取指令中包含的所述初始版本号关联的所述初始版本文件直接传输至所述第一目标服务器;After receiving the first pull instruction that includes the initial version number that is fed back by the first target server for the version initial instruction, the Git central warehouse transmits it to the first target server in the first transmission mode The initial version file associated with the initial version number included in the first pull instruction; the first transmission mode is to associate with the initial version number included in the first pull instruction The initial version file is directly transmitted to the first target server;
    根据所述初始部署命令文件,与所述第一目标服务器通过非交互式对话方式将所述初始版本文件安装至所述第一目标服务器;According to the initial deployment command file, install the initial version file to the first target server through a non-interactive dialogue with the first target server;
    接收到所有已反馈所述第一拉取指令的所述第一目标服务器发送的安装成功指令之后, 确定所述创建发布文件包发布成功。After receiving all installation success instructions sent by the first target server that has fed back the first pull instruction, it is determined that the creation and release file package is successfully released.
  16. 如权利要求15所述的计算机可读存储介质,其中,所述确定所述创建发布文件包发布成功之后,所述计算机程序被处理器执行时还实现以下步骤:15. The computer-readable storage medium according to claim 15, wherein, after it is determined that the creation and release file package is successfully released, the following steps are further implemented when the computer program is executed by the processor:
    接收到项目版本更新发布指令,获取更新发布文件包;所述更新发布文件包中包括相互关联的更新版本号、分支版本文件和更新部署文件;所述分支版本文件包括更新代码文件和更新配置文件;所述更新部署文件中包含第二IP地址集合和更新部署命令文件;The project version update release instruction is received, and the update release file package is obtained; the update release file package includes an associated update version number, a branch version file, and an update deployment file; the branch version file includes an update code file and an update configuration file ; The update deployment file includes a second IP address set and an update deployment command file;
    将所述分支版本文件存储至所述Git本地仓库,同时将所述分支版本文件推送至所述Git中央仓库;Storing the branch version file in the Git local warehouse, and at the same time pushing the branch version file to the Git central warehouse;
    向所有与所述第二IP地址集合中的第二IP地址匹配的第二目标服务器发送含有所述分支版本号的版本更新指令;Sending a version update instruction containing the branch version number to all second target servers that match the second IP address in the second IP address set;
    接收到所述第二目标服务器针对所述版本更新指令反馈的包含所述分支版本号的第二拉取指令之后,通过所述Git中央仓库,按照第二传输方式向所述第二目标服务器传输与所述第二目标服务器对应的差异文件;所述第二传输方式为根据所述第二拉取指令中与所述分支版本号关联的本地Git文件,确定与所述第二目标服务器对应的差异文件,并将与所述第二目标服务器对应的差异文件传输至所述第二目标服务器;After receiving the second pull instruction that contains the branch version number that is fed back by the second target server for the version update instruction, the Git central warehouse transmits it to the second target server in the second transmission mode The difference file corresponding to the second target server; the second transmission method is to determine the file corresponding to the second target server according to the local Git file associated with the branch version number in the second pull instruction A difference file, and transmitting the difference file corresponding to the second target server to the second target server;
    根据所述更新部署命令文件,与所述第二目标服务器通过非交互式对话方式将接收到的所述分支版本文件更新至所述第二目标服务器;According to the update deployment command file, update the received branch version file to the second target server through a non-interactive dialogue with the second target server;
    接收到所有已反馈所述第二拉取指令的所述第二目标服务器发送的更新成功指令之后,确定所述更新发布文件包发布成功。After receiving all the update success instructions sent by the second target server that has fed back the second pull instruction, it is determined that the update release file package is successfully released.
  17. 如权利要求16所述的计算机可读存储介质,其中,所述确定所述更新发布文件包发布成功之后,所述计算机程序被处理器执行时还实现以下步骤:16. The computer-readable storage medium according to claim 16, wherein, after said determining that the update release file package is successfully released, the following steps are further implemented when the computer program is executed by the processor:
    接收到项目版本回滚发布指令,获取回滚发布文件包;所述回滚发布文件包中包括回滚版本号和回滚部署作业文件;所述回滚部署作业文件包含第三IP地址集合和回滚部署命令文件;The project version rollback release instruction is received, and the rollback release file package is obtained; the rollback release file package includes the rollback version number and the rollback deployment job file; the rollback deployment job file contains the third IP address set and Roll back the deployment command file;
    自所述Git本地仓库中查询并获取与所述回滚版本号一致的版本号关联的版本文件;Query and obtain the version file associated with the version number consistent with the rollback version number from the local Git warehouse;
    将与所述回滚版本号一致的版本号关联的版本文件推送至所述Git中央仓库;Push the version file associated with the version number consistent with the rollback version number to the Git central warehouse;
    向所有与所述第三IP地址集合中的第三IP地址匹配的第三目标服务器发送含有所述回滚版本号的版本回滚指令;Sending a version rollback instruction containing the rollback version number to all third target servers that match the third IP address in the third IP address set;
    接收到所述第三目标服务器针对所述版本回滚指令反馈的包含有所述回滚版本号的第三拉取指令之后,通过所述Git中央仓库,按照第三传输方式向所述第三目标服务器传输与所述第三目标服务器对应的差异文件;所述第三传输方式还为根据所述第三拉取指令中与所述回滚版本号关联的本地Git文件,确定与所述第三目标服务器对应的差异文件,并将与所述第三目标服务器对应的差异文件传输至所述第三目标服务器;After receiving the third pull instruction that contains the rollback version number that is fed back by the third target server for the version rollback instruction, the Git central warehouse uses the third transmission method to send the third pull instruction. The target server transmits the difference file corresponding to the third target server; the third transmission method is also to determine the difference file corresponding to the first Three difference files corresponding to the target server, and transmitting the difference file corresponding to the third target server to the third target server;
    根据所述回滚部署命令文件,与所述第三目标服务器通过非交互式对话方式将所述版本文件回滚至所述第三目标服务器;According to the rollback deployment command file, roll back the version file to the third target server through a non-interactive dialogue with the third target server;
    接收到所有已反馈所述第三拉取指令的所述第三目标服务器发送的回滚成功指令之后,确定所述回滚发布文件包发布成功。After receiving all the rollback success instructions sent by the third target server that has fed back the third pull instruction, it is determined that the rollback release file package is successfully released.
  18. 如权利要求15所述的计算机可读存储介质,其中,所述通过所述Git中央仓库,按照第一传输方式向所述第一目标服务器传输与所述第一拉取指令中包含的所述初始版本号关联的所述初始版本文件时,具体实现以下步骤:15. The computer-readable storage medium according to claim 15, wherein the Git central warehouse transmits the data contained in the first pull instruction to the first target server in a first transmission mode. When the initial version file is associated with the initial version number, the following steps are specifically implemented:
    通过所述Git中央仓库向所述第一目标服务器传输所述初始版本文件;Transmitting the initial version file to the first target server through the Git central warehouse;
    接收到所述第一目标服务器创建与所述初始版本号关联的本地Git文件之后反馈的创建成功指令。The creation success instruction fed back after the first target server creates the local Git file associated with the initial version number is received.
  19. 如权利要求16所述的计算机可读存储介质,其中,所述接收到所述第二目标服务 器反馈的包含所述分支版本号的第二拉取指令之后,通过所述Git中央仓库,按照第二传输方式向所述第二目标服务器传输与所述第二目标服务器对应的差异文件时,具体实现以下步骤:16. The computer-readable storage medium according to claim 16, wherein after receiving the second pull instruction containing the branch version number fed back by the second target server, the Git central warehouse is used to follow the When the difference file corresponding to the second target server is transmitted to the second target server in the second transmission mode, the following steps are specifically implemented:
    接收到所述第二目标服务器根据所述分支版本号而确定与所述分支版本相关的本地Git文件之后发送的所述第二拉取指令;Receiving the second pull instruction sent after the second target server determines the local Git file related to the branch version according to the branch version number;
    通过所述Git中央仓库中的Git工具对所述本地Git文件与所述分支版本文件进行比对,得出与所述第二目标服务器对应的差异文件;Comparing the local Git file with the branch version file by using the Git tool in the Git central warehouse to obtain a difference file corresponding to the second target server;
    通过所述Git中央仓库将所述第二目标服务器对应的差异文件传输至所述第二目标服务器之后,接收到所述第二目标服务器更新所述初始版本号关联的本地Git文件之后反馈的更新成功指令。After the difference file corresponding to the second target server is transmitted to the second target server through the Git central warehouse, the update fed back after the second target server updates the local Git file associated with the initial version number is received Successful instruction.
  20. 如权利要求16所述的计算机可读存储介质,其中,所述根据所述更新部署命令文件,与所述第二目标服务器通过非交互式对话方式将接收到的所述分支版本文件更新至所述第二目标服务器时,具体实现以下步骤:16. The computer-readable storage medium according to claim 16, wherein, according to the update deployment command file, the received branch version file is updated to all the branch version files through a non-interactive dialogue with the second target server. When describing the second target server, the following steps are specifically implemented:
    接收到所述第二目标服务器接收所述分支版本文件完成之后发出的传输完成指令,发送所述更新部署命令文件中的停止指令和部署指令至所述第二目标服务器;Receiving the transmission completion instruction issued by the second target server after the branch version file is completed, and sending the stop instruction and the deployment instruction in the update deployment command file to the second target server;
    在接收到所述第二目标服务器在执行所述停止指令和所述部署指令过程中反馈的异常指令时,自所述更新部署命令文件中查找与所述异常指令匹配的修复指令,并将所述修复指令发送至所述第二目标服务器以完成更新过程,直至接收到所述第二目标服务器反馈的完成指令;When receiving the abnormal instruction fed back by the second target server during the execution of the stop instruction and the deployment instruction, it searches for the repair instruction matching the abnormal instruction from the update deployment command file, and compares all the instructions. The repair instruction is sent to the second target server to complete the update process until the completion instruction fed back by the second target server is received;
    在接收到所述第二目标服务器完成所有所述部署指令之后反馈的完成指令时,发送所述更新部署命令文件中的启动指令至所述第二目标服务器,确认所述分支版本文件更新至所述第二目标服务器。Upon receiving the completion instruction fed back after the second target server completes all the deployment instructions, send the start instruction in the update deployment command file to the second target server to confirm that the branch version file is updated to all The second target server.
PCT/CN2020/099527 2020-04-30 2020-06-30 Git-based project version release method and apparatus, device, and medium WO2021217868A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010366362.8 2020-04-30
CN202010366362.8A CN111666081B (en) 2020-04-30 2020-04-30 Git-based project version release method, device, equipment and medium

Publications (1)

Publication Number Publication Date
WO2021217868A1 true WO2021217868A1 (en) 2021-11-04

Family

ID=72383134

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/099527 WO2021217868A1 (en) 2020-04-30 2020-06-30 Git-based project version release method and apparatus, device, and medium

Country Status (2)

Country Link
CN (1) CN111666081B (en)
WO (1) WO2021217868A1 (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114465887A (en) * 2021-12-23 2022-05-10 杭州溪塔科技有限公司 Method and device for block chain configuration management based on git
CN115408047A (en) * 2022-08-11 2022-11-29 北京大氪信息科技有限公司 Version release method and device and electronic equipment
CN115576573A (en) * 2022-10-26 2023-01-06 杭州谐云科技有限公司 Delivery method and system based on information creation environment
CN116192878A (en) * 2023-04-27 2023-05-30 北京微吼时代科技有限公司 Git-based configuration synchronization method and system
CN117055947A (en) * 2023-08-17 2023-11-14 广东科伺智能科技有限公司 Version control method and device of binary project file, storage medium and equipment

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112650724A (en) * 2020-12-25 2021-04-13 中国工商银行股份有限公司 Document file processing method, system, computing device and medium
CN112882747B (en) * 2021-01-29 2024-04-05 北京思特奇信息技术股份有限公司 Method and system for issuing program in interfacing mode
CN114416109B (en) * 2021-12-15 2023-01-10 广州市玄武无线科技股份有限公司 Program deployment method and device, computer device, and storage medium
CN114385759B (en) * 2022-01-13 2024-04-16 平安科技(深圳)有限公司 Configuration file synchronization method and device, computer equipment and storage medium
CN115390912B (en) * 2022-10-26 2023-03-28 深圳高灯计算机科技有限公司 Resource discovery method, device, computer equipment and storage medium
CN115795485A (en) * 2023-02-07 2023-03-14 山东可信云信息技术研究院 Method, system, equipment and storage medium for safely delivering software in trusted cloud environment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106708509A (en) * 2016-11-28 2017-05-24 上海宝尊电子商务有限公司 Automatic software project development all-link configuration management system
CN109144548A (en) * 2018-08-27 2019-01-04 杭州安恒信息技术股份有限公司 A kind of multicompartment software upgrade method, device and server realized based on git
CN109522025A (en) * 2018-10-30 2019-03-26 深圳市小赢信息技术有限责任公司 A kind of code delivery system based on git
CN109683951A (en) * 2018-12-21 2019-04-26 北京量子保科技有限公司 A kind of code method for automatically releasing, system, medium and electronic equipment
US20190227794A1 (en) * 2018-01-25 2019-07-25 Walmart Apollo, Llc Systems and methods for real time version control for integrating updated web-based components with a native application

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103067484B (en) * 2012-12-25 2015-11-18 天维尔信息科技股份有限公司 A kind of method and system of auto-update application program
CN105094851A (en) * 2015-09-06 2015-11-25 浪潮软件股份有限公司 Method for momentarily issuing codes based on Git
CN106445488A (en) * 2016-07-01 2017-02-22 厦门易名科技股份有限公司 Code release and backspacing methods
CN107404520A (en) * 2017-07-20 2017-11-28 郑州云海信息技术有限公司 A kind of management method and system based on cloud management platform
CN109725911A (en) * 2017-10-31 2019-05-07 北京国双科技有限公司 A kind of multi-environment project dispositions method, device, storage medium and processor
CN108170469B (en) * 2017-12-20 2021-06-11 南京邮电大学 Code submission history-based Git warehouse similarity detection method
CN109086071A (en) * 2018-08-22 2018-12-25 平安普惠企业管理有限公司 A kind of method and server of management software version information
CN109684203A (en) * 2018-11-27 2019-04-26 平安科技(深圳)有限公司 Program running parameter configuration method, device, computer equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106708509A (en) * 2016-11-28 2017-05-24 上海宝尊电子商务有限公司 Automatic software project development all-link configuration management system
US20190227794A1 (en) * 2018-01-25 2019-07-25 Walmart Apollo, Llc Systems and methods for real time version control for integrating updated web-based components with a native application
CN109144548A (en) * 2018-08-27 2019-01-04 杭州安恒信息技术股份有限公司 A kind of multicompartment software upgrade method, device and server realized based on git
CN109522025A (en) * 2018-10-30 2019-03-26 深圳市小赢信息技术有限责任公司 A kind of code delivery system based on git
CN109683951A (en) * 2018-12-21 2019-04-26 北京量子保科技有限公司 A kind of code method for automatically releasing, system, medium and electronic equipment

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114465887A (en) * 2021-12-23 2022-05-10 杭州溪塔科技有限公司 Method and device for block chain configuration management based on git
CN114465887B (en) * 2021-12-23 2024-01-23 杭州溪塔科技有限公司 Block chain configuration management method and device based on git
CN115408047A (en) * 2022-08-11 2022-11-29 北京大氪信息科技有限公司 Version release method and device and electronic equipment
CN115408047B (en) * 2022-08-11 2023-07-25 北京大氪信息科技有限公司 Version release method and device and electronic equipment
CN115576573A (en) * 2022-10-26 2023-01-06 杭州谐云科技有限公司 Delivery method and system based on information creation environment
CN115576573B (en) * 2022-10-26 2024-03-12 杭州谐云科技有限公司 Delivery method and system based on credit-wound environment
CN116192878A (en) * 2023-04-27 2023-05-30 北京微吼时代科技有限公司 Git-based configuration synchronization method and system
CN117055947A (en) * 2023-08-17 2023-11-14 广东科伺智能科技有限公司 Version control method and device of binary project file, storage medium and equipment

Also Published As

Publication number Publication date
CN111666081A (en) 2020-09-15
CN111666081B (en) 2024-04-05

Similar Documents

Publication Publication Date Title
WO2021217868A1 (en) Git-based project version release method and apparatus, device, and medium
US9979784B2 (en) Method for cloud data backup and recovery
KR102026225B1 (en) Apparatus for managing data using block chain and method thereof
EP3080725B1 (en) Application synchronization
TWI740901B (en) Method and device for performing data recovery operation
US9021462B2 (en) Systems and methods for provisioning equipment
WO2021217871A1 (en) Method and apparatus for deploying micro service cluster, computer device and storage medium
US9384098B1 (en) Portable data archiving device
CN103841180B (en) A kind of network data synchronizing method, apparatus, terminal device and server based on operational order
CN109460252A (en) Configuration file processing method, device and computer equipment based on git
CN111866149A (en) Cluster deployment method and device, computer equipment and storage medium
US20200153889A1 (en) Method for uploading and downloading file, and server for executing the same
CN106547602B (en) Method for manufacturing operating system mirror image suitable for iSCSI protocol remote wireless loading
CN112632375B (en) Session information processing method, server and storage medium
CN113590169A (en) Application deployment method, application deployment system, and computer-readable storage medium
CN103036933A (en) System and method for cloud scrapbook
US20210058459A1 (en) Leveraging nas protocol for efficient file transfer
CN115809096A (en) Batch self-adaptive upgrading method for operating systems
CN110943866B (en) Identification method and device of third-party equipment, computer equipment and storage medium
CN110968399B (en) Virtual machine reloading method and device and computer readable storage medium
CN109885299B (en) Template processing method, device, computer equipment and storage medium in model development
CN111596953A (en) Version management system, development data transmission control method and related device
TW201314471A (en) Cloud clipboard system and method thereof
JP6415155B2 (en) Server system, method, and program thereof
CN111666080B (en) Micro service cluster deployment method and device, computer equipment and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20933151

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20933151

Country of ref document: EP

Kind code of ref document: A1