Code release method and device, server and storage medium
By monitoring and storing the updated code of the second server, and performing version and environment verification in the first server, automatically packaging and publishing of codes, the problem of inefficient code release in the code version control system is solved, and efficient and stable are achieved code release.
Patent Information
- Application Number
- CN202310678024.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-08
- Publication Date
- 2024-12-10
AI Technical Summary
In the code version control system, it is difficult to locate and update code, resulting in inefficient code release, and manual maintenance of change logs is required. The environment and execution steps required for codes for different projects are different when packaged and released.
By monitoring the updated development code in the second server, obtaining and storing it in the release warehouse of the first server, verifying the version information and packaging environment, and automatically packaging and publishing the code to ensure the stability and efficient release of the code.
It realizes automated code packaging and release, improves code release efficiency, and does not require manual positioning and update code, ensuring the stability and efficient release of code.
Smart Images

Figure CN119105774A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of software development technology, and in particular to a code publishing method, device, server and storage medium. Background Art
[0002] In the code version control system, it is difficult to locate the updated code in the code version control system, so it is usually necessary to manually maintain the change log. At the same time, the code of different projects requires different environments and execution steps when packaging and releasing, which leads to low code release efficiency. Summary of the invention
[0003] The present application provides a code publishing method, device, server and storage medium to solve the technical problem of how to improve the efficiency of code publishing.
[0004] A first aspect of an embodiment of the present application provides a code publishing method, which is applied to a first server. The method includes: if it is monitored that the development code is updated in the second server, the development code obtained from the second server is stored in the publishing warehouse of the first server; if the version information and packaging environment of the development code stored in the publishing warehouse pass the verification, the stored development code is packaged to obtain a packaged file; and the packaged file is stored in the publishing warehouse for publishing.
[0005] According to an embodiment of the present application, storing the development code obtained from the second server in the release warehouse of the first server includes: if the release warehouse is configured in the first server, determining the updated version information corresponding to the development code updated in the second server, and creating a folder in the release warehouse based on the updated version information; storing the obtained development code in the folder.
[0006] According to an embodiment of the present application, before packaging the stored development code to obtain a packaged file, the method also includes: if the updated version information is different from the version information corresponding to the stored development code, using the development code re-obtained from the second server to replace the development code stored in the release warehouse; if the updated version information is the same as the version information corresponding to the replaced development code in the release warehouse, determining that the version information of the replaced development code in the release warehouse passes the verification.
[0007] According to an embodiment of the present application, before packaging the stored development code to obtain a packaged file, the method also includes: parsing a first support library list and an environment name of the stored development code; if a packaging environment corresponding to the environment name is configured in the first server, comparing a second support library list of the packaging environment with the first support library list, the first support library list and the second support library list including file names of multiple support library files; if the second support library list is different from the first support library list, updating the second support library list based on the first support library list; if the second support library list is updated successfully, determining that the packaging environment has passed the verification.
[0008] According to an embodiment of the present application, packaging the stored development code to obtain a packaged file includes: obtaining pre-configured packaging parameters, the packaging parameters including a file directory; compiling the stored development code to obtain a target file and a compiled file; packaging the target file and the configuration file in the file directory to obtain an executable file; and generating the packaged file based on the compiled file and the executable file.
[0009] According to an embodiment of the present application, before storing the packaged file in the release warehouse for release, the method also includes: determining whether the packaged file includes the executable file and the compiled file of the stored development code; if the packaged file includes the executable file and the compiled file, determining that the stored development code is packaged successfully.
[0010] According to an embodiment of the present application, the method further includes: if the packaging of the stored development code fails, deleting the packaging file.
[0011] According to an embodiment of the present application, storing the packaged file to the publishing warehouse for publishing includes: updating the directory of the publishing warehouse according to the packaged file to obtain an updated directory; and publishing the files corresponding to the updated directory based on the updated version information and a pre-configured publishing file name.
[0012] According to a second aspect of an embodiment of the present application, there is provided a code publishing device, which runs on a first server, and the device includes: a storage unit, which is used to store the development code obtained from the second server in a publishing warehouse of the first server if it is detected that the development code is updated in the second server; a packaging unit, which is used to package the stored development code in the publishing warehouse to obtain a packaged file if the version information and packaging environment of the development code stored in the publishing warehouse pass the verification; and a publishing unit, which is used to store the packaged file in the publishing warehouse for publishing.
[0013] A third aspect of an embodiment of the present application provides a server, comprising: a memory storing computer-readable instructions; and a processor executing the computer-readable instructions stored in the memory to implement the code publishing method.
[0014] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, in which computer-readable instructions are stored. The computer-readable instructions are executed by a processor in a server to implement the code publishing method.
[0015] The embodiment of the present application can trigger the verification of the version information and packaging environment of the development code stored in the release warehouse by monitoring the changes of the development code in the second server, and then package the stored development code after the version information and packaging environment pass the verification, so as to ensure the packaging stability of the stored development code. After obtaining the packaged file, the embodiment of the present application further stores the packaged file in the release warehouse for release, because there is no need to locate the update code, and the stored development code can be automatically packaged and released, so the release efficiency can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 This is an application scenario diagram of a code publishing method provided in an embodiment of the present application.
[0017] Figure 2 It is a flowchart of the code publishing method provided in an embodiment of the present application.
[0018] Figure 3 It is a detailed flow chart of the development code storage method provided in the embodiment of the present application.
[0019] Figure 4 This is a flowchart of verifying the version information of the stored development code provided in an embodiment of the present application.
[0020] Figure 5 It is a flowchart of a packaging environment for verifying stored development code provided in an embodiment of the present application.
[0021] Figure 6 It is a flowchart of a code publishing method provided by another embodiment of the present application.
[0022] Figure 7 It is a functional module diagram of the code publishing device provided in an embodiment of the present application.
[0023] Figure 8 It is a structural diagram of a first server for implementing a code publishing method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0024] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application is described in detail below with reference to the accompanying drawings and specific embodiments.
[0025] It should be noted that in this application, "at least one" means one or more, and "more than one" means two or more than two. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The terms "first", "second", "third", "fourth", etc. (if any) in the specification, claims and drawings of this application are used to distinguish similar objects, rather than to describe a specific order or sequence.
[0026] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way. The following embodiments and features in the embodiments may be combined with each other without conflict.
[0027] like Figure 1 As shown, it is an application scenario diagram of a code publishing method provided by an embodiment of the present application. The code publishing method is applied to the first server 1, and the first server 1 can be used to package and publish the code. The first server 1 can call an agent to execute a task in the first server 1. For example, the first server 1 can call an agent to execute a code publishing task. The first server 1 can receive multiple types of tasks. Different types of tasks can use the same agent to execute tasks, and different types of tasks can also use different agents to execute tasks. The first server 1 can be integrated and communicated with the second server 2 to monitor whether the development code of the monitoring project in the second server 2 is updated. The first server 1 can also be used to configure tasks and environments so that the development code can be correctly packaged and published. The second server 2 is used to manage the version number and change history of the monitoring project. The second server 2 records the detailed information of the code submission, merging and publishing in the monitoring project to manage the version control when multiple developers modify the same code at the same time to prevent code conflicts and data loss.
[0028] The first server 1 and the second server 2 in the embodiment of the present application can be independent servers, or they can be cloud servers that provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication security services, content distribution networks and other basic cloud computing services.
[0029] like Figure 2FIG. 1 is a flowchart of a code publishing method provided in an embodiment of the present application. The code publishing method is applied to a first server (eg Figure 1 The first server 1). According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.
[0030] 201 : If it is detected that the development code is updated in the second server, the development code obtained from the second server is stored in the release warehouse of the first server.
[0031] In at least one embodiment of the present application, a warehouse address of a monitoring project to be packaged and released is pre-set in the first server 1, and the warehouse address is used to store the development code of the monitoring project, and the warehouse address may be the address information of the monitoring project in the second server 2. The monitoring project includes multiple branches, including, but not limited to: feature branches, development branches, and release branches.
[0032] In at least one embodiment of the present application, the first server 1 polls in real time to monitor whether the development code in the second server 2 is updated. When the first server 1 detects that the development code is updated in the second server 2, the first server 1 obtains the latest development code in the monitoring project according to the preset warehouse address, and stores the obtained development code in the release warehouse pre-created in the first server 1. The latest development code can be the code stored in the warehouse address when the first server 1 detects that the development code is updated in the second server 2.
[0033] 202, if the version information and packaging environment of the development code stored in the release warehouse pass the verification, the stored development code is packaged to obtain a package file.
[0034] In at least one embodiment of the present application, the version information of the development code stored in the release warehouse may include any one or more of the version identifier of the stored development code and the storage timestamp. In software development, developers usually create different packaging environments for different code branches to ensure that the packaged software can run normally. The packaged file can be a file obtained after the packaged development code is completed.
[0035] In at least one embodiment of the present application, the first server 1 packages the stored development code to obtain a packaged file, including: the first server 1 obtains pre-configured packaging parameters, the packaging parameters include a file directory, and compiles the stored development code to obtain a target file and a compiled file. The first server 1 packages the target file and the configuration file in the file directory to obtain an executable file, and generates a packaged file based on the compiled file and the executable file. Among them, the packaging parameters can also include a packaging path and a generated file name, the packaging path can be the path information for storing the packaged file, and the generated file name can be the naming information of the packaged file.
[0036] In at least one embodiment of the present application, the first server 1 determines whether the packaged file includes the executable file and the compiled file of the stored development code. If the packaged file includes the executable file and the compiled file of the stored development code, the first server 1 determines that the stored development code is packaged successfully. If the packaged file does not include the executable file or the compiled file of the stored development code, the first server 1 determines that the packaging of the stored development code fails. This embodiment can quickly determine whether the stored development code is packaged successfully by detecting whether the packaged file contains the compiled file and the executable file.
[0037] 203, storing the packaged file in a release warehouse for release.
[0038] In at least one embodiment of the present application, the release warehouse includes a release branch, and the release branch is used to update the monitoring project. The release branch is usually a branch created by a development user in the second server 2.
[0039] In at least one embodiment of the present application, the first server 1 stores the packaged file in the release warehouse for release, including: the first server 1 updates the directory of the release warehouse according to the packaged file to obtain an updated directory, and based on the updated version information and the pre-configured release file name, publishes the files corresponding to the updated directory. Among them, the directory of the release warehouse includes the file names corresponding to the code files pre-stored by the developer in the release branch. The updated version information is the version information corresponding to the development code updated in the second server 2, and the updated version information may include, but is not limited to: the version identifier of the updated development code, the storage timestamp, etc. The release file name is used to identify the file corresponding to the update directory.
[0040] In other embodiments, if the stored development code fails to be packaged, the packaged file is deleted, and steps 201 to 202 are repeated.
[0041] The embodiment of the present application can trigger the verification of the version information and packaging environment of the development code stored in the release warehouse by monitoring the changes of the development code in the second server 2, and then package the stored development code after the version information and packaging environment pass the verification, so as to ensure the packaging stability of the stored development code. After obtaining the packaged file, the embodiment of the present application further stores the packaged file in the release warehouse for release, because there is no need to locate the update code, and the stored development code can be automatically packaged and released, so the release efficiency can be improved.
[0042] like Figure 3 As shown, it is a detailed flow chart of the development code storage method provided in the embodiment of the present application, and the development code storage method is applied to the work agent. Figure 3 As shown, the specific steps include:
[0043] 2011, detecting whether a publishing warehouse is configured in the first server.
[0044] In at least one embodiment of the present application, warehouse information of the monitoring project is provided in the first server 1. The warehouse information may be information such as a publishing warehouse address, a warehouse name, etc. that uniquely identifies the publishing warehouse of the monitoring project. The publishing warehouse includes a code file corresponding to the monitoring project. The first server 1 detects whether the first server 1 contains a publishing warehouse corresponding to the warehouse information. If the first server 1 contains a publishing warehouse corresponding to the warehouse information, it is determined that a publishing warehouse is configured in the first server 1. If the first server 1 does not contain a publishing warehouse corresponding to the warehouse information, it is determined that the publishing warehouse is not configured in the first server 1. This embodiment can quickly determine whether the first server 1 is configured with a publishing warehouse by calling the warehouse information to detect the publishing warehouse. If the first server is configured with a publishing warehouse, jump to step 2012; if the first server is not configured with a publishing warehouse, jump to step 2013.
[0045] 2012, determining updated version information corresponding to the updated development code in the second server, and creating a folder in the release warehouse based on the updated version information.
[0046] In at least one embodiment of the present application, the development code updated in the second server 2 is the development code whose changes are monitored by the first server 1. The updated version information may include, but is not limited to: a version identifier of the updated development code, a storage timestamp, etc. The first server 1 writes the updated version information into the configuration instruction, generates a creation instruction, and calls the creation instruction to create a folder in the release warehouse. Among them, the configuration instruction is used to create a folder. The folder created in this embodiment uses the updated version information as the folder name to uniquely identify the folder.
[0047] 2013, store the acquired development code in a folder.
[0048] 2014, created the release warehouse.
[0049] In at least one embodiment of the present application, the first server 1 creates a publishing warehouse in the first server 1 based on the warehouse information. After the publishing warehouse is created, the first server 1 repeats steps 2011 to 2014.
[0050] By detecting whether the first server includes a publishing warehouse, the embodiment of the present application can create the publishing warehouse in a timely manner, reduce the possibility that the acquired development code cannot be stored in the folder in the publishing warehouse, and improve the storage success rate of the development code.
[0051] like Figure 4 As shown, it is a flowchart of verifying the version information of the stored development code provided by the embodiment of the present application, and the version information verification method is applied to the work agent. Figure 4 As shown, the specific steps include:
[0052] 401, checking whether the updated version information is the same as the version information corresponding to the stored development code.
[0053] In at least one embodiment of the present application, the stored development code is the development code stored in the release warehouse of the first server 1. The stored development code is usually the development code obtained by the first server 1 from the second server 2 when the development code in the second server 2 is updated. The first server 1 compares the update version information with the version information corresponding to the stored development code. If there are multiple update version information, the first server 1 needs to compare each update version information with the version information corresponding to the stored development code one by one. When each update version information is the same as the version information corresponding to the stored development code, it is determined that the update version information is the same as the version information corresponding to the stored development code. For example, the update version information includes CommitIdA and timestamp 10:05, and the version information of the stored development code includes CommitIdA and timestamp 10:05. Since CommitIdA in the update version information is the same as CommitIdA in the version information of the stored development code, and timestamp 10:05 in the update version information is the same as timestamp 10:05 in the version information of the stored development code, the first server 1 determines that the update version information is the same as the version information corresponding to the stored development code. If there is a difference between the update version information and the version information corresponding to the stored development code, it is determined that the update version information is different from the version information corresponding to the stored development code. For example, the update version information includes CommitIdA and timestamp 10:05, and the version information of the stored development code includes CommitIdA and timestamp 10:04. Since timestamp 10:05 in the update version information is different from timestamp 10:04 in the version information of the stored development code, the first server 1 determines that the update version information is different from the version information corresponding to the stored development code. If the updated version information is the same as the version information corresponding to the stored development code, then jump to step 402 ; if the updated version information is different from the version information corresponding to the stored development code, then jump to step 403 .
[0054] 402, determining that the version information of the development code stored in the release repository passes verification.
[0055] 403: Use the development code retrieved from the second server to replace the development code stored in the release warehouse.
[0056] In at least one embodiment of the present application, after the development code stored in the release warehouse is replaced with the development code reacquired from the second server 2 , the development code stored in the release warehouse is the development code reacquired by the first server 1 from the second server 2 .
[0057] 404, check whether the updated version information is the same as the version information corresponding to the replaced development code in the release repository.
[0058] In at least one embodiment of the present application, the first server 1 detects whether the updated version information is the same as the version information corresponding to the replaced development code in the release warehouse in a similar manner as the first server 1 detects whether the updated version information is the same as the version information corresponding to the stored development code, and the present application will not repeat the description. If the updated version information is different from the version information corresponding to the replaced development code in the release warehouse, jump to step 405; if the updated version information is the same as the version information corresponding to the replaced development code in the release warehouse, jump to step 406.
[0059] 405, delete the folder corresponding to the updated version information in the release repository.
[0060] In at least one embodiment of the present application, if the updated version information is different from the version information corresponding to the replaced development code in the release warehouse, it is determined that the version information corresponding to the replaced development code in the release warehouse has not passed the verification. If the updated version information is different from the version information corresponding to the replaced development code in the release warehouse, it means that the replaced development code in the release warehouse is still not the latest code file in the second server 2. By deleting the folder corresponding to the updated version information in the release warehouse, it is possible to avoid publishing the code files in the folder, thereby wasting packaging and publishing resources. After deleting the folder corresponding to the updated version information in the release warehouse, the first server 1 generates a prompt message, which is used to prompt the user that the latest code file in the second server 2 cannot be obtained.
[0061] 406, determining that the version information corresponding to the replaced development code in the release repository passes verification.
[0062] The embodiment of the present application can avoid packaging and publishing non-latest code files in the second server by verifying the version information of the stored development code, thereby reducing the waste of resources.
[0063] like Figure 5 As shown, it is a flowchart of the packaging environment for verifying the stored development code provided by the embodiment of the present application, and the packaging environment verification method is applied to the work agent. Figure 5 As shown, the specific steps include:
[0064] 501, parsing the first support library list and environment name of the stored development code.
[0065] In at least one embodiment of the present application, the first support library list is a support library list in the stored development code, and the first support library list includes the file names of multiple support library files, and the multiple support library files include information required to run the stored development code. The environment name is the name corresponding to the packaging environment of the stored development code. The first server 1 obtains a preset named file from the stored development code as a manifest file, and obtains the first support library list from the manifest file. Among them, the preset name can be requirements.txt or Pipfile.
[0066] 502, detecting whether a packaging environment corresponding to the environment name is configured in the first server.
[0067] In at least one embodiment of the present application, the first server 1 traverses the environment name from the environment list of the first server 1. If the environment name is included in the environment list, it is determined that a packaging environment corresponding to the environment name is configured in the first server. If the environment name is not included in the environment list, it is determined that a packaging environment corresponding to the environment name is not configured in the first server. By setting the environment list, this embodiment can facilitate the detection of whether a packaging environment corresponding to the environment name is configured in the first server. If the packaging environment corresponding to the environment name is not configured in the first server, jump to step 503; if the packaging environment corresponding to the environment name is configured in the first server, jump to step 504.
[0068] 503, create a packaging environment based on the environment name.
[0069] In at least one embodiment of the present application, the first server 1 creates a packaging environment in the first server 1 based on the environment name, and writes the environment name corresponding to the created packaging environment into the environment list.
[0070] 504 , compare the second support library list of the packaging environment with the first support library list.
[0071] In at least one embodiment of the present application, the second support library list is a support library list corresponding to the packaging environment configured in the first server 1, and the second support library list includes the file names of multiple support library files. If the packaging environment does not contain the second support library list, the first support library list is installed in the packaging environment to ensure that the stored development code can be successfully packaged in the packaging environment. If the second support library list is the same as the first support library list, jump to step 505; if the second support library list is different from the first support library list, jump to step 506.
[0072] 505, confirm that the packaging environment has passed the verification.
[0073] 506 , update the second support library list based on the first support library list.
[0074] In at least one embodiment of the present application, the first server 1 updates multiple support library files in the second support library list according to the support library files in the first support library list that are different from those in the second support library list, obtains the updated support library files in the second support library list, and updates the second support library list according to the updated support library files in the second support library list.
[0075] 507, checking whether the second support library list is updated successfully.
[0076] In at least one embodiment of the present application, the first server 1 detects whether the updated second support library list in the packaging environment is the same as the first support library list. If the updated second support library list is the same as the first support library list, it is determined that the second support library list is updated successfully. If the updated second support library list is different from the first support library list, it is determined that the second support library list fails to be updated. If the second support library list is updated successfully, jump to step 508; if the second support library list fails to be updated, jump to step 509.
[0077] 508, confirm that the packaging environment passes the verification.
[0078] 509, The packaging environment has not passed verification.
[0079] The embodiment of the present application can ensure that a packaging environment for the stored development code is configured in the first server by detecting whether a packaging environment is configured in the first server, and can ensure successful packaging of the stored development code by comparing the second support library list with the first support library list.
[0080] like Figure 6 FIG. 1 is a flowchart of a code publishing method provided by another embodiment of the present application. The code publishing method is applied to a first server (eg Figure 1 The first server 1), according to different requirements, the order of the steps in the flowchart can be changed, and some can be omitted.
[0081] 601 , if it is detected that the development code is updated in the second server, the development code obtained from the second server is stored in the release warehouse of the first server.
[0082] The details of step 601 can be found in the above Figure 2 The detailed description of step 201 is not repeated here.
[0083] 602, verify whether the version information of the development code stored in the release warehouse and the packaging environment have passed the verification.
[0084] The details of step 602 can be found in the above Figure 4 Steps 401 to 406 and above Figure 5 The detailed description of steps 501 to 508 is not repeated here.
[0085] This embodiment can ensure the stability of the packaging environment by verifying the version information and the packaging environment.
[0086] 603, if the version information of the development code stored in the release repository or the packaging environment fails to pass the verification, a prompt message is generated.
[0087] In at least one embodiment of the present application, the prompt information is used to prompt the user that the version information or the packaging environment has not passed the verification.
[0088] 604, if the version information and packaging environment of the development code stored in the release warehouse pass the verification, the stored development code is packaged to obtain a package file.
[0089] 605. Based on the packaging file, it is detected whether the stored development code is packaged successfully.
[0090] 606. If the stored development code is packaged successfully, the packaged file is stored in the release warehouse for release.
[0091] The details of steps 604 to 606 can be found above. Figure 2 The detailed description of step 202-step 203 is not repeated here.
[0092] 607, if the stored development code fails to be packaged, delete the packaged file and repeat steps 601 to 607.
[0093] The embodiment of the present application can trigger the verification of the version information and packaging environment of the development code stored in the release warehouse by monitoring the changes of the development code in the second server, and then package the stored development code after the version information and packaging environment pass the verification, so as to ensure the packaging stability of the stored development code. After obtaining the packaged file, the embodiment of the present application further stores the packaged file in the release warehouse for release, because there is no need to locate the update code, and the stored development code can be automatically packaged and released, so the release efficiency can be improved.
[0094] like Figure 7, which is a functional module diagram of a code publishing device provided in an embodiment of the present application. The code publishing device 11 runs on the first server 1. The code publishing device 11 includes a storage unit 110, a packaging unit 111, a publishing unit 112, a replacement unit 113, a determination unit 114, a parsing unit 115, a comparison unit 116, an update unit 117, a judgment unit 118 and a deletion unit 119. The module / unit referred to in the present application refers to a series of computer-readable instruction segments that can be acquired by the processor 13 and can complete a fixed function, which is stored in the memory 12.
[0095] The storage unit 110 is used to store the development code obtained from the second server in the release warehouse of the first server if it is detected that the development code is updated in the second server; the packaging unit 111 is used to package the stored development code to obtain a packaged file if the version information and packaging environment of the development code stored in the release warehouse pass the verification; the release unit 112 is used to store the packaged file in the release warehouse for release.
[0096] Furthermore, the storage unit 110 is also used to determine the update version information corresponding to the development code updated in the second server if a release warehouse is configured in the first server, and create a folder in the release warehouse based on the update version information; and store the acquired development code in the folder.
[0097] Furthermore, before packaging the stored development code to obtain the packaged file, the method also includes: a replacement unit 113, which is used to replace the development code stored in the release warehouse with the development code re-obtained from the second server if the updated version information is different from the version information corresponding to the stored development code; and a determination unit 114, which is used to determine that the version information of the replaced development code in the release warehouse has passed the verification if the updated version information is the same as the version information corresponding to the replaced development code in the release warehouse.
[0098] Furthermore, before the stored development code is packaged to obtain a packaged file, the method also includes: a parsing unit 115, which is used to parse the first support library list and the environment name of the stored development code; a comparison unit 116, which is used to compare the second support library list of the packaging environment with the first support library list if a packaging environment corresponding to the environment name is configured in the first server, and the first support library list and the second support library list include file names of multiple support library files; an updating unit 117, which is used to update the second support library list based on the first support library list if the second support library list is different from the first support library list; and a determination unit 114, which is also used to determine that the packaging environment has passed the verification if the second support library list is updated successfully.
[0099] Furthermore, the packaging unit 111 is also used to obtain pre-configured packaging parameters, the packaging parameters include a file directory; compile the stored development code to obtain a target file and a compiled file; package the target file and the configuration file in the file directory to obtain an executable file; and generate a packaging file based on the compiled file and the executable file.
[0100] Furthermore, before storing the packaged file in the release warehouse for release, the method further includes: a judgment unit 118, which is used to judge whether the packaged file includes the executable file and the compiled file of the stored development code. The determination unit 114 is also used to determine that the stored development code is packaged successfully if the packaged file includes the executable file and the compiled file.
[0101] Furthermore, the deleting unit 119 is used to delete the packaging file if the packaging of the stored development code fails.
[0102] Furthermore, the publishing unit 112 is further configured to update the directory of the publishing warehouse according to the packaged file to obtain an updated directory; and publish files corresponding to the updated directory based on the updated version information and the pre-configured publishing file name.
[0103] The embodiment of the present application can trigger the verification of the version information and packaging environment of the development code stored in the release warehouse by monitoring the changes of the development code in the second server, and then package the stored development code after the version information and packaging environment pass the verification, so as to ensure the packaging stability of the stored development code. After obtaining the packaged file, the embodiment of the present application further stores the packaged file in the release warehouse for release, because there is no need to locate the update code, and the stored development code can be automatically packaged and released, so the release efficiency can be improved.
[0104] like Figure 8 , which is a schematic diagram of the structure of the first server for implementing the code publishing method provided in an embodiment of the present application.
[0105] In one embodiment of the present application, the first server 1 includes, but is not limited to, the first server 1, a memory 12, a processor 13, and computer-readable instructions stored in the memory 12 and executable on the processor 13, such as a code publishing program.
[0106] Those skilled in the art will appreciate that the schematic diagram is merely an example of the first server 1 and does not constitute a limitation on the first server 1. The first server 1 may include more or fewer components than shown in the diagram, or a combination of certain components, or different components. For example, the first server 1 may also include input and output devices, network access devices, buses, etc.
[0107] The processor 13 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor 13 is the computing core and control center of the first server 1, and uses various interfaces and lines to connect various parts of the entire first server 1, and execute the operating system of the first server 1 and various installed application programs, program codes, etc.
[0108] Exemplarily, the computer-readable instructions may be divided into one or more modules / units, one or more modules / units are stored in the memory 12, and are executed by the processor 13 to complete the present application. One or more modules / units may be a series of computer-readable instruction segments capable of completing a specific function, and the computer-readable instruction segments are used to describe the execution process of the computer-readable instructions in the first server 1. For example, the computer-readable instructions may be divided into a storage unit 110, a packaging unit 111, a publishing unit 112, a replacement unit 113, a determination unit 114, a parsing unit 115, a comparison unit 116, an update unit 117, a judgment unit 118, and a deletion unit 119.
[0109] The memory 12 can be used to store computer-readable instructions and / or modules. The processor 13 implements various functions of the first server 1 by running or executing the computer-readable instructions and / or modules stored in the memory 12 and calling the data stored in the memory 12. The memory 12 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the first server 1, etc. The memory 12 can include non-volatile and volatile memories, such as: a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other storage devices.
[0110] The memory 12 may be an external memory and / or an internal memory of the first server 1. Furthermore, the memory 12 may be a memory in a physical form, such as a memory stick, a TF card (Trans-flash Card), and the like.
[0111] If the module / unit integrated in the first server 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also instruct the relevant hardware to complete it through computer-readable instructions. The computer-readable instructions can be stored in a computer-readable storage medium, and when the computer-readable instructions are executed by the processor, the steps of the above-mentioned method embodiments can be implemented.
[0112] The computer-readable instructions include computer-readable instruction codes, which may be in source code form, object code form, executable files, or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer-readable instruction codes, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM).
[0113] Combination Figure 2-6 The memory 12 in the first server 1 stores computer-readable instructions, and the processor 13 can execute the computer-readable instructions stored in the memory 12 to implement the following Figure 2-6 The code publishing method shown.
[0114] Specifically, the specific implementation method of the processor 13 for the above-mentioned computer readable instructions can refer to Figure 2-6 The description of the relevant steps in the corresponding embodiments will not be repeated here.
[0115] In the several embodiments provided in this application, it should be understood that the disclosed server, device and method can be implemented in other ways. For example, the device embodiment described above is only illustrative, for example, the division of modules is only a logical function division, and there may be other division methods in actual implementation.
[0116] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0117] In addition, each functional module in each embodiment of the present application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0118] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present application is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present application. Any attached figure mark in the claims should not be regarded as limiting the claims involved.
[0119] In addition, it is obvious that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any specific order.
[0120] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present application and are not intended to limit it. Although the present application has been described in detail with reference to the preferred embodiments, a person of ordinary skill in the art should understand that the technical solution of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present application.
Claims
1. A code publishing method, characterized in that: Applied to a first server, the method comprises: If it is detected that the development code is updated in the second server, the development code obtained from the second server is stored in the release warehouse of the first server; If the version information and packaging environment of the development code stored in the release warehouse pass the verification, the stored development code is packaged to obtain a package file; The packaged file is stored in the publishing warehouse for publishing.
2. The method according to claim 1, characterized in that The storing the development code obtained from the second server into the release warehouse of the first server includes: If the release warehouse is configured in the first server, determine the update version information corresponding to the development code updated in the second server, and create a folder in the release warehouse based on the update version information; The acquired development code is stored in the folder.
3. The method according to claim 2, characterized in that Before packaging the stored development code to obtain a packaged file, the method further includes: If the updated version information is different from the version information corresponding to the stored development code, replacing the development code stored in the release warehouse with the development code re-obtained from the second server; If the updated version information is the same as the version information corresponding to the replaced development code in the release warehouse, it is determined that the version information of the replaced development code in the release warehouse passes the verification.
4. The method according to claim 1, characterized in that: Before packaging the stored development code to obtain a packaged file, the method further includes: Parsing the first support library list and environment name of the stored development code; If a packaging environment corresponding to the environment name is configured in the first server, a second support library list of the packaging environment is compared with the first support library list, the first support library list and the second support library list including file names of multiple support library files; If the second support library list is different from the first support library list, updating the second support library list based on the first support library list; If the second support library list is updated successfully, it is determined that the packaging environment passes the verification.
5. The method according to claim 1, characterized in that The stored development code is packaged to obtain a package file including: Obtaining pre-configured packaging parameters, wherein the packaging parameters include a file directory; Compiling the stored development code to obtain a target file and a compiled file; Packing the target file and the configuration file in the file directory to obtain an executable file; The package file is generated based on the compiled file and the executable file.
6. The method according to claim 1, characterized in that Before storing the packaged file in the publishing warehouse for publishing, the method further includes: Determining whether the packaged file includes the executable file and the compiled file of the stored development code; If the packaged file includes the executable file and the compiled file, it is determined that the stored development code is packaged successfully.
7. The method according to claim 1, characterized in that The method further comprises: If the stored development code fails to be packaged, the packaged file is deleted.
8. The method according to claim 2, characterized in that: The storing the packaged file to the publishing warehouse for publishing includes: Update the directory of the release warehouse according to the packaged file to obtain an updated directory; Based on the update version information and the pre-configured release file name, the file corresponding to the update directory is released.
9. A code issuing device, characterized in that: Running on a first server, the device comprises: A storage unit, configured to store the development code obtained from the second server in a release warehouse of the first server if it is detected that the development code is updated in the second server; A packaging unit, configured to package the development code stored in the release warehouse to obtain a packaging file if the version information and packaging environment of the development code stored in the release warehouse pass the verification; The publishing unit is used to store the packaged file in the publishing warehouse for publishing.
10. A server, characterized in that: include: a memory storing computer-readable instructions; A processor, wherein the processor executes the computer-readable instructions to implement the code publishing method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions are executed by a processor in the server to implement the code publishing method according to any one of claims 1 to 8.
