CN108228256B - Code synchronization method, device, computer readable medium and terminal - Google Patents

Code synchronization method, device, computer readable medium and terminal Download PDF

Info

Publication number
CN108228256B
CN108228256B CN201810113571.4A CN201810113571A CN108228256B CN 108228256 B CN108228256 B CN 108228256B CN 201810113571 A CN201810113571 A CN 201810113571A CN 108228256 B CN108228256 B CN 108228256B
Authority
CN
China
Prior art keywords
code
mirror image
synchronization
target
warehouse
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810113571.4A
Other languages
Chinese (zh)
Other versions
CN108228256A (en
Inventor
黄露洋
张文明
陈少杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201810113571.4A priority Critical patent/CN108228256B/en
Publication of CN108228256A publication Critical patent/CN108228256A/en
Application granted granted Critical
Publication of CN108228256B publication Critical patent/CN108228256B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

Abstract

The invention discloses a code synchronization method, a code synchronization device, a computer readable medium and a terminal. The code synchronization method comprises the following steps: when detecting that the code in the target code warehouse is changed, receiving a remote trigger message sent by an event processing interface web hook through a remote trigger entry in a preset mirror image synchronization task; and when a remote trigger message is received, synchronizing the codes in the target code warehouse based on the mirror synchronization script in the mirror synchronization task. According to the technical scheme of the embodiment of the invention, when the code in the target code warehouse is detected to be changed, the mirror image synchronization task is realized through the remote trigger message received by the remote trigger inlet, so that the technical problems that the existing code synchronization method needs manual pushing or is poor in instantaneity and the like can be solved, and the mirror image code synchronization can be efficiently carried out in real time without manual intervention.

Description

Code synchronization method, device, computer readable medium and terminal
Technical Field
The embodiment of the invention relates to a computer application technology, in particular to a code synchronization method, a code synchronization device, a computer readable medium and a terminal.
Background
During the daily development process, there are often A, B two or more development teams in the same company developing the same project at the same time, and it is necessary to access each other's code warehouse. Since not in the same network environment, it is slow to access each other's code repositories, especially for code repositories with large volumes, which is time consuming. It is therefore common practice for team a to mirror the code repository maintained by team B on its own server and clone the code repository onto team a internal servers. The team A developer can quickly acquire the codes of the code warehouse only by accessing the internal server. Therefore, the efficiency of acquiring the code by developers is improved, and a problem is caused, namely the code acquired by the team A from the mirror image code warehouse is probably not the latest code of the team B code warehouse.
At present, two schemes are generally adopted for solving the problems, one scheme is manual processing, maintenance personnel of a B team warehouse are manually pushed to a mirror image server of an A team after being changed, the workload of the maintenance personnel of the B team warehouse is increased, the work is trivial and easy to miss, and the scheme is low in efficiency and easy to make mistakes; in another scheme, a timing synchronization task is set on the mirror image server of the team A, namely, the mirror image server of the team A automatically synchronizes codes on the server of the team B at intervals.
Disclosure of Invention
The embodiment of the invention provides a code synchronization method, a code synchronization device, a computer readable medium and a terminal, which are used for solving the technical problems that the existing code synchronization method needs manual pushing or is poor in instantaneity and the like, and can achieve the technical effect of efficiently synchronizing mirror image codes in real time without manual intervention.
In a first aspect, an embodiment of the present invention provides a code synchronization method, where the method includes:
when detecting that the code in the target code warehouse is changed, receiving a remote trigger message sent by an event processing interface web hook through a remote trigger entry in a preset mirror image synchronization task;
and when a remote trigger message is received, synchronizing the codes in the target code warehouse based on the mirror synchronization script in the mirror synchronization task.
Further, the detecting that the code in the target code repository is changed includes:
detecting a target trigger event of a target code warehouse, wherein the target trigger event comprises a submission event, a push event, a tagging event and/or a merging request event.
Optionally, the synchronizing code in the object code repository includes:
and when detecting that the local end does not have the mirror image code warehouse corresponding to the target code warehouse, synchronizing the mirror image of the target code warehouse to the local end, and generating the mirror image code warehouse corresponding to the target code warehouse.
Optionally, the synchronizing code in the object code repository includes:
and when detecting that a local end has a mirror image code warehouse corresponding to the target code warehouse, carrying out mirror image updating on codes in the mirror image code warehouse according to the codes in the target code warehouse.
Further, the code synchronization method further comprises:
and pushing the mirror image code warehouse of the local end to a code hosting server.
Further, the code synchronization method further comprises:
constructing a mirror image synchronization task based on a software continuous integration tool Jenkins;
and configuring a remote trigger inlet in the mirror image synchronization task, and adding a mirror image synchronization script in the mirror image synchronization task.
Optionally, the configuring a remote trigger entry in the mirror synchronization task includes:
and setting a uniform resource locator and a remote trigger token for the remote trigger message in the mirror synchronization task.
In a second aspect, an embodiment of the present invention further provides a code synchronization apparatus, where the apparatus includes:
the trigger module is used for receiving a remote trigger message sent by an event processing interface web hook through a remote trigger entry in a preset mirror image synchronization task when monitoring that a code in a target code warehouse is changed;
and the synchronization module is used for carrying out code synchronization on the target code warehouse based on the mirror image synchronization script in the mirror image synchronization task when receiving the remote trigger message.
In a third aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is configured to, when executed by a processor, implement a code synchronization method according to any embodiment of the present invention.
In a fourth aspect, an embodiment of the present invention further provides a terminal, where the terminal includes:
one or more processors;
a memory for storing one or more programs;
when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the code synchronization method according to any embodiment of the present invention.
According to the technical scheme of the embodiment of the invention, when the code in the target code warehouse is detected to be changed, the remote trigger message received by the remote trigger inlet can be automatically sent without manual intervention when the code in the target code warehouse is detected to be changed based on an event processing interface web hook mechanism, and further, when the remote trigger message is detected, the code synchronization is realized through a synchronization task in a mirror image, so that the technical problems of poor instantaneity and the like of the existing code synchronization method can be solved, and the mirror image code synchronization can be efficiently carried out in real time.
Drawings
In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, a brief description is given below of the drawings used in describing the embodiments. It should be clear that the described figures are only views of some of the embodiments of the invention to be described, not all, and that for a person skilled in the art, other figures can be derived from these figures without inventive effort.
Fig. 1 is a schematic flowchart of a code synchronization method according to an embodiment of the present invention;
fig. 2A is a flowchart illustrating a code synchronization method according to a second embodiment of the present invention;
fig. 2B is a schematic flowchart of an implementation example of a code synchronization method according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a code synchronization apparatus according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of a terminal according to a third embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
In the daily development process, since two or more developers are often involved in developing the same project at the same time, a distributed development tool may be employed. In the embodiment of the present invention, the implementation may be based on a distributed version control system git. From the perspective of the average developer, gits can clone a complete git repository, including code and version information, from a server onto a stand-alone machine. The developer can also create branches and modify codes on own machine according to different development purposes, submit the codes on the branches created by the developer on the single machine and combine the branches on the single machine, and the like, has the characteristics of reducing the pressure and the data volume of the common server, having high speed and flexible operation, and being capable of easily solving conflicts between any two developers, and can effectively and quickly process the management of the project versions from very small to very large.
Example one
Fig. 1 is a flowchart of a code synchronization method according to an embodiment of the present invention, which is applicable to a case where two or more servers need to share codes in a unified code library, and the method may be executed by a code synchronization apparatus and may be implemented in a software and/or hardware manner.
As shown in fig. 1, the method of this embodiment specifically includes:
s110, when detecting that the code in the target code warehouse is changed, receiving a remote trigger message sent by an event processing interface web hook through a pre-established remote trigger entry in the mirror image synchronization task.
Specifically, detecting that the code in the target code repository has changed may include: detecting a target trigger event of a target code warehouse, wherein the target trigger event comprises a submission event, a push event, a tagging event and/or a merging request event.
In this embodiment, a mirror synchronization task may be pre-constructed based on Jenkins. And then a remote trigger inlet of the mirror image synchronization task is set, the remote trigger inlet is used for receiving the remote trigger message, and a mirror image synchronization script is added in the mirror image synchronization task and used for realizing code synchronization after the remote trigger message is received.
Wherein web hook is a technology that rises following git, when web hook based on git service is pushed to server, server will send a special request to your designated uniform resource locator url, and then can use script language to get the request. It will be appreciated that prior to performing this operation, an event handling interface web hook needs to be provided in the server or terminal in which the object code repository is stored, for sending a remote trigger message upon detecting a change in code in the object code repository. Wherein the remote trigger message may be a synchronization request.
And S120, when a remote trigger message is received, synchronizing the codes in the target code warehouse based on the mirror image synchronization script in the mirror image synchronization task.
Considering that code change often involves various stages in actual operation, when the local end needs to perform code synchronization, the operation of code synchronization may never be performed before, or may be performed already. Therefore, when the codes in the target code warehouse are synchronized, whether a mirror code warehouse corresponding to the target code warehouse exists at a local end can be detected.
Accordingly, synchronizing code in the object code repository includes: and when detecting that the local end does not have the mirror image code warehouse corresponding to the target code warehouse, synchronizing the mirror image of the target code warehouse to the local end, and generating the mirror image code warehouse corresponding to the target code warehouse. Further, the method may further include: and when detecting that a local end has a mirror image code warehouse corresponding to the target code warehouse, carrying out mirror image updating on codes in the mirror image code warehouse according to the codes in the target code warehouse.
On the basis of the technical scheme, when a web hook mechanism based on git service is adopted, a server for storing a target code warehouse, a server for realizing mirror image synchronization of the storage mirror image code warehouse and a code hosting server for a user to obtain a code using code can be arranged to execute the code synchronization method. That is, after synchronizing the code into the mirror code repository, the code synchronization method of this embodiment may further include: and pushing the mirror image code warehouse of the local end to a code hosting server.
According to the technical scheme of the embodiment, when the code in the target code warehouse is detected to be changed, the remote trigger message received by the remote trigger entrance can be used for automatically sending the remote trigger message without manual intervention when the code in the target code warehouse is detected to be changed based on an event processing interface web hook mechanism, further, when the remote trigger message is detected, the code synchronization is realized through a synchronization task in a mirror image, the technical problems that the existing code synchronization method is poor in instantaneity and the like can be solved, and the mirror image code synchronization can be efficiently carried out in real time.
Example two
Fig. 2A is a schematic flowchart of a code synchronization method according to a second embodiment of the present invention, where the technical solution of this embodiment optionally further includes, in view of the technology of the foregoing embodiment: constructing a mirror image synchronization task based on a software continuous integration tool Jenkins; and configuring a remote trigger inlet in the mirror image synchronization task, and adding a mirror image synchronization script in the mirror image synchronization task.
As shown in fig. 2A, the method of this embodiment specifically includes:
s210, constructing a mirror image synchronization task based on a software continuous integration tool Jenkins.
Firstly, Jenkins is created to construct a mirror synchronization task Job _ Project _ A, and the task is mainly used for synchronizing the object code warehouse Project _ A code stored in the object git warehouse server into the git warehouse server at the local end. In the operation, Jenkins are adopted to execute the synchronous task of the mirror image code warehouse, and because Jenkins provide remote trigger support, the synchronous task of the mirror image code warehouse can be executed as long as remote trigger information is received, so that the method is more efficient than manual synchronization and is more real-time than timing synchronization.
S220, configuring a remote trigger inlet in the mirror image synchronization task, and adding a mirror image synchronization script in the mirror image synchronization task.
Optionally, configuring a remote trigger entry in the mirror synchronization task includes: and setting a uniform resource locator for receiving the remote trigger message in the mirror image synchronization task. Further, in order to ensure the security of the code and the operating environment, a remote trigger token for receiving the remote trigger message may be further set in the mirror image synchronization task for performing authentication.
For example, the Token-based authentication method may be that a client for inputting authentication information requests login using a user name and a password, and a server receives the request to authenticate the user name and the password; after the verification is successful, the server side can issue a Token and then send the Token to the client side; after receiving Token, the client may store it, for example, in a data Cookie stored on the Local terminal of the user or a Local Storage, and the client needs to take Token issued by the server each time requesting resources from the server; and the server receives the request, then verifies the Token carried in the request of the client, and returns the requested data to the client if the verification is successful.
Optionally, configuring a remote trigger entry of Job _ Project _ a in Jenkins, setting url for remote triggering of Jenkins construction task as url _ a, and configuring a remote trigger token as token _ a, so as to enable Jenkins to receive specific remote trigger message, and provide an entry for real-time synchronous update of codes.
Specifically, a mirror synchronization script is added to the mirror synchronization task, that is, the mirror synchronization script can be added to the mirror synchronization task configured in Jenkins for Job _ Project _ a. Optionally, the execution logic of the mirror synchronization script is as follows: firstly, checking whether a local end has a specified mirror image code warehouse corresponding to a target code warehouse, and if not, cloning the target code warehouse to the local end; if the local end has a specified mirror image code warehouse, updating the codes in the mirror image code warehouse of the local end according to the codes in the target code warehouse server; and then pushing the image code warehouse of the local end to an internal image code hosting server for the user to use.
And S230, when the code in the target code warehouse is detected to be changed, receiving a remote trigger message sent by the web hook based on the event processing interface through a pre-established remote trigger entry in the mirror image synchronization task.
S240, when the remote trigger message is received, synchronizing the codes in the target code warehouse based on the mirror image synchronization script in the mirror image synchronization task.
For example, the main idea of the embodiment of the present invention is to utilize an event processing interface web hook mechanism based on a distributed project management system git service, which is capable of monitoring some events of a git-hosted object code warehouse, such as events of submission, pushing, tagging, merging requests, and the like, and after monitoring the events of pushing, tagging, and the like of the git-hosted object code warehouse by utilizing the web hook, call a remote trigger mechanism provided by a software persistent integration tool Jenkins, and execute a mirror image synchronization script on the Jenkins to implement efficient and real-time mirror image synchronization codes. As shown in fig. 2B, the specific implementation steps are as follows:
s211, creating Jenkins to construct a mirror image synchronization task.
And S221, adding a remote trigger entrance and setting a remote trigger token.
S222, adding a mirror image synchronization script in the mirror image synchronization task in Jenkins.
S223, setting the web hook in the target git code warehouse.
And adding a web hook in the B team code warehouse Project _ A, and monitoring events such as pushing and labeling. And configuring a uniform resource locator url _ a and a remote trigger token _ a set in the S221, for sending a remote trigger message.
Illustratively, the trigger flow of Project _ a maintenance personnel of the B team after performing a code update can be described as follows: firstly, pushing a code change to a Project _ A warehouse, namely a target code warehouse by a maintenance worker; a web hook mechanism arranged in a Project _ A warehouse of the target code warehouse detects a target trigger event configured in S223, and sends a synchronization request to Jenkins through url _ A and token _ A; when Jenkins receives the synchronization request, that is, it is considered that the remote trigger message is received, the script task configured in S222 is triggered to acquire the latest code in the object code repository of team B and synchronize to the mirror code repository of team a. Therefore, the code synchronization can be automatically completed in the whole process without any communication between the two teams, and the team A can be guaranteed to be capable of obtaining the latest code of the team B all the time, so that the development efficiency is improved.
EXAMPLE III
Fig. 3 is a schematic structural diagram of a data processing system according to an embodiment of the present invention. As shown in fig. 3, this embodiment is applicable to a case where two or more servers need to share codes in the unified code library, and the apparatus can be used to execute the code synchronization method. Specifically, the code synchronization apparatus of the present embodiment includes a trigger module 310 and a synchronization module 320.
The triggering module 310 is configured to receive a remote triggering message sent by a web hook based on an event processing interface through a remote triggering entry in a mirror synchronization task established in advance when monitoring that a code in a target code repository is changed; a synchronization module 320, configured to perform code synchronization on the object code repository based on the mirror synchronization script in the mirror synchronization task when the remote trigger message is received.
According to the technical scheme of the embodiment, when the code in the target code warehouse is detected to be changed, the remote trigger message received by the remote trigger entrance can be used for automatically sending the remote trigger message without manual intervention when the code in the target code warehouse is detected to be changed based on an event processing interface web hook mechanism, further, when the remote trigger message is detected, the code synchronization is realized through a synchronization task in a mirror image, the technical problems that the existing code synchronization method is poor in instantaneity and the like can be solved, and the mirror image code synchronization can be efficiently carried out in real time.
On the basis of the above technical solution, the trigger module may be specifically configured to:
detecting a target trigger event of a target code warehouse, wherein the target trigger event comprises a submission event, a push event, a tagging event and/or a merging request event.
On the basis of the above technical solutions, the synchronization module may be configured to:
and when detecting that the local end does not have the mirror image code warehouse corresponding to the target code warehouse, synchronizing the mirror image of the target code warehouse to the local end, and generating the mirror image code warehouse corresponding to the target code warehouse.
On the basis of the above technical solutions, the synchronization module may further be configured to:
and when detecting that a local end has a mirror image code warehouse corresponding to the target code warehouse, carrying out mirror image updating on codes in the mirror image code warehouse according to the codes in the target code warehouse.
On the basis of the above technical solutions, the code synchronization apparatus may further include:
and pushing the mirror image code warehouse of the local end to a code hosting server.
On the basis of the above technical solutions, the code synchronization apparatus may further include:
the mirror image synchronization task construction unit is used for constructing a mirror image synchronization task based on a software continuous integration tool Jenkins;
and the mirror image synchronization task configuration unit is used for configuring a remote trigger inlet in the mirror image synchronization task and adding a mirror image synchronization script in the mirror image synchronization task.
On the basis of the above technical solutions, the mirror synchronization task configuration unit may be specifically configured to:
and setting a uniform resource locator and a remote trigger token for the remote trigger message in the mirror synchronization task.
The code synchronization device can execute the code synchronization method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of executing the code synchronization method. For technical details that are not described in detail in this embodiment, reference may be made to a code synchronization method provided in any embodiment of the present invention.
Example four
Fig. 4 is a schematic structural diagram of a terminal according to a fourth embodiment of the present invention. Fig. 4 illustrates a block diagram of an exemplary terminal 412 suitable for use in implementing embodiments of the present invention. The terminal 412 shown in fig. 4 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 4, terminal 412 is in the form of a general purpose computing device. The components of the terminal 412 may include, but are not limited to: one or more processors or processors 416, a storage device 428, a bus 418 for storing one or more programs, and connecting various system components including the storage device 428 and the processors 416. When executed by the one or more processors 416, cause the one or more processors 416 to implement the method for automatically updating television data according to any embodiment of the present invention.
Bus 418 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Terminal 412 typically includes a variety of computer system readable media. Such media can be any available media that is accessible by terminal 412 and includes both volatile and nonvolatile media, removable and non-removable media.
Storage 428 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)430 and/or cache memory 432. The terminal 412 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 434 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 4, commonly referred to as a "hard drive"). Although not shown in FIG. 4, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 418 by one or more data media interfaces. Memory 428 can include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 440 having a set (at least one) of program modules 442 may be stored, for instance, in memory 428, such program modules 442 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. The program modules 442 generally perform the functions and/or methodologies of the described embodiments of the invention.
The terminal 412 may also communicate with one or more external devices 414 (e.g., keyboard, pointing device, display 424, etc.), one or more devices that enable a user to interact with the terminal 412, and/or any devices (e.g., network card, modem, etc.) that enable the terminal 412 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interfaces 422. Also, the terminal 412 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) through the network adapter 420. As shown, the network adapter 420 communicates with the other modules of the terminal 412 over a bus 418. It should be appreciated that although not shown, other hardware and/or software modules may be used in conjunction with the terminal 412, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processor 416 executes various functional applications and data processing, such as implementing a code synchronization method provided by an embodiment of the present invention, by executing programs stored in the storage 428.
In addition, an embodiment of the present invention further provides a storage medium readable by a computer, and having a computer program stored thereon, where the computer program is used to execute a code synchronization method when executed by a processor, and the method includes:
when detecting that the code in the target code warehouse is changed, receiving a remote trigger message sent by an event processing interface web hook through a remote trigger entry in a preset mirror image synchronization task;
and when a remote trigger message is received, synchronizing the codes in the target code warehouse based on the mirror synchronization script in the mirror synchronization task.
Optionally, the computer executable instructions, when executed by a computer processor, may also be used to implement the technical solution of the code synchronization method provided by any embodiment of the present invention.
The logic and/or steps represented in the flowcharts or otherwise described herein, such as an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable storage medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable storage medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable storage medium may even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (9)

1. A method of code synchronization, comprising:
when detecting that a code stored in a target git warehouse server is changed, receiving a remote trigger message sent by an event processing interface web hook through a remote trigger entry in a mirror image synchronization task established in advance based on Jenkins;
when a remote trigger message is received, synchronizing the codes stored in the target git warehouse server to a git warehouse server of a local end based on a mirror image synchronization script in the mirror image synchronization task;
wherein the detecting that the code in the target git repository server is changed comprises:
detecting a target trigger event of the target git warehouse server based on the event processing interface web hook, wherein the target trigger event comprises a submission event, a push event, a tagging event and/or a combination request event, and the target trigger event represents that a code is changed;
the mirror image synchronization task is used for synchronizing the codes stored in the target git warehouse server to the git warehouse server at the local end; and setting a uniform resource locator for receiving the remote trigger message in the mirror image synchronization task in advance, wherein the uniform resource locator is used for sending the remote trigger message.
2. The code synchronization method of claim 1, wherein the synchronizing code in the target code repository comprises:
and when detecting that the local end does not have the mirror image code warehouse corresponding to the target code warehouse, synchronizing the mirror image of the target code warehouse to the local end, and generating the mirror image code warehouse corresponding to the target code warehouse.
3. The code synchronization method of claim 1, wherein the synchronizing code in the target code repository comprises:
and when detecting that a local end has a mirror image code warehouse corresponding to the target code warehouse, carrying out mirror image updating on codes in the mirror image code warehouse according to the codes in the target code warehouse.
4. The code synchronization method according to claim 2 or 3, further comprising:
and pushing the mirror image code warehouse of the local end to a code hosting server.
5. The code synchronization method according to claim 1, further comprising:
constructing a mirror image synchronization task based on a software continuous integration tool Jenkins;
and configuring a remote trigger inlet in the mirror image synchronization task, and adding a mirror image synchronization script in the mirror image synchronization task.
6. The code synchronization method of claim 5, wherein the configuring the remote trigger entry in the mirror synchronization task comprises:
and setting a uniform resource locator and a remote trigger token for the remote trigger message in the mirror synchronization task.
7. A code synchronization apparatus, comprising:
the trigger module is used for receiving a remote trigger message sent by an event processing interface based web hook through a remote trigger entry in a mirror synchronization task which is pre-established based on Jenkins when the code stored in the target git warehouse server is monitored to be changed;
the synchronization module is used for synchronizing the codes stored in the target git warehouse server to a git warehouse server of a local end based on a mirror image synchronization script in the mirror image synchronization task when a remote trigger message is received;
the trigger module is specifically configured to:
detecting a target trigger event of the target git warehouse server based on the event processing interface web hook, wherein the target trigger event comprises a submission event, a push event, a tagging event and/or a combination request event, and the target trigger event represents that a code is changed;
the mirror image synchronization task is used for synchronizing the codes stored in the target git warehouse server to the git warehouse server at the local end; and setting a uniform resource locator for receiving the remote trigger message in the mirror image synchronization task in advance, wherein the uniform resource locator is used for sending the remote trigger message.
8. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the code synchronization method according to any one of claims 1 to 6.
9. A terminal, characterized in that the terminal comprises:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the code synchronization method of any of claims 1-6.
CN201810113571.4A 2018-02-05 2018-02-05 Code synchronization method, device, computer readable medium and terminal Active CN108228256B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810113571.4A CN108228256B (en) 2018-02-05 2018-02-05 Code synchronization method, device, computer readable medium and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810113571.4A CN108228256B (en) 2018-02-05 2018-02-05 Code synchronization method, device, computer readable medium and terminal

Publications (2)

Publication Number Publication Date
CN108228256A CN108228256A (en) 2018-06-29
CN108228256B true CN108228256B (en) 2022-01-04

Family

ID=62670751

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810113571.4A Active CN108228256B (en) 2018-02-05 2018-02-05 Code synchronization method, device, computer readable medium and terminal

Country Status (1)

Country Link
CN (1) CN108228256B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108829432A (en) * 2018-05-02 2018-11-16 上海康斐信息技术有限公司 A kind of code synchronisation method and system based on code manager
CN110096304A (en) * 2019-03-16 2019-08-06 平安城市建设科技(深圳)有限公司 Task construction method, device, equipment and storage medium based on Jenkins
CN111045723B (en) * 2019-12-11 2024-01-26 腾讯科技(深圳)有限公司 Method and device for notifying code change between associated systems
CN111651352B (en) * 2020-05-29 2023-03-14 成都新潮传媒集团有限公司 Warehouse code merging method and device
CN111651181B (en) * 2020-06-17 2024-03-12 深圳市钱海网络技术有限公司 Automatic refreshing method and device for system configuration parameters
CN113822031A (en) * 2020-06-18 2021-12-21 北京字节跳动网络技术有限公司 Method and apparatus for processing code templates
CN112035278B (en) * 2020-08-20 2024-04-02 北京字节跳动网络技术有限公司 Method, device, equipment and storage medium for executing function
CN114697307A (en) * 2022-02-25 2022-07-01 智己汽车科技有限公司 Management system and method for automatic synchronous downloading of code warehouse
CN115422157B (en) * 2022-08-30 2023-05-30 安徽继远检验检测技术有限公司 Unified database management method and system based on ldap
CN115774864B (en) * 2023-02-10 2023-06-16 闪捷信息科技有限公司 Code leakage protection method and device based on git hook script

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102929630A (en) * 2012-10-31 2013-02-13 中标软件有限公司 Method and system for code management based on distributed collaborative development environment
CN106873975A (en) * 2016-12-30 2017-06-20 武汉默联股份有限公司 Devops based on Docker persistently pays and automated system and method
WO2017223189A1 (en) * 2016-06-21 2017-12-28 Advanced Micro Devices, Inc. Fingerprinting of redundant threads using compiler-inserted transformation code

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102624871B (en) * 2012-02-03 2015-01-07 杭州杰唐信息技术有限公司 Remote file synchronizing method realized based on distributed enterprise service bus

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102929630A (en) * 2012-10-31 2013-02-13 中标软件有限公司 Method and system for code management based on distributed collaborative development environment
WO2017223189A1 (en) * 2016-06-21 2017-12-28 Advanced Micro Devices, Inc. Fingerprinting of redundant threads using compiler-inserted transformation code
CN106873975A (en) * 2016-12-30 2017-06-20 武汉默联股份有限公司 Devops based on Docker persistently pays and automated system and method

Also Published As

Publication number Publication date
CN108228256A (en) 2018-06-29

Similar Documents

Publication Publication Date Title
CN108228256B (en) Code synchronization method, device, computer readable medium and terminal
US9851996B2 (en) Applying firmware updates in a system with zero downtime by selectively offlining and onlining hardware using a scale-up hypervisor layer
US9386079B2 (en) Method and system of virtual desktop infrastructure deployment studio
US20180137032A1 (en) Systems and methods for testing source code
CN107016480B (en) Task scheduling method, device and system
CN109862101B (en) Cross-platform application starting method and device, computer equipment and storage medium
US9645809B2 (en) Updating software components through online stores
US20150178184A1 (en) Test management using distributed computing
CN111198769A (en) Information processing method and system, computer system and computer readable medium
CN103077034B (en) hybrid virtualization platform JAVA application migration method and system
US8938490B2 (en) System and method for accessing mainframe system automation from a process automation application
CN111666134A (en) Method and system for scheduling distributed tasks
US7546604B2 (en) Program reactivation using triggering
US8990168B1 (en) Efficient conflict resolution among stateless processes
CN112825525B (en) Method and apparatus for processing transactions
CN117076096A (en) Task flow execution method and device, computer readable medium and electronic equipment
CN110221910B (en) Method and apparatus for performing MPI jobs
CN114785861B (en) Service request forwarding system, method, computer equipment and storage medium
US11093527B2 (en) Framework for continuous processing of a set of documents by multiple software applications
US10728323B2 (en) Method and apparatus for operating infrastructure layer in cloud computing architecture
US10776134B2 (en) Management of application properties
CN114968636A (en) Fault processing method and device
CN113778527A (en) Method and apparatus for controlling state of pipeline task
CN111767113A (en) Method and device for realizing container eviction
CN112749042B (en) Application running method and device

Legal Events

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