CN112905199A - Code update detection method and device - Google Patents

Code update detection method and device Download PDF

Info

Publication number
CN112905199A
CN112905199A CN202110153747.0A CN202110153747A CN112905199A CN 112905199 A CN112905199 A CN 112905199A CN 202110153747 A CN202110153747 A CN 202110153747A CN 112905199 A CN112905199 A CN 112905199A
Authority
CN
China
Prior art keywords
code
current version
production environment
deployment
management tool
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110153747.0A
Other languages
Chinese (zh)
Inventor
杨艳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Zhongtongji Network Technology Co Ltd
Original Assignee
Shanghai Zhongtongji 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 Shanghai Zhongtongji Network Technology Co Ltd filed Critical Shanghai Zhongtongji Network Technology Co Ltd
Priority to CN202110153747.0A priority Critical patent/CN112905199A/en
Publication of CN112905199A publication Critical patent/CN112905199A/en
Pending legal-status Critical Current

Links

Images

Classifications

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

Abstract

The invention relates to a code update detection method and a device, wherein the method comprises the following steps: acquiring a release code of the latest production environment and a packaging deployment code of the current version; calling a code management tool, and detecting whether the packaging deployment code of the current version contains the release code of the latest production environment by using the code management tool; if yes, performing a code packing deployment process; and if not, sending a code updating prompt to enable a developer to complete the updating of the packaging deployment code of the current version, and performing a code packaging deployment process according to the updated packaging deployment code. The automatic detection of the current version code is carried out before packaging every time by adopting a code management tool, so that the omission problem of manual inspection is relieved, the stability of the system is ensured, and the user experience is effectively improved.

Description

Code update detection method and device
Technical Field
The invention belongs to the technical field of code detection systems, and particularly relates to a code update detection method and device.
Background
With the rapid development of internet technology and the prevalence of internet products, people increasingly use websites, APPs, H5, public numbers, applets, and the like on each terminal to assist people in working and living, so that the iteration of internet products is more and more frequent. How to avoid code missing and problems caused by the code missing in the fast iteration process is very important.
At present, common code merging management and control depends on manual control, but in actual work, project personnel can delay code merging and even forget due to various reasons such as temporary emergency tasks, verification and observation after release and the like. Whether a subsequent edition worker lags behind manual inspection of a production environment code or not is not done or forgotten, so that results such as partial function rollback, function problem and the like of the production environment after the edition issuance are caused, and the system stability and the user experience are seriously influenced.
Disclosure of Invention
In order to solve at least the above problems in the prior art, the present invention provides a method and an apparatus for detecting code update, so as to realize automatic detection of a code version and ensure stability of a system.
The technical scheme provided by the invention is as follows:
in one aspect, a code update detection method includes:
acquiring a release code of the latest production environment and a packaging deployment code of the current version;
calling a code management tool, and detecting whether the packaging deployment code of the current version contains the release code of the latest production environment by using the code management tool;
if yes, performing a code packing deployment process;
and if not, sending a code updating prompt to enable a developer to complete the updating of the packaging deployment code of the current version, and performing a code packaging deployment process according to the updated packaging deployment code.
Optionally, the code management tool includes Git and SVN.
Optionally, when the code management tool is Git, the detecting, by using the code management tool, whether the packaged deployment code of the current version includes the release code of the latest production environment includes:
comparing, by an sdk tool in the Git, a branch in which a current version is being packaged with an online branch of the latest production environment;
detecting whether the packing branch contains commit id of the upper line branch.
Optionally, when the code management tool is an SVN, the detecting, by using the code management tool, whether the packaged deployment code of the current version includes the release code of the latest production environment includes:
comparing the branch of the current version which is being packaged with the online branch of the latest production environment through the SVN tool;
detecting whether the packing branch contains commit id of the upper line branch.
Optionally, before performing the code packing deployment process according to the updated packing deployment code, the method further includes:
detecting, with the code management tool, whether the updated code is behind a release code of the latest production environment;
and if the current version of the packaged deployment code is not the same as the release code version of the latest production environment, repeatedly sending a code updating prompt until the packaged deployment code of the current version is the same as the release code version of the latest production environment.
In another aspect, a code update detection apparatus includes:
the acquisition module is used for acquiring the release code of the latest production environment and the packaging deployment code of the current version;
the detection module is used for calling a code management tool and detecting whether the packaging deployment code of the current version contains the release code of the latest production environment by using the code management tool;
the updating module is used for carrying out a code packaging deployment process if the code is contained in the data; and if not, sending a code updating prompt to enable a developer to complete the updating of the packaging deployment code of the current version, and performing a code packaging deployment process according to the updated packaging deployment code.
Optionally, the code management tool includes Git and SVN.
Optionally, when the code management tool is Git, the detection module is specifically configured to:
comparing, by an sdk tool in the Git, a branch in which a current version is being packaged with an online branch of the latest production environment;
detecting whether the packing branch contains commit id of the upper line branch.
Optionally, when the code management tool is an SVN, the detection module is specifically configured to:
comparing the branch of the current version which is being packaged with the online branch of the latest production environment through the SVN tool;
detecting whether the packing branch contains commit id of the upper line branch.
Optionally, the update module is further configured to:
detecting, with the code management tool, whether the updated code is behind a release code of the latest production environment;
and if the current version of the packaged deployment code is not the same as the release code version of the latest production environment, repeatedly sending a code updating prompt until the packaged deployment code of the current version is the same as the release code version of the latest production environment.
The invention has the beneficial effects that:
the invention provides a code update detection method and a device, wherein the method comprises the following steps: acquiring a release code of the latest production environment and a packaging deployment code of the current version; calling a code management tool, and detecting whether the packaging deployment code of the current version contains the release code of the latest production environment by using the code management tool; if yes, performing a code packing deployment process; and if not, sending a code updating prompt to enable a developer to complete the updating of the packaging deployment code of the current version, and performing a code packaging deployment process according to the updated packaging deployment code. The automatic detection of the current version code is carried out before packaging every time by adopting a code management tool, so that the omission problem of manual inspection is relieved, the stability of the system is ensured, and the user experience is effectively improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flowchart of a code update detection method according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a code update detection apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be described in detail below. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the examples given herein without any inventive step, are within the scope of the present invention.
Fig. 1 is a flowchart of a code update detection method according to an embodiment of the present invention.
As shown in fig. 1, the code update detection method provided in this embodiment includes the following steps:
and S11, acquiring the release code of the latest production environment and the packaging deployment code of the current version.
Specifically, the latest production environment refers to the latest service version, the current version refers to the version running at the time, and the main purpose of acquiring the release code of the latest production environment and the packaging deployment code of the current version is to perform subsequent judgment and determine whether the versions are consistent, and the acquisition time is before packaging deployment each time.
And S12, calling a code management tool, and detecting whether the packaged deployment code of the current version contains the release code of the latest production environment by using the code management tool.
When the code management tool adopts Git, the code management tool is used for detecting whether the packaging deployment code of the current version contains the release code of the latest production environment, and the method comprises the following steps: comparing the branch of the current version being packaged with the online branch of the latest production environment through an sdk tool in Git; it is detected whether the branch being packed contains a commit id of the on-line branch. When the code management tool is an SVN, the code management tool is used to detect whether the packaged deployment code of the current version contains the release code of the latest production environment, and the method comprises the following steps: comparing the branch of the current version which is being packaged with the online branch of the latest production environment through an SVN tool; and detecting whether the packed branch contains commit id of the up-line branch, thereby realizing the detection of the code of the current version. The processes of adopting other code management tools are the same, and are not illustrated one by one, and can be understood by referring to each other.
And S13, if the code is contained, performing a code packaging deployment process.
If the packaging deployment code of the current version contains the release code of the latest production environment, the packaging deployment code indicates that the current version is the latest version, and related flow operations such as packaging, deployment and the like can be directly carried out without version updating.
And S14, if not, sending a code updating prompt to enable a developer to complete updating of the packaging deployment code of the current version, and performing a code packaging deployment process according to the updated packaging deployment code.
If the packaging deployment code of the current version does not contain the release code of the latest production environment, the fact that the current version is behind the release code of the latest production environment is indicated, updating is needed, at the moment, an update prompt needs to be sent to the user side, so that relevant developers can timely know that version updating operation needs to be carried out, the developers can merge the latest codes, and after code conflict is solved, packaging and deployment related flow operation is carried out according to the latest packaging deployment code after updating.
In order to ensure that the running code version is the latest version, before performing the code packaging deployment process according to the updated packaging deployment code, the method further includes: detecting whether the updated code lags behind the release code of the latest production environment by using a code management tool; and if the current version of the packaged deployment code is the same as the release code version of the latest production environment, repeatedly sending a code update prompt until the packaged deployment code of the current version is the same as the release code version of the latest production environment. That is, after one update, the version detection is performed again instead of directly performing the packing deployment according to the update result, and a mode of circulating detection is adopted to ensure that the running version of the system service is the latest version, thereby ensuring the stable running of the system. That is, before the packing operation is performed each time, version detection is performed, and only after the latest version is determined, the subsequent packing, deployment and other related processes are performed.
The code update detection method provided by the embodiment includes: acquiring a release code of the latest production environment and a packaging deployment code of the current version; calling a code management tool, and detecting whether the packaging deployment code of the current version contains the release code of the latest production environment by using the code management tool; if yes, performing a code packing deployment process; and if not, sending a code updating prompt to enable a developer to complete the updating of the packaging deployment code of the current version, and performing a code packaging deployment process according to the updated packaging deployment code. The automatic detection of the current version code is carried out before packaging every time by adopting a code management tool, so that the omission problem of manual inspection is solved, the stability of the system is ensured, and the user experience is effectively improved.
Based on the same general inventive concept, the application also protects a code update detection device.
Fig. 2 is a schematic structural diagram of a code update detection apparatus according to an embodiment of the present invention.
As shown in fig. 2, the code update detection apparatus provided in this embodiment includes:
an obtaining module 10, configured to obtain a release code of a latest production environment and a packaging deployment code of a current version;
the detection module 20 is configured to invoke a code management tool, and detect whether the packaged deployment code of the current version includes the release code of the latest production environment by using the code management tool;
an updating module 30, configured to perform a code packing deployment procedure if the code is included in the code; and if not, sending a code updating prompt to enable a developer to complete the updating of the packaging deployment code of the current version, and performing a code packaging deployment process according to the updated packaging deployment code.
The code update detection device provided by the embodiment comprises: acquiring a release code of the latest production environment and a packaging deployment code of the current version; calling a code management tool, and detecting whether the packaging deployment code of the current version contains the release code of the latest production environment by using the code management tool; if yes, performing a code packing deployment process; and if not, sending a code updating prompt to enable a developer to complete the updating of the packaging deployment code of the current version, and performing a code packaging deployment process according to the updated packaging deployment code. The automatic detection of the current version code is carried out before packaging every time by adopting a code management tool, so that the omission problem of manual inspection is solved, the stability of the system is ensured, and the user experience is effectively improved.
Further, the code management tool in the present embodiment includes Git and SVN.
Further, when the code management tool in this embodiment is Git, the detection module is specifically configured to:
comparing the branch of the current version being packaged with the online branch of the latest production environment through an sdk tool in Git;
it is detected whether the branch being packed contains a commit id of the on-line branch.
Further, when the code management tool in this embodiment is an SVN, the detection module is specifically configured to:
comparing the branch of the current version which is being packaged with the online branch of the latest production environment through an SVN tool;
it is detected whether the branch being packed contains a commit id of the on-line branch.
Further, the update module in this embodiment is further configured to:
detecting whether the updated code lags behind the release code of the latest production environment by using a code management tool;
and if the current version of the packaged deployment code is the same as the release code version of the latest production environment, repeatedly sending a code update prompt until the packaged deployment code of the current version is the same as the release code version of the latest production environment.
Embodiments of the apparatus parts have been described in detail in relation to corresponding method embodiments, and therefore will not be described in detail in relation to corresponding apparatus parts, which may be understood by reference to each other.
The embodiment of the present application further protects a code update detection apparatus, including: a processor, and a memory coupled to the processor;
the memory is used for storing a computer program for at least the code update detection device of any of the above embodiments;
the processor is used to call and execute the computer program in the memory.
Embodiments of the present application also protect a storage medium storing a computer program, which when executed by a processor, implements the steps of the code update detection method according to any of the above embodiments.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.
It is understood that the same or similar parts in the above embodiments may be mutually referred to, and the same or similar parts in other embodiments may be referred to for the content which is not described in detail in some embodiments.
It should be noted that the terms "first," "second," and the like in the description of the present invention are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. Further, in the description of the present invention, the meaning of "a plurality" means at least two unless otherwise specified.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and alternate implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
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.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc.
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.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.

Claims (10)

1. A code update detection method, comprising:
acquiring a release code of the latest production environment and a packaging deployment code of the current version;
calling a code management tool, and detecting whether the packaging deployment code of the current version contains the release code of the latest production environment by using the code management tool;
if yes, performing a code packing deployment process;
and if not, sending a code updating prompt to enable a developer to complete the updating of the packaging deployment code of the current version, and performing a code packaging deployment process according to the updated packaging deployment code.
2. The code update detection method of claim 1, wherein the code management tool comprises Git and SVN.
3. The method according to claim 2, wherein when the code management tool is Git, the detecting, by the code management tool, whether the packaged deployment code of the current version includes the release code of the latest production environment comprises:
comparing, by an sdk tool in the Git, a branch in which a current version is being packaged with an online branch of the latest production environment;
detecting whether the packing branch contains commit id of the upper line branch.
4. The method according to claim 2, wherein when the code management tool is an SVN, the detecting whether the packaged deployment code of the current version includes the release code of the latest production environment by using the code management tool comprises:
comparing the branch of the current version which is being packaged with the online branch of the latest production environment through the SVN tool;
detecting whether the packing branch contains commit id of the upper line branch.
5. The method according to claim 1, wherein before performing the code packaging deployment process according to the updated packaging deployment code, the method further comprises:
detecting, with the code management tool, whether the updated code is behind a release code of the latest production environment;
and if the current version of the packaged deployment code is not the same as the release code version of the latest production environment, repeatedly sending a code updating prompt until the packaged deployment code of the current version is the same as the release code version of the latest production environment.
6. A code update detection apparatus, comprising:
the acquisition module is used for acquiring the release code of the latest production environment and the packaging deployment code of the current version;
the detection module is used for calling a code management tool and detecting whether the packaging deployment code of the current version contains the release code of the latest production environment by using the code management tool;
the updating module is used for carrying out a code packaging deployment process if the code is contained in the data; and if not, sending a code updating prompt to enable a developer to complete the updating of the packaging deployment code of the current version, and performing a code packaging deployment process according to the updated packaging deployment code.
7. The code update detection apparatus of claim 6, wherein the code management tool comprises Git and SVN.
8. The apparatus according to claim 7, wherein when the code management tool is Git, the detecting module is specifically configured to:
comparing, by an sdk tool in the Git, a branch in which a current version is being packaged with an online branch of the latest production environment;
detecting whether the packing branch contains commit id of the upper line branch.
9. The apparatus according to claim 7, wherein when the code management tool is an SVN, the detection module is specifically configured to:
comparing the branch of the current version which is being packaged with the online branch of the latest production environment through the SVN tool;
detecting whether the packing branch contains commit id of the upper line branch.
10. The code update detection apparatus of claim 6, wherein the update module is further configured to:
detecting, with the code management tool, whether the updated code is behind a release code of the latest production environment;
and if the current version of the packaged deployment code is not the same as the release code version of the latest production environment, repeatedly sending a code updating prompt until the packaged deployment code of the current version is the same as the release code version of the latest production environment.
CN202110153747.0A 2021-02-04 2021-02-04 Code update detection method and device Pending CN112905199A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110153747.0A CN112905199A (en) 2021-02-04 2021-02-04 Code update detection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110153747.0A CN112905199A (en) 2021-02-04 2021-02-04 Code update detection method and device

Publications (1)

Publication Number Publication Date
CN112905199A true CN112905199A (en) 2021-06-04

Family

ID=76122273

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110153747.0A Pending CN112905199A (en) 2021-02-04 2021-02-04 Code update detection method and device

Country Status (1)

Country Link
CN (1) CN112905199A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114968274A (en) * 2022-07-29 2022-08-30 之江实验室 Method and system for automatically and rapidly deploying front-end processor based on gray release

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109814873A (en) * 2019-02-14 2019-05-28 北京顺丰同城科技有限公司 A kind of code dissemination method and device
US20190243640A1 (en) * 2018-02-02 2019-08-08 Bank Of America Corporation Smart tool for enterprise-wide version control of codes during software integration and deployment
CN110187914A (en) * 2019-05-23 2019-08-30 杭州火小二科技有限公司 Application and development method, system and device
CN111309336A (en) * 2020-01-21 2020-06-19 浪潮软件股份有限公司 Distributed application deployment method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190243640A1 (en) * 2018-02-02 2019-08-08 Bank Of America Corporation Smart tool for enterprise-wide version control of codes during software integration and deployment
CN109814873A (en) * 2019-02-14 2019-05-28 北京顺丰同城科技有限公司 A kind of code dissemination method and device
CN110187914A (en) * 2019-05-23 2019-08-30 杭州火小二科技有限公司 Application and development method, system and device
CN111309336A (en) * 2020-01-21 2020-06-19 浪潮软件股份有限公司 Distributed application deployment method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114968274A (en) * 2022-07-29 2022-08-30 之江实验室 Method and system for automatically and rapidly deploying front-end processor based on gray release

Similar Documents

Publication Publication Date Title
US10579453B2 (en) Stream-processing data
US10671381B2 (en) Continuous integration with reusable context aware jobs
KR20150033711A (en) Run-time error repairing method, device and system
US20150128111A1 (en) Devices and Methods for Acquiring Abnormal Information
US9952855B2 (en) Software test automation
US8245080B2 (en) Model-based testing of an application program under test
CN111144839B (en) Project construction method, continuous integration system and terminal equipment
US20160239400A1 (en) Embedding and executing trace functions in code to gather trace data
US20130081003A1 (en) Selective data flow analysis of bounded regions of computer software applications
EP3040854A1 (en) Method, apparatus and storage medium for dynamically patching function
CN111475401A (en) Test method and related equipment
CN110515679A (en) Collecting method, device, equipment and storage medium
CN102646066B (en) Method and device for obtaining starting-up time
US9760470B2 (en) Device, method, and program analysis of new source code to be added to execution program to check for bug
CN112905199A (en) Code update detection method and device
WO2020098311A1 (en) Method and apparatus for resource leak detection
CN113721948A (en) Database upgrading method, system and storage medium
CN110990833B (en) SDK safety detection method and related equipment
US20140040866A1 (en) Managing code instrumentation in a production computer program
CN115599645A (en) Method and device for testing stability of linux drive module
CN111949273B (en) File extraction method and device based on iOS system
JP2008186378A (en) Program for handling exception
JP5429171B2 (en) Information processing apparatus and hangup cause investigation information acquisition method
JP2007025820A (en) Risk diagnostic program for software
CN113806138A (en) Backup recovery detection method and device for database, electronic equipment and storage medium

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