Version generation method and device, electronic device and storage medium
By obtaining and integrating incremental file directories and source files in the pipeline and generating target versions, the problem that intermediate product entity file packages cannot be managed remotely is solved, and the efficiency of the build version is improved.
Patent Information
- Application Number
- CN202210848015.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-19
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2042-07-19
AI Technical Summary
Intermediate product entity file packages cannot be remotely managed from Git, resulting in less efficient builds.
By obtaining the version configuration information of the pre-built pipeline, the preset compiler cloned the warehouse data indicated by the warehouse address, obtain the incremental file directory recorded in the branch warehouse indicated by the branch identification, traversing the incremental file directory and reading the information file or obtaining the source code files of other source code directories, and store it in the target path of the preset compiler for integration to generate the target version.
Remote management of intermediate product entity file packages is realized, manual intervention is reduced, and the work efficiency of the build version is improved.
Smart Images

Figure CN115809084B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of financial technology and other related fields, and in particular to a version generation method and device, electronic device and storage medium. Background Art
[0002] Version control is a system that records changes to the content of one or more files so that specific revisions can be referenced later. In addition to project source code, any type of file can be version controlled. Git is an open-source distributed version control system designed to handle any project, small or large, with agility and efficiency. Each developer can clone a complete Git repository to their local machine. Furthermore, the media for version builds (including source code and various intermediate artifacts) can be managed based on Git. Developers can push the media for version builds to the Git repository for online version builds.
[0003] In related technologies, completed intermediate artifacts (such as bundles, a type of file package) are often pushed to a Git repository for storage. The compiler then clones the Git repository to obtain the required resources to build the version. However, due to the large size of intermediate artifacts and the increasing frequency of pushes as demand increases, the Git repository size rapidly expands, affecting daily development work, increasing the time required for cloning and pulling during version building, and reducing work efficiency.
[0004] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention
[0005] The embodiments of the present invention provide a version generation method and device, electronic device and storage medium, so as to at least solve the technical problem in the related art that the intermediate product physical file package cannot be remotely managed without Git, resulting in low efficiency in building versions.
[0006] According to one aspect of an embodiment of the present invention, a version generation method is provided, comprising: obtaining version configuration information of a pre-built pipeline, wherein the version configuration information includes at least: a warehouse address and a branch identifier; using a preset compiler, cloning the warehouse data indicated by the warehouse address, and based on the warehouse data, obtaining an incremental file directory recorded in the branch warehouse indicated by the branch identifier; traversing the incremental file directory, and in the case of traversing to an information file, reading the information file to obtain a download directory of a preset file package corresponding to the information file; or, in the case of traversing to other source code directories, obtaining source code files indicated by the other source code directories, wherein the preset file package is pre-stored in a preset remote machine; storing the folder set indicated by the download directory and the source code files indicated by the other source code directories under the target path of the preset compiler; integrating the folder set and the source code files under the target path to generate a target version.
[0007] Optionally, before obtaining the version configuration information of the pre-built pipeline, it also includes: generating a scheduling service parameterized link, wherein the parameter information carried by the scheduling service parameterized link includes at least: warehouse address, branch identifier, and file package identifier; when the preset source file is submitted to the branch warehouse indicated by the branch identifier, a front-end page request is initiated based on the scheduling service parameterized link, wherein the branch warehouse is a warehouse branch in the warehouse indicated by the warehouse address; based on the front-end page request, a first scheduling service is called; when the first scheduling service sends an execution instruction to the preset remote machine, a preset scaffolding tool is called through the preset remote machine to execute the execution instruction and create a preset file package, wherein the execution instruction is an instruction generated by the first scheduling service based on the front-end page request, and the preset scaffolding tool is pre-deployed in the preset remote machine.
[0008] Optionally, before calling the preset scaffolding tool through the preset remote machine, executing the execution instruction, and producing the preset file package, it also includes: configuring the preset remote machine as the running node of the first scheduling service, wherein the running node is used to execute the execution instruction issued by the first scheduling service and return the execution result; based on the front-end page request, configuring the production date verification instruction, the scaffolding tool version update instruction, and the product dependency file update instruction, wherein the production date verification instruction is used to check whether the file package corresponding to the branch warehouse can be produced based on the production date recorded in the branch warehouse indicated by the branch identifier; the scaffolding tool version update instruction is used to pull the warehouse data indicated by the warehouse address, and obtain the tool version update file maintained by the branch warehouse indicated by the branch identifier based on the warehouse data, and update the dependency version of the preset scaffolding tool based on the tool version update file; the product dependency file update instruction is used to update the product dependency file based on the parameter information; based on the production date verification instruction, the scaffolding tool version update instruction, and the product dependency file update instruction, the execution instruction is obtained.
[0009] Optionally, the preset scaffolding tool is called by the preset remote machine to execute the execution instruction, and the step of producing a preset file package includes: cloning the warehouse data indicated by the warehouse address carried by the product dependency file based on the updated product dependency file through the preset scaffolding tool, and pulling the preset source file in the branch warehouse indicated by the branch identifier carried by the product dependency file based on the warehouse data; compiling the preset source file to obtain a compressed file; based on the low version set, generating a differential file and a signature file corresponding to each low version file package in the low version set to complete the production of the preset file package.
[0010] Optionally, after completing the production of the preset file package, it also includes: based on the number of product versions pre-configured by the preset scaffolding tool, cleaning up other low version sets on the preset remote machine, wherein the other low version sets are not in the low version set indicated by the number of product versions.
[0011] Optionally, the folder collection includes at least: a first folder and a second folder, the first folder stores the signature file, the second folder stores the compressed file and the differential file, and after completing the production of the preset file package, it also includes: based on the package type of the preset file package, generating the information file corresponding to the preset file package, wherein the information file includes at least: the package identifier of the preset file package, and the file path of the preset file package stored in the preset remote machine; creating a first file directory and a second file directory on the preset remote machine to obtain the download directory, wherein the first file directory points to the first folder, and the second file directory points to the second folder; pushing the information file to the branch warehouse where the preset source file is located, and returning the production process and production results of the preset file package to the first scheduling service.
[0012] Optionally, after pushing the information file to the branch warehouse where the preset source file is located, it also includes: obtaining the modified files of each branch warehouse based on the information file corresponding to the branch warehouse; initiating a file synchronization request, wherein the file synchronization request is used to synchronize the modified files of each branch warehouse to the target branch warehouse; based on a preset merge strategy, judging whether the modified file for synchronization conflicts with the modified file in the target branch warehouse; in the case that the modified file for synchronization conflicts with the modified file in the target branch warehouse, using the information file indicated by the modified file in the target branch warehouse as the target information file; in the case that the modified file for synchronization does not conflict with the modified file in the target branch warehouse, executing the file synchronization request, merging the modified file for synchronization with the modified file in the target branch warehouse, and obtaining the target information file of the target branch warehouse.
[0013] Optionally, before obtaining the version configuration information of the pre-built pipeline, it also includes: using a preset continuous integration system to build the pipeline, and performing version configuration to obtain the version configuration information, wherein the version configuration information also includes: scheduling service sequence; based on the version configuration information, generating a preset scheduling task; based on the scheduling service sequence, initiating a corresponding second scheduling service on the pipeline; based on the second scheduling service, sending the preset scheduling task to the compiler cluster; based on a preset load balancing strategy, selecting the preset compiler from the compiler cluster.
[0014] Optionally, when traversing to other source code directories, the step of obtaining the source code files indicated by the other source code directories includes: obtaining the preset language source code files indicated by the other source code directories; compiling the preset language source code files to obtain preset format files, and saving the preset format files to a temporary directory; representing the other language source code files indicated by the other source code directories and the preset format files indicated by the temporary directory as the source code files, and saving them to the target path.
[0015] Optionally, after generating the target version, it also includes: returning the generation information of the target version to the second scheduling service, wherein the second scheduling service returns the generation information to the pipeline built by the preset continuous integration system; when the pipeline transmits the generation information to the test environment, based on the generation information, the target version is obtained, and the target version is deployed on the test environment; when the target version is deployed on the test environment, based on the cleanup script carried by the target version, the inventory products on the preset remote machine are cleaned up, wherein the inventory products are redundant intermediate products generated in the process of making the target version.
[0016] According to another aspect of an embodiment of the present invention, a version generation device is also provided, including: an acquisition unit for acquiring version configuration information of a pre-built pipeline, wherein the version configuration information includes at least: a warehouse address and a branch identifier; a cloning unit for using a preset compiler to clone the warehouse data indicated by the warehouse address, and based on the warehouse data, acquire the incremental file directory recorded in the branch warehouse indicated by the branch identifier; a traversal unit for traversing the incremental file directory, and when traversing to an information file, reading the information file to obtain a download directory of a preset file package corresponding to the information file; or, when traversing to other source code directories, acquiring the source code files indicated by the other source code directories, wherein the preset file package is pre-stored in a preset remote machine; a storage unit for storing the folder set indicated by the download directory and the source code files indicated by the other source code directories under the target path of the preset compiler; a generation unit for integrating the folder set and the source code files under the target path to generate a target version.
[0017] Optionally, the generation device also includes: a first generation module, used to generate a scheduling service parameterized link before obtaining the version configuration information of the pre-built pipeline, wherein the parameter information carried by the scheduling service parameterized link includes at least: a warehouse address, a branch identifier, and a file package identifier; a first initiation module, used to initiate a front-end page request based on the scheduling service parameterized link when submitting the preset source file to the branch warehouse indicated by the branch identifier, wherein the branch warehouse is a warehouse branch in the warehouse indicated by the warehouse address; a first calling module, used to call the first scheduling service based on the front-end page request; a first production module, used to call the preset scaffolding tool through the preset remote machine when the first scheduling service sends the execution instruction to the preset remote machine, execute the execution instruction, and produce a preset file package, wherein the execution instruction is an instruction generated by the first scheduling service based on the front-end page request, and the preset scaffolding tool is pre-deployed in the preset remote machine.
[0018] Optionally, the generation device also includes: a first configuration module, which is used to configure the preset remote machine as the running node of the first scheduling service before calling the preset scaffolding tool through the preset remote machine, executing the execution instruction, and producing the preset file package, wherein the running node is used to execute the execution instruction issued by the first scheduling service and return the execution result; a second configuration module, which is used to configure the production date verification instruction, the scaffolding tool version update instruction, and the product dependency file update instruction based on the front-end page request, wherein the production date verification instruction is used to check whether the file package corresponding to the branch warehouse can be produced based on the production date recorded in the branch warehouse indicated by the branch identifier; the scaffolding tool version update instruction is used to pull the warehouse data indicated by the warehouse address, and obtain the tool version update file maintained by the branch warehouse indicated by the branch identifier based on the warehouse data, and update the dependency version of the preset scaffolding tool based on the tool version update file; the product dependency file update instruction is used to update the product dependency file based on the parameter information; a first output module is used to obtain the execution instruction based on the production date verification instruction, the scaffolding tool version update instruction, and the product dependency file update instruction.
[0019] Optionally, the first production module includes: a first cloning sub-module, which is used to clone the warehouse data indicated by the warehouse address carried by the product dependency file based on the updated product dependency file through the preset scaffolding tool, and pull the preset source file in the branch warehouse indicated by the branch identifier carried by the product dependency file based on the warehouse data; a first compilation sub-module, which is used to compile the preset source file to obtain a compressed file; and a first generation sub-module, which is used to generate a differential file and a signature file corresponding to each low-version file package in the low-version set based on the low-version set, to complete the production of the preset file package.
[0020] Optionally, the generating device also includes: a first cleaning module, which is used to clean up other low version sets on the preset remote machine after completing the production of the preset file package, based on the number of product versions pre-configured by the preset scaffolding tool, wherein the other low version sets are not in the low version sets indicated by the number of product versions.
[0021] Optionally, the folder collection includes at least: a first folder and a second folder, the first folder stores the signature file, and the second folder stores the compressed file and the differential file. The generating device also includes: a second generating module, which is used to generate the information file corresponding to the preset file package based on the package type of the preset file package after completing the production of the preset file package, wherein the information file includes at least: the package identifier of the preset file package and the file path of the preset file package stored in the preset remote machine; a first creation module, which is used to create a first file directory and a second file directory on the preset remote machine to obtain the download directory, wherein the first file directory points to the first folder and the second file directory points to the second folder; a first push module, which is used to push the information file to the branch warehouse where the preset source file is located, and return the production process and production results of the preset file package to the first scheduling service.
[0022] Optionally, the generating device further includes: a first acquisition module, used to acquire the modified files of each branch warehouse based on the information file corresponding to the branch warehouse after pushing the information file to the branch warehouse where the preset source file is located; a second initiation module, used to initiate a file synchronization request, wherein the file synchronization request is used to synchronize the modified files of each branch warehouse to the target branch warehouse; a first judgment module, used to judge whether the modified file for synchronization conflicts with the modified file in the target branch warehouse based on a preset merge strategy; a first characterization module, used to use the information file indicated by the modified file in the target branch warehouse as the target information file when there is a conflict between the modified file for synchronization and the modified file in the target branch warehouse; a first merging module, used to execute the file synchronization request when there is no conflict between the modified file for synchronization and the modified file in the target branch warehouse, merge the modified file for synchronization with the modified file in the target branch warehouse, and obtain the target information file of the target branch warehouse.
[0023] Optionally, the generating device further includes: a third configuration module, which is used to build the pipeline using a preset continuous integration system and perform version configuration before obtaining the version configuration information of the pre-built pipeline to obtain the version configuration information, wherein the version configuration information also includes: a scheduling service sequence; a third generating module, which is used to generate a preset scheduling task based on the version configuration information; a third initiating module, which is used to initiate a corresponding second scheduling service on the pipeline based on the scheduling service sequence; a first issuing module, which is used to issue the preset scheduling task to the compiler cluster based on the second scheduling service; and a first selection module, which is used to select the preset compiler from the compiler cluster based on a preset load balancing strategy.
[0024] Optionally, the traversal unit includes: a second acquisition module, used to acquire the preset language source code file indicated by the other source code directory; a first compilation module, used to compile the preset language source code file to obtain a preset format file, and save the preset format file to a temporary directory; a second representation module, used to represent the other language source code file indicated by the other source code directory and the preset format file indicated by the temporary directory as the source code file, and save them to the target path.
[0025] Optionally, the generation device also includes: a first return module, which is used to return the generation information of the target version to the second scheduling service after generating the target version, wherein the second scheduling service returns the generation information to the pipeline built by the preset continuous integration system; a first deployment module, which is used to obtain the target version based on the generation information when the pipeline transmits the generation information to the test environment, and deploy the target version on the test environment; a second cleaning module, which is used to clean up the inventory products on the preset remote machine based on the cleaning script carried by the target version when deploying the target version on the test environment, wherein the inventory products are redundant intermediate products generated in the process of making the target version.
[0026] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, which includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the version generation method described above.
[0027] According to another aspect of an embodiment of the present invention, an electronic device is also provided, comprising one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the version generation method described above.
[0028] In the present disclosure, the version configuration information of the pre-built pipeline is obtained, a preset compiler is used, the warehouse data indicated by the warehouse address is cloned, and based on the warehouse data, the incremental file directory recorded in the branch warehouse indicated by the branch identifier is obtained, the incremental file directory is traversed, and when the information file is traversed, the information file is read to obtain the download directory of the preset file package corresponding to the information file, or, when other source code directories are traversed, the source code files indicated by other source code directories are obtained, the folder set indicated by the download directory and the source code files indicated by other source code directories are stored in the target path of the preset compiler, the folder set and source code files under the target path are integrated to generate the target version. In this application, the incremental file directory recorded in the branch repository can be traversed, and when the information file is traversed, the download directory of the preset file package corresponding to the information file can be obtained. Then, the folder collection for saving the preset file package can be obtained on the remote machine through the download directory, and saved to the target path of the preset compiler. The source code files indicated by other traversed source code directories can also be saved to the target path of the preset compiler, and then the files under the target path can be integrated to generate the target version. The intermediate product physical file package can be separated from Git management and remote management can be achieved, which avoids a lot of manual intervention and effectively improves the work efficiency of the build version, thereby solving the technical problem in the related technology that the intermediate product physical file package cannot be separated from Git for remote management, resulting in low efficiency of the build version. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0030] Figure 1 is a flowchart of an optional version generation method according to an embodiment of the present invention;
[0031] Figure 2 This is a flowchart of the execution steps of an optional Jenkins task issuing instructions to a remote machine according to an embodiment of the present invention;
[0032] Figure 3 is a flow chart of processing steps for producing a document package product using an optional scaffolding tool according to an embodiment of the present invention;
[0033] Figure 4 1 is a schematic diagram of an optional Git repository branch synchronization process according to an embodiment of the present invention;
[0034] Figure 5 Schematic diagram of an optional process for building a version and obtaining a remote product according to an embodiment of the present invention;
[0035] Figure 6 is a schematic diagram of an optional overall process of version construction according to an embodiment of the present invention;
[0036] Figure 7 is a schematic diagram of an optional version building execution process according to an embodiment of the present invention;
[0037] Figure 8 is a schematic diagram of an optional version of a generating device according to an embodiment of the present invention;
[0038] Figure 9 The figure is a hardware structure block diagram of an electronic device (or mobile device) for a version generation method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0039] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0040] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0041] To facilitate those skilled in the art to understand the present invention, some of the terms or nouns involved in the embodiments of the present invention are explained below:
[0042] Git: is an open source distributed version control system that can effectively and quickly handle version management of projects from very small to very large, and is used to handle any project, small or large, agilely and efficiently.
[0043] Scaffolding tool: It is a metaprogramming method used to build database-based applications.
[0044] Jenkins: is a continuous integration tool that allows continuous integration and continuous delivery of projects. It can handle any type of build or continuous integration, and Jenkins can be integrated with some testing and deployment technologies.
[0045] Devops: is a combination of Development and Operations. It is a general term for a set of processes, methods and systems that are used to promote communication, collaboration and integration between development (application / software engineering), technical operations and quality assurance (QA) departments. It can make building, testing and releasing software faster, more frequent and more reliable by automating the processes of "software delivery" and "architecture changes".
[0046] Continuous Integration (CI): refers to the build or integration phase of the software release process, which requires the use of automation components (for example, CI or build services) and cultural components (for example, learning to integrate frequently). Its main goals are to find and resolve defects faster, improve software quality, and reduce the time required to verify and release new software updates.
[0047] It should be noted that the version generation method and device in the present disclosure can be used in the field of financial technology when generating versions, and can also be used in any field other than the field of financial technology when generating versions. The present disclosure does not limit the application field of the version generation method and device.
[0048] It should be noted that the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display and analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties. For example, an interface is set up between this system and the relevant user or organization. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain the relevant information after receiving the consent information fed back by the aforementioned user or organization.
[0049] The following embodiments of the present invention are applicable to various systems, applications, and devices that generate versions. The present invention can utilize the Git branch synchronization mechanism to accurately locate and retrieve a variety of remote intermediate artifacts, thereby replacing the related art method of obtaining intermediate artifacts from Git. It can also implement automated management processes, solving the versioning issues of intermediate artifacts (such as bundle artifacts) after they are separated from Git. It can also effectively avoid extensive manual intervention and allow the system to automatically manage them.
[0050] The present invention can first establish a remote machine (such as a Linux remote machine) for making products and performing storage management, use Jenkins to call the scaffolding tool configured on the machine (such as the IFTide tool, which is an optional scaffolding tool configured by the present invention), and obtain the source code of the corresponding branch of Git according to the current version to make intermediate products. The intermediate product entity file package can be stored on the current remote machine, and each type of product pushes a corresponding information file to the corresponding branch of Git. The content of the information file is the product storage path corresponding to the current product version. The information file can be synchronized with the Git branch to the subsequent production branch. In addition, during the online version construction process, the compiler can traverse and read the incremental updated information files in the Git warehouse through the script, obtain the storage path of each product currently produced, and download it through data transmission between remote machines. At the same time, the version can bring out the server cleanup script to automatically clean up the redundant inventory products on the server.
[0051] The intermediate product in the present invention is a file package (such as a bundle type file package, or an intermediate product of other version types such as apk, ipa, etc.) produced using a scaffolding tool (such as the IFTide scaffolding tool). The scaffolding tool in the present invention can rely on node (an open source type) and npm (another open source type) sources, and can use a programming language (such as JavaScript). First, a local environment is set up to install the dependencies, and a preset file (such as json) is used to save each dependency version. Then, Git's SSH (a network security protocol) connection is configured to clone the Git repository and obtain the product source code in the repository to produce the file package.
[0052] The present invention will be described in detail below with reference to various embodiments.
[0053] Example 1
[0054] According to an embodiment of the present invention, an embodiment of a version generation method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0055] Figure 1 is a flowchart of an optional version generation method according to an embodiment of the present invention, such as Figure 1 As shown, the method includes the following steps:
[0056] Step S101: Obtain the version configuration information of the pre-built pipeline, wherein the version configuration information at least includes: a warehouse address and a branch identifier.
[0057] Step S102: Using a preset compiler, clone the warehouse data indicated by the warehouse address, and based on the warehouse data, obtain the incremental file directory recorded in the branch warehouse indicated by the branch identifier.
[0058] Step S103, traverse the incremental file directory, and when traversing to the information file, read the information file to obtain the download directory of the preset file package corresponding to the information file; or, when traversing to other source code directories, obtain the source code files indicated by other source code directories, wherein the preset file package is pre-stored in the preset remote machine.
[0059] Step S104: storing the folder set indicated by the download directory and the source code files indicated by other source code directories in a target path of a preset compiler.
[0060] Step S105 , integrating the folder set and source code files under the target path to generate a target version.
[0061] Through the above steps, the version configuration information of the pre-built pipeline can be obtained, and the preset compiler can be used to clone the warehouse data indicated by the warehouse address, and based on the warehouse data, the incremental file directory recorded in the branch warehouse indicated by the branch identifier can be obtained, and the incremental file directory can be traversed. When the information file is traversed, the information file is read to obtain the download directory of the preset file package corresponding to the information file, or, when other source code directories are traversed, the source code files indicated by other source code directories are obtained, and the folder set indicated by the download directory and the source code files indicated by other source code directories are stored in the target path of the preset compiler, and the folder set and source code files under the target path are integrated to generate the target version. In an embodiment of the present invention, the incremental file directory recorded in the branch repository can be traversed, and when the information file is traversed, the download directory of the preset file package corresponding to the information file can be obtained. Then, the folder collection for saving the preset file package can be obtained on the remote machine through the download directory, and saved to the target path of the preset compiler. The source code files indicated by other traversed source code directories can also be saved to the target path of the preset compiler, and then the files under the target path can be integrated to generate the target version. The intermediate product physical file package can be separated from Git management and remote management can be achieved, which avoids a lot of manual intervention and effectively improves the work efficiency of the build version, thereby solving the technical problem in the related technology that the intermediate product physical file package cannot be separated from Git for remote management, resulting in low efficiency of the build version.
[0062] The embodiment of the present invention is described in detail below in conjunction with the above steps.
[0063] In an embodiment of the present invention, an optional method, before obtaining the version configuration information of the pre-built pipeline, further includes: generating a scheduling service parameterized link, wherein the parameter information carried by the scheduling service parameterized link includes at least: a warehouse address, a branch identifier, and a file package identifier; in the case of submitting the preset source file to the branch warehouse indicated by the branch identifier, initiating a front-end page request based on the scheduling service parameterized link, wherein the branch warehouse is a warehouse branch in the warehouse indicated by the warehouse address; based on the front-end page request, calling the first scheduling service; in the case of the first scheduling service sending the execution instruction to the preset remote machine, calling the preset scaffolding tool through the preset remote machine, executing the execution instruction, and making a preset file package, wherein the execution instruction is an instruction generated by the first scheduling service based on the front-end page request, and the preset scaffolding tool is pre-deployed in the preset remote machine.
[0064] In an embodiment of the present invention, a parameterized link for remotely calling a Jenkins service (i.e., generating a parameterized link for a scheduling service) may be configured first. The parameter information carried by the parameterized link for the scheduling service may include attributes such as a repository address, a branch identifier, and a file package identifier. After the developer submits a preset source file (e.g., a bundle source file, which may include the business code modified by the developer) as needed (i.e., when the preset source file is submitted to a branch repository indicated by a branch identifier, the branch repository is a repository branch in the repository indicated by the repository address), a front-end page request is initiated through the parameterized link for the scheduling service. Based on the front-end page request, a corresponding first Jenkins task (i.e., a first scheduling service) is remotely called. After the first Jenkins task is started, an execution instruction is sent to a preset remote machine. After the preset remote machine obtains the execution instruction, a scaffolding tool (e.g., an IFTide scaffolding tool) pre-deployed on the preset remote machine is called to obtain the Git corresponding branch source code according to the specific steps and requirements in the execution instruction, thereby completing the production of a preset file package (e.g., a bundle package) (i.e., when the first scheduling service sends the execution instruction to the preset remote machine, the preset scaffolding tool is called by the preset remote machine to execute the execution instruction and produce the preset file package).
[0065] Optionally, before calling the preset scaffolding tool through the preset remote machine, executing the execution instruction, and producing the preset file package, it also includes: configuring the preset remote machine as the running node of the first scheduling service, wherein the running node is used to execute the execution instruction issued by the first scheduling service and return the execution result; based on the front-end page request, configuring the production date verification instruction, the scaffolding tool version update instruction, and the product dependency file update instruction, wherein the production date verification instruction is used to check whether the file package corresponding to the branch warehouse can be produced based on the production date recorded in the branch warehouse indicated by the branch identifier; the scaffolding tool version update instruction is used to pull the warehouse data indicated by the warehouse address, and obtain the tool version update file maintained by the branch warehouse indicated by the branch identifier based on the warehouse data, and update the dependency version of the preset scaffolding tool based on the tool version update file; the product dependency file update instruction is used to update the product dependency file based on parameter information; based on the production date verification instruction, the scaffolding tool version update instruction, and the product dependency file update instruction, the execution instruction is obtained.
[0066] In an embodiment of the present invention, the preset remote machine can be first configured as the running node of the first scheduling service (that is, the preset remote machine can be first configured as the slave (i.e., slave node) of the Jenkins platform and as the designated running node of the first Jenkins task). The running node is used to execute the execution instructions issued by the first scheduling service and return the execution results. Afterwards, based on the front-end page request, an execution function (such as a shell execution function) can be configured in the first Jenkins task (i.e., the first scheduling service) to obtain an execution instruction, wherein the execution instruction may include: a commissioning date verification instruction, which is used to verify whether the file package corresponding to the branch warehouse can be produced based on the commissioning date recorded in the branch warehouse indicated by the branch identifier (i.e., perform a commissioning date verification to determine whether the corresponding file package can be produced); a scaffolding tool version update instruction, which is used to pull the warehouse data indicated by the warehouse address, and obtain the tool version update file maintained by the branch warehouse indicated by the branch identifier based on the warehouse data, and update the dependency version of the preset scaffolding tool based on the tool version update file (i.e., clone and pull the Git warehouse, and update the dependency version of the preset scaffolding tool (such as the dependency version of the IFTide scaffolding tool) according to the tool version update file (such as the package.json file) developed and maintained on the Git branch); a product dependency file update instruction, which is used to update the product dependency file based on parameter information (i.e., the parameter information in the front-end page request can be refreshed to the product dependency file (such as the config.json file) that the product production depends on).
[0067] Figure 2 FIG. 1 is a flowchart of an optional Jenkins task issuing instructions to a remote machine according to an embodiment of the present invention. Figure 2 As shown, the following steps are included:
[0068] Step S201: Configure the remote machine as a slave of the Jenkins platform and as the designated running node for the Jenkins task;
[0069] Step S202: Configure the Shell execution function in the Jenkins task to obtain a Shell execution instruction, wherein the specific steps of the Shell execution instruction are S203 to S207;
[0070] Step S203: Verify on the production date to determine whether the corresponding file package can be produced;
[0071] Step S204: Update the dependent version of the IFTide scaffolding tool, clone and pull the Git repository, and update the dependent version of the IFTide scaffolding tool according to the package.json file developed and maintained on the Git branch;
[0072] Step S205: Refresh the config.json file and update the parameter information in the front-end page request to the config.json file that the product production depends on;
[0073] Step S206: Start the file package creation process by executing commands according to the config.json file;
[0074] Step S207: After the file package is created, adjust the path to the specified directory to facilitate access during version building.
[0075] Optionally, the steps of calling a preset scaffolding tool through a preset remote machine and executing execution instructions to produce a preset file package include: cloning the warehouse data indicated by the warehouse address carried by the product dependency file based on the updated product dependency file through the preset scaffolding tool, and pulling the preset source file in the branch warehouse indicated by the branch identifier carried by the product dependency file based on the warehouse data; compiling the preset source file to obtain a compressed file; based on the low version set, generating a differential file and a signature file corresponding to each low version file package in the low version set to complete the production of the preset file package.
[0076] In an embodiment of the present invention, the preset scaffolding tool can clone the specified Git repository based on the updated product dependency file (such as the config.json dependency file), pull the specified branch, and obtain the source code files (such as js source code, etc.) required for this file package production (that is, through the preset scaffolding tool based on the updated product dependency file, clone the warehouse data indicated by the warehouse address carried by the product dependency file, and based on the warehouse data, pull the preset source file in the branch warehouse indicated by the branch identifier carried by the product dependency file). After that, the source code file is compiled. After the compilation is completed, a compressed file (such as a zip file) is obtained, and at the same time, a differential file and a signature file corresponding to the low-version file package are generated (that is, based on the low-version set, a differential file and a signature file corresponding to each low-version file package in the low-version set are generated) to complete the preset file package production process.
[0077] Optionally, after completing the production of the preset file package, it also includes: based on the number of product versions pre-configured by the preset scaffolding tool, cleaning up other low version sets on the preset remote machine, wherein the other low version sets are low version sets that are not in the low version sets indicated by the number of product versions.
[0078] In an embodiment of the present invention, the low-version products that are no longer needed on the remote machine can be cleaned up according to the number of product versions pre-configured by the preset scaffolding tool (that is, other low-version sets on the preset remote machine are cleaned up, and the other low-version sets are not in the low-version sets indicated by the number of product versions).
[0079] Optionally, the folder collection includes at least: a first folder and a second folder, the first folder stores a signature file, and the second folder stores a compressed file and a differential file. After completing the production of the preset file package, it also includes: based on the package type of the preset file package, generating an information file corresponding to the preset file package, wherein the information file includes at least: the package identifier of the preset file package, and the file path of the preset file package stored in the preset remote machine; creating a first file directory and a second file directory on the preset remote machine to obtain a download directory, wherein the first file directory points to the first folder and the second file directory points to the second folder; pushing the information file to the branch warehouse where the preset source file is located, and returning the production process and production results of the preset file package to the first scheduling service.
[0080] In an embodiment of the present invention, an information file corresponding to the preset file package can be generated according to the package type of the preset file package, and the information file can be pushed to the branch warehouse where the preset source file is located. The information file may include: the package identifier of the preset file package, the file path where the preset file package is stored in the preset remote machine, etc., and a first file directory (i.e., APP directory) and a second file directory (i.e., WEB directory) can also be created on the preset remote machine to obtain a download directory. After that, the production process and production results of the preset file package can be returned to the first scheduling service, wherein the first file directory points to the first folder (the first folder stores the signature file), and the second file directory points to the second folder (the second folder stores the compressed file and the differential file). After that, a folder set (the folder set includes at least: the first folder and the second folder) can be obtained through the download directory.
[0081] Figure 3 FIG. 1 is a flowchart of processing steps for producing a document package product using an optional scaffolding tool according to an embodiment of the present invention. Figure 3 As shown, the following steps are included:
[0082] Step S301: The scaffolding tool clones the specified Git repository based on the config.json dependency file after refreshing the parameters, pulls the specified branch, and obtains the source code files required for this file package creation;
[0083] Step S302: Compile the source code file. After the compilation is completed, a compressed file is obtained. At the same time, a differential file and a signature file corresponding to the low-version file package are generated to complete the file package product production process. At the same time, according to the number of product versions pre-configured by the scaffolding tool, the low-version products that are no longer needed on the remote machine are cleared;
[0084] Step S303: Generate an information file containing the directory name and push it back to the branch where the source code file is located;
[0085] Step S304: Create APP and WEB directories on the remote machine, place the compressed file and differential file in the WEB directory, and place the signature file in the APP directory to prepare for version acquisition.
[0086] Optionally, after pushing the information file to the branch warehouse where the preset source file is located, it also includes: obtaining the modified files of each branch warehouse based on the information file corresponding to the branch warehouse; initiating a file synchronization request, wherein the file synchronization request is used to synchronize the modified files of each branch warehouse to the target branch warehouse; based on the preset merge strategy, judging whether the modified file for synchronization conflicts with the modified file in the target branch warehouse; in the case that the modified file for synchronization conflicts with the modified file in the target branch warehouse, using the information file indicated by the modified file in the target branch warehouse as the target information file; in the case that the modified file for synchronization does not conflict with the modified file in the target branch warehouse, executing the file synchronization request, merging the modified file for synchronization with the modified file in the target branch warehouse, and obtaining the target information file of the target branch warehouse.
[0087] In an embodiment of the present invention, based on the information file corresponding to the branch warehouse, the modified files of each branch warehouse can be obtained, and the developer or an automatic tool can initiate a file synchronization request. The file synchronization request is used to synchronize the modified files of each branch warehouse to the target branch warehouse. After that, based on a preset merge strategy (such as the branch three-way merge principle), it can be determined whether the modified files for synchronization conflict with the modified files in the target branch warehouse (that is, it can be determined whether the syncable files have a merge conflict based on the branch three-way merge principle). In the case that the modified files for synchronization conflict with the modified files in the target branch warehouse, the information file indicated by the modified file in the target branch warehouse is used as the target information file (that is, the conflicting files can be based on the target branch warehouse, or can be modified and processed on site, or can be processed by the developer as needed afterwards); in the case that the modified files for synchronization do not conflict with the modified files in the target branch warehouse, the file synchronization request is executed to merge the modified files for synchronization with the modified files in the target branch warehouse to obtain the target information file of the target branch warehouse (that is, files without conflicts can be directly synchronized to the target branch warehouse).
[0088] Figure 4 is a schematic diagram of an optional Git repository branch synchronization process according to an embodiment of the present invention, such as Figure 4 As shown, taking the file synchronization from Git branch 401 to Git branch 402 (i.e., the target branch repository) as an example, a schematic description is given, which specifically includes the following steps:
[0089] Step S401: Push modifications to Git branch 401 and push modifications to Git branch 402;
[0090] Step S402: A developer or an automatic tool initiates a branch synchronization operation from branch 401 to branch 402 (i.e., initiates branch synchronization);
[0091] Step S403: Git determines whether there is a merge conflict in the syncable files based on the three-way branch merge principle;
[0092] Step S404: If there is a conflict, the conflicting files can be based on branch 402, and can also be processed on-site or afterwards; if there is no conflict, the conflict-free files can be synchronized to the target branch (ie branch 402).
[0093] In this embodiment, if the source code file of branch 402 has been used to create a file, the modified information file will be pushed to branch 402. Otherwise (i.e., the source code file of branch 402 has not been used to create a file), the modified information file will not be pushed to branch 402. Afterwards, according to the three-way merge principle, when the information file is modified in the target branch 402, a merge conflict will occur. The target branch 402 will prevail over the file. Otherwise (i.e., the information file has not been modified in the target branch 402), the source branch 401 will prevail. In this way, it can be ensured that the information file in the current branch always has the latest content of the highest existing version.
[0094] Optionally, before obtaining the version configuration information of the pre-built pipeline, it also includes: using a preset continuous integration system to build the pipeline, and performing version configuration to obtain version configuration information, wherein the version configuration information also includes: scheduling service order; based on the version configuration information, generating a preset scheduling task; based on the scheduling service order, initiating a corresponding second scheduling service on the pipeline; based on the second scheduling service, sending the preset scheduling task to the compiler cluster; based on the preset load balancing strategy, selecting a preset compiler from the compiler cluster.
[0095] In an embodiment of the present invention, a preset continuous integration system (for example, a Devops continuous integration system) can be used to build a pipeline, and version configuration can be performed to obtain version configuration information. The version configuration information also includes: a scheduling service sequence. Afterwards, a Jenkins task (i.e., a preset scheduling task) can be automatically generated based on the version configuration information, and a corresponding second Jenkins task can be initiated in the background through the pipeline (i.e., based on the scheduling service sequence, a corresponding second scheduling service can be initiated on the pipeline). After the second Jenkins task is started, the preset scheduling task will be issued to the compiler cluster (i.e., based on the second scheduling service, the preset scheduling task will be issued to the compiler cluster). After that, the compiler cluster can allocate compilers according to load balancing for version construction (i.e., based on the preset load balancing strategy, a preset compiler is selected from the compiler cluster).
[0096] Step S101: Obtain the version configuration information of the pre-built pipeline, wherein the version configuration information at least includes: a warehouse address and a branch identifier.
[0097] In an embodiment of the present invention, the version configuration information of the pipeline built by the continuous integration system can be obtained first. The version configuration information includes at least a warehouse address and a branch identifier, so as to obtain the files required for the version construction according to the version configuration information.
[0098] Step S102: Using a preset compiler, clone the warehouse data indicated by the warehouse address, and based on the warehouse data, obtain the incremental file directory recorded in the branch warehouse indicated by the branch identifier.
[0099] In an embodiment of the present invention, a preset compiler machine selected according to load balancing is used to clone the warehouse data indicated by the warehouse address, and based on the warehouse data, the incremental file directory recorded in the branch warehouse indicated by the branch identifier is obtained to obtain the intermediate products required for version building.
[0100] Step S103, traverse the incremental file directory, and when traversing to the information file, read the information file to obtain the download directory of the preset file package corresponding to the information file; or, when traversing to other source code directories, obtain the source code files indicated by other source code directories, wherein the preset file package is pre-stored in the preset remote machine.
[0101] In an embodiment of the present invention, the various information files on the Git branch can be traversed through a compilation script, and the information files can be read separately (that is, the incremental file directory can be traversed, and when the information file is traversed, the information file is read), and the download directory of the preset file package corresponding to the information file (the preset file package is pre-stored in the preset remote machine) can be obtained, and when other source code directories are traversed, the source code files indicated by other source code directories can be obtained.
[0102] Optionally, when traversing to other source code directories, the step of obtaining the source code files indicated by other source code directories includes: obtaining the preset language source code files indicated by other source code directories; compiling the preset language source code files to obtain preset format files, and saving the preset format files to a temporary directory; representing the other language source code files indicated by other source code directories and the preset format files indicated by the temporary directory as source code files, and saving them to the target path.
[0103] In an embodiment of the present invention, when there are other source code (such as java, jsp) directories in the incremental file directory, the preset language (such as java) source code files indicated by the other source code directories are obtained, the preset language source code files are compiled to obtain preset format files (class files), and the preset format files are saved to a temporary directory. The other language source code files indicated by the other source code directories and the preset format files indicated by the temporary directory are represented as source code files and saved to the target path of the compiler.
[0104] Step S104: storing the folder set indicated by the download directory and the source code files indicated by other source code directories in a target path of a preset compiler.
[0105] In an embodiment of the present invention, the folder set indicated by the download directory (including the APP folder and the WEB folder) and the source code files indicated by other source code directories are stored in a target path of a preset compiler.
[0106] Step S105 , integrating the folder set and source code files under the target path to generate a target version.
[0107] In an embodiment of the present invention, the compiler can uniformly integrate and compress the contents under the target path (including folder collections and source code files) to generate a target version, wherein the contents under the target path can also include a cleanup script for cleaning up redundant intermediate products.
[0108] Figure 5 FIG. 1 is a schematic diagram of an optional process of building a version and obtaining a remote product according to an embodiment of the present invention. Figure 5 As shown in the figure, a bundle product is used as an example to provide a schematic description, which specifically includes the following steps:
[0109] Step S501: Obtain the Git incremental directory. According to the basic configuration of the DevOps pipeline, the compiler can clone the specified Git repository and obtain the incremental directory of the specified branch;
[0110] Step S502: Determine whether there is an information file in the incremental directory. If not, skip S503-S504.
[0111] Step S503: traverse the information files and obtain the download path. By looping through all the information files in the incremental directory, when a certain type of information file is found, it means that the corresponding bundle product has been updated. Read the information file and obtain the download directory of the bundle product. Then execute S504. If the traversal fails, the traversal ends.
[0112] Step S504: Download the bundle product to the target path. On the compilation machine, use a preset command (such as the wget command) to remotely download the APP and WEB folders in the remote machine's download directory and save them to the compilation machine's version target path. The APP and WEB directories can be deployed on the application server and the WEB front-end server respectively. Return to S503 to continue traversal.
[0113] Step S505: Determine whether there are other source code (such as java, jsp) directories in the incremental directory. If not, skip S506-S507;
[0114] Step S506: perform incremental Java compilation and save the compiled class files in a temporary directory;
[0115] Step S507: Obtain the required media to the target path, and save the obtained source code other than Java and the class files in the temporary directory to the target path of the compiler;
[0116] Step S508: Integrate the target path to generate a version. After steps S504 and S507 are completed, the compiler integrates and compresses the contents under the target path to generate a version.
[0117] Step S509: After S508 is completed, the build is successful. If the judgments of S502 and S505 are both negative, the version building is terminated.
[0118] Optionally, after generating the target version, it also includes: returning the generation information of the target version to the second scheduling service, wherein the second scheduling service returns the generation information to the pipeline built by the preset continuous integration system; when the pipeline transmits the generation information to the test environment, based on the generation information, the target version is obtained, and the target version is deployed on the test environment; when the target version is deployed on the test environment, based on the cleanup script carried by the target version, the inventory artifacts on the preset remote machine are cleaned up, wherein the inventory artifacts are redundant intermediate artifacts generated in the process of producing the target version.
[0119] In an embodiment of the present invention, after the version is built, the generation information of the target version can be returned to the second scheduling service in the form of a log, and then returned to the pipeline (i.e., the pipeline built by the preset continuous integration system) by the second scheduling service. After the pipeline obtains the generation information, it can be transmitted to the test environment for version acquisition and deployment (i.e., when the pipeline transmits the generation information to the test environment, the target version is obtained based on the generation information, and the target version is deployed on the test environment). At the same time, the cleanup script brought out by the version can be executed to clean up redundant inventory products on the server (i.e., when the target version is deployed on the test environment, the inventory products on the preset remote machine are cleaned up based on the cleanup script carried by the target version. The inventory products are redundant intermediate products generated in the process of making the target version).
[0120] The following describes in detail another optional specific implementation.
[0121] This embodiment can adopt the four-layer technical service model of "WEB front-end page request / system-Jenkins service platform-Linux server-Git warehouse" to realize the version construction method of accurately obtaining non-Git source media online.
[0122] Figure 6 FIG. 1 is a schematic diagram of an optional overall process of building a version according to an embodiment of the present invention. Figure 6 As shown, it may include: WEB front-end page request / system 001, Jenkins service platform 002, Linux server 003, Git warehouse 004, wherein,
[0123] The WEB front-end page request / system 001 includes: Web request 101 and Devops continuous integration 102, wherein the Web request 101 can call the instruction of the jenkins service 1 (201), which can be composed of a Jenkins remote trigger command and various parameterized configurations, and can be personalized to remotely initiate Jenkins tasks according to different needs; the Devops continuous integration 102 saves the relevant configurations such as version building and deployment in the pipeline, and after startup, it can call the background jenkins service 2 (202), thereby triggering the next step.
[0124] The Jenkins service platform 002 is used to establish platform connections, issue execution instructions and send back information. Among them, Jenkins service 1 (201) establishes connections between developers and intermediate product remote machines 301 through Web requests 101, helping developers to remotely initiate the bundle production process; Jenkins service 2 (202) establishes connections between DevOps continuous integration 102 and version compilation machine cluster 303, and the pipeline can initiate the version building process.
[0125] The Linux server 003 includes an intermediate product remote machine 301 and a version compilation machine cluster 303. The developer initiates the bundle creation process through the Jenkins service 1 (201). The IFTide tool 302 used for creation is deployed on the intermediate product remote machine 301. After creation is completed, the information file corresponding to the bundle type is pushed to the corresponding branch of the Git repository 004. After receiving the instructions from the Jenkins service 2 (202), the version compilation machine cluster 303 automatically allocates a compilation machine through load balancing to download the media required for the version from the corresponding branch of the Git repository 004 and the intermediate product remote machine 301 to build the version. After the version is completed, the DevOps continuous integration 102 initiates the next step and transfers the version from the compilation machine to the test environment 005 for deployment.
[0126] Git repository 004 can store various source codes by branch. Developers and various tools can obtain the source code of the entire repository by cloning. Among them, the modified content of Git branch 1 (401) can be synchronized through the branch, so that Git branch 2 (402) includes the modified content of Git branch 1 (401).
[0127] Figure 7 is a schematic diagram of an optional version building execution process according to an embodiment of the present invention, such as Figure 7As shown, the following steps are included:
[0128] Step S701: Configure the Jenkins trigger link to initiate a web request. Before the version is built, you can configure a parameterized link for remotely calling the Jenkins service. The parameters may include properties such as the Git repository address, branch name, and bundle name. After the developer submits the bundle source file as needed, a web request is initiated through the link to remotely call and execute the corresponding Jenkins task 1.
[0129] Step S702: Start Jenkins task 1 and send instructions to the remote machine;
[0130] Step S703: The bundle artifact is created and the information file is pushed. The remote machine receives the instructions and calls the deployed IFTide tool. Following the specific steps and requirements in the instructions, the Git source code for the corresponding branch is retrieved to complete the bundle creation. Once the artifact is complete, an information file is generated based on the type of bundle created. This information file stores the bundle's location in the specified path on the remote machine and is pushed back to the source code branch. Simultaneously, the artifact creation process and results on the remote machine are returned to Jenkins in log form for developers to review.
[0131] Step S704: Git branch synchronization;
[0132] Step S705: Devops pipeline configuration: The Devops continuous integration system builds the pipeline and performs version-related configuration. After the configuration is completed, a Jenkins task is automatically generated, and the corresponding Jenkins task 2 can be initiated in the background through the pipeline;
[0133] Step S706: Start Jenkins task 2 and issue instructions to the version compiler cluster;
[0134] Step S707: The command is issued to the version compiler cluster, which can allocate compilers according to load balancing to perform version building;
[0135] Step S708: Information files can be obtained from the Git branch, and bundles can be obtained based on the information files. A compiler can be assigned to produce a version. Specifically, the assigned compiler can clone the remote Git repository, traverse each information file on the Git branch through the compilation script, read the remote machine path of the corresponding bundle respectively, and download it. The remote machine path is integrated with other source code and artifacts in the Git repository and the cleanup script to complete the version building.
[0136] Step S709: Deploy the test environment and clean up redundancies. Specifically, after the version is built, the version information is returned to Jenkins task 2 in the form of a log, and then returned to the Devops pipeline by Jenkins task 2. After the pipeline obtains the version information, it is transmitted to the test environment for version acquisition and deployment. During the deployment, the cleanup script brought out by the version is executed to clean up the redundant inventory products on the server.
[0137] In this embodiment of the present invention, remote management of intermediate artifact entities enables rapid overall version processing, a small Git footprint, fast cloning, and low server resource usage. Developers can use Jenkins to call remote machines online to create artifacts and clean up redundancies, eliminating the need to build a local infrastructure, create artifacts, and submit them to the Git repository. Furthermore, adding new artifacts eliminates the need to change the version building logic, effectively reducing manual operation costs.
[0138] This embodiment can also accurately obtain the latest content required for the version building process, reduce redundancy, and achieve version slimming. The server can be cleaned and maintained daily after each deployment. At the same time, it can effectively reduce the overall construction time, assist developers and version production personnel to improve work efficiency, lay the foundation for the rapid delivery of software products and services, and provide technical support for the remote management of media and product version automation processes.
[0139] The following describes it in detail with reference to another embodiment.
[0140] Example 2
[0141] A version of the generation device provided in this embodiment includes multiple implementation units, each implementation unit corresponding to each implementation step in the above-mentioned embodiment 1.
[0142] Figure 8 is a schematic diagram of an optional version of a generating device according to an embodiment of the present invention, such as Figure 8 As shown, the generating device may include: an acquiring unit 80, a cloning unit 81, a traversing unit 82, a storage unit 83, and a generating unit 84, wherein:
[0143] The acquisition unit 80 is used to obtain the version configuration information of the pre-built pipeline, wherein the version configuration information includes at least: a warehouse address and a branch identifier;
[0144] The cloning unit 81 is configured to clone the warehouse data indicated by the warehouse address using a preset compiler, and obtain the incremental file directory recorded in the branch warehouse indicated by the branch identifier based on the warehouse data;
[0145] The traversal unit 82 is configured to traverse the incremental file directory and, if an information file is found, read the information file to obtain a download directory of a preset file package corresponding to the information file; or, if another source code directory is found, obtain the source code file indicated by the other source code directory, wherein the preset file package is pre-stored in a preset remote machine;
[0146] The storage unit 83 is used to store the folder set indicated by the download directory and the source code files indicated by other source code directories in a target path of a preset compiler;
[0147] The generating unit 84 is used to integrate the folder set and source code files under the target path to generate a target version.
[0148] The above-mentioned generation device can obtain the version configuration information of the pre-built pipeline through the acquisition unit 80, use the preset compiler through the cloning unit 81 to clone the warehouse data indicated by the warehouse address, and based on the warehouse data, obtain the incremental file directory recorded in the branch warehouse indicated by the branch identifier, traverse the incremental file directory through the traversal unit 82, and when traversing to the information file, read the information file to obtain the download directory of the preset file package corresponding to the information file, or, when traversing to other source code directories, obtain the source code files indicated by other source code directories, store the folder set indicated by the download directory and the source code files indicated by other source code directories in the target path of the preset compiler through the storage unit 83, and integrate the folder set and source code files under the target path through the generation unit 84 to generate the target version. In an embodiment of the present invention, the incremental file directory recorded in the branch repository can be traversed, and when the information file is traversed, the download directory of the preset file package corresponding to the information file can be obtained. Then, the folder collection for saving the preset file package can be obtained on the remote machine through the download directory, and saved to the target path of the preset compiler. The source code files indicated by other traversed source code directories can also be saved to the target path of the preset compiler, and then the files under the target path can be integrated to generate the target version. The intermediate product physical file package can be separated from Git management and remote management can be achieved, which avoids a lot of manual intervention and effectively improves the work efficiency of the build version, thereby solving the technical problem in the related technology that the intermediate product physical file package cannot be separated from Git for remote management, resulting in low efficiency of the build version.
[0149] Optionally, the generation device also includes: a first generation module, which is used to generate a scheduling service parameterized link before obtaining the version configuration information of the pre-built pipeline, wherein the parameter information carried by the scheduling service parameterized link includes at least: a warehouse address, a branch identifier, and a file package identifier; a first initiation module, which is used to initiate a front-end page request based on the scheduling service parameterized link when submitting the preset source file to the branch warehouse indicated by the branch identifier, wherein the branch warehouse is a warehouse branch in the warehouse indicated by the warehouse address; a first calling module, which is used to call the first scheduling service based on the front-end page request; a first production module, which is used to call the preset scaffolding tool through the preset remote machine, execute the execution instruction, and produce the preset file package when the first scheduling service sends the execution instruction to the preset remote machine, wherein the execution instruction is the instruction generated by the first scheduling service based on the front-end page request, and the preset scaffolding tool is pre-deployed in the preset remote machine.
[0150] Optionally, the generating device further includes: a first configuration module, for configuring the preset remote machine as an operating node of the first scheduling service before calling the preset scaffolding tool through the preset remote machine, executing the execution instruction, and producing the preset file package, wherein the operating node is used to execute the execution instruction issued by the first scheduling service and return the execution result; a second configuration module, for configuring the commissioning day verification instruction, the scaffolding tool version update instruction, and the product dependency file update instruction based on the front-end page request, wherein the commissioning day verification instruction is used to check whether the file package corresponding to the branch warehouse can be produced based on the commissioning date recorded in the branch warehouse indicated by the branch identifier; the scaffolding tool version update instruction is used to pull the warehouse data indicated by the warehouse address, and obtain the tool version update file maintained by the branch warehouse indicated by the branch identifier based on the warehouse data, and update the dependency version of the preset scaffolding tool based on the tool version update file; the product dependency file update instruction is used to update the product dependency file based on parameter information; a first output module, for obtaining the execution instruction based on the commissioning day verification instruction, the scaffolding tool version update instruction, and the product dependency file update instruction.
[0151] Optionally, the first production module includes: a first cloning sub-module, which is used to clone the warehouse data indicated by the warehouse address carried by the product dependency file based on the updated product dependency file through a preset scaffolding tool, and pull the preset source file in the branch warehouse indicated by the branch identifier carried by the product dependency file based on the warehouse data; a first compilation sub-module, which is used to compile the preset source file to obtain a compressed file; a first generation sub-module, which is used to generate a differential file and a signature file corresponding to each low-version file package in the low-version set based on the low-version set, to complete the production of the preset file package.
[0152] Optionally, the generating device also includes: a first cleaning module, which is used to clean up other low version sets on the preset remote machine after completing the production of the preset file package, based on the number of product versions pre-configured by the preset scaffolding tool, wherein the other low version sets are low version sets that are not in the low version sets indicated by the number of product versions.
[0153] Optionally, the folder collection includes at least: a first folder and a second folder, the first folder stores a signature file, and the second folder stores a compressed file and a differential file, and the generating device also includes: a second generating module, which is used to generate an information file corresponding to the preset file package based on the package type of the preset file package after completing the production of the preset file package, wherein the information file includes at least: the package identifier of the preset file package, and the file path of the preset file package stored in the preset remote machine; a first creation module, which is used to create a first file directory and a second file directory on the preset remote machine to obtain a download directory, wherein the first file directory points to the first folder and the second file directory points to the second folder; a first push module, which is used to push the information file to the branch warehouse where the preset source file is located, and return the production process and production results of the preset file package to the first scheduling service.
[0154] Optionally, the generating device further includes: a first acquisition module, which is used to acquire the modified files of each branch warehouse based on the information file corresponding to the branch warehouse after pushing the information file to the branch warehouse where the preset source file is located; a second initiation module, which is used to initiate a file synchronization request, wherein the file synchronization request is used to synchronize the modified files of each branch warehouse to the target branch warehouse; a first judgment module, which is used to judge whether the modified file for synchronization conflicts with the modified file in the target branch warehouse based on a preset merge strategy; a first characterization module, which is used to use the information file indicated by the modified file in the target branch warehouse as the target information file when there is a conflict between the modified file for synchronization and the modified file in the target branch warehouse; and a first merging module, which is used to execute the file synchronization request when there is no conflict between the modified file for synchronization and the modified file in the target branch warehouse, merge the modified file for synchronization with the modified file in the target branch warehouse, and obtain the target information file of the target branch warehouse.
[0155] Optionally, the generation device also includes: a third configuration module, which is used to build the pipeline using a preset continuous integration system and perform version configuration before obtaining the version configuration information of the pre-built pipeline to obtain version configuration information, wherein the version configuration information also includes: scheduling service sequence; a third generation module, which is used to generate a preset scheduling task based on the version configuration information; a third initiation module, which is used to initiate the corresponding second scheduling service on the pipeline based on the scheduling service sequence; a first sending module, which is used to send the preset scheduling task to the compiler cluster based on the second scheduling service; and a first selection module, which is used to select a preset compiler from the compiler cluster based on a preset load balancing strategy.
[0156] Optionally, the traversal unit includes: a second acquisition module, used to obtain the preset language source code files indicated by other source code directories; a first compilation module, used to compile the preset language source code files to obtain preset format files, and save the preset format files to a temporary directory; a second representation module, used to represent the other language source code files indicated by other source code directories and the preset format files indicated by the temporary directory as source code files, and save them to the target path.
[0157] Optionally, the generation device also includes: a first return module, which is used to return the generation information of the target version to the second scheduling service after generating the target version, wherein the second scheduling service returns the generation information to the pipeline built by the preset continuous integration system; a first deployment module, which is used to obtain the target version based on the generation information when the pipeline transmits the generation information to the test environment, and deploy the target version on the test environment; a second cleaning module, which is used to clean up the inventory products on the preset remote machine based on the cleaning script carried by the target version when deploying the target version on the test environment, wherein the inventory products are redundant intermediate products generated in the process of producing the target version.
[0158] The above-mentioned generating device may also include a processor and a memory. The above-mentioned acquiring unit 80, cloning unit 81, traversing unit 82, storage unit 83, generating unit 84, etc. are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize the corresponding functions.
[0159] The processor includes a kernel that retrieves the corresponding program unit from the memory. One or more kernels can be configured, and kernel parameters can be adjusted to integrate the folder set and source code files under the target path to generate the target version.
[0160] The above-mentioned memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0161] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program having the following method steps: obtaining version configuration information of a pre-built pipeline, using a preset compiler, cloning the warehouse data indicated by the warehouse address, and based on the warehouse data, obtaining the incremental file directory recorded in the branch warehouse indicated by the branch identifier, traversing the incremental file directory, and when traversing to an information file, reading the information file to obtain a download directory of a preset file package corresponding to the information file, or, when traversing to other source code directories, obtaining the source code files indicated by other source code directories, storing the folder set indicated by the download directory and the source code files indicated by the other source code directories under the target path of the preset compiler, integrating the folder set and source code files under the target path to generate a target version.
[0162] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the above-mentioned version generation method.
[0163] According to another aspect of an embodiment of the present invention, an electronic device is also provided, including one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by one or more processors, the one or more processors implement the above-mentioned version generation method.
[0164] Figure 9 FIG. 1 is a hardware structure diagram of an electronic device (or mobile device) for a version generation method according to an embodiment of the present invention. Figure 9 As shown, the electronic device may include one or more (902a, 902b, ..., 902n are shown in the figure) processors 902 (the processor 902 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 904 for storing data. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a keyboard, a power supply and / or a camera. It will be understood by those skilled in the art that Figure 9 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 9 More or fewer components than shown, or with Figure 9 Different configurations shown.
[0165] The serial numbers of the above embodiments of the present invention are for description only and do not represent the advantages or disadvantages of the embodiments.
[0166] In the above embodiments of the present invention, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0167] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only exemplary. For example, the division of the units can be a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0168] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0169] In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0170] If the integrated unit 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 technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk, etc. Various media that can store program codes.
[0171] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.
Claims
1. A method for generating a version, characterized in that: include: Obtaining version configuration information of a pre-built pipeline, wherein the version configuration information includes at least: a warehouse address and a branch identifier; Using a preset compiler, cloning the warehouse data indicated by the warehouse address, and obtaining the incremental file directory recorded in the branch warehouse indicated by the branch identifier based on the warehouse data; Traversing the incremental file directory, and when an information file is found, reading the information file to obtain a download directory of a preset file package corresponding to the information file; or, when another source code directory is found, obtaining a source code file indicated by the other source code directory, wherein the preset file package is pre-stored in a preset remote machine; The folder set indicated by the download directory and the source code files indicated by the other source code directories are stored in the target path of the preset compiler; Integrate the folder set and the source code files under the target path to generate a target version; After the target version is generated, the generation information of the target version is returned to the second scheduling service, wherein the second scheduling service returns the generation information to the pipeline built by the preset continuous integration system; When the pipeline transmits the generated information to the test environment, obtaining the target version based on the generated information and deploying the target version on the test environment; When the target version is deployed on the test environment, the inventory artifacts on the preset remote machine are cleaned up based on the cleanup script carried by the target version, wherein the inventory artifacts are redundant intermediate artifacts generated during the production of the target version.
2. The generation method according to claim 1, characterized in that Before obtaining the version configuration information of the pre-built pipeline, it also includes: Generate a scheduling service parameterized link, wherein the parameter information carried by the scheduling service parameterized link includes at least: a warehouse address, a branch identifier, and a file package identifier; In the case where the preset source file is submitted to the branch warehouse indicated by the branch identifier, a front-end page request is initiated based on the scheduling service parameterized link, wherein the branch warehouse is a warehouse branch in the warehouse indicated by the warehouse address; Based on the front-end page request, calling a first scheduling service; When the first scheduling service sends the execution instruction to the preset remote machine, the preset scaffolding tool is called by the preset remote machine to execute the execution instruction and create a preset file package, wherein the execution instruction is an instruction generated by the first scheduling service based on the front-end page request, and the preset scaffolding tool is pre-deployed in the preset remote machine.
3. The generation method according to claim 2, characterized in that Before calling the preset scaffolding tool through the preset remote machine, executing the execution instruction, and making the preset file package, the method further includes: Configuring the preset remote machine as an execution node of the first scheduling service, wherein the execution node is used to execute the execution instruction issued by the first scheduling service and return an execution result; Based on the front-end page request, a production date verification instruction, a scaffolding tool version update instruction, and a product dependency file update instruction are configured, wherein the production date verification instruction is used to verify whether the file package corresponding to the branch warehouse can be produced based on the production date recorded in the branch warehouse indicated by the branch identifier; the scaffolding tool version update instruction is used to pull the warehouse data indicated by the warehouse address, and obtain the tool version update file maintained by the branch warehouse indicated by the branch identifier based on the warehouse data, and update the dependency version of the preset scaffolding tool based on the tool version update file; the product dependency file update instruction is used to update the product dependency file based on the parameter information; The execution instruction is obtained based on the production date verification instruction, the scaffolding tool version update instruction, and the product dependency file update instruction.
4. The generation method according to claim 3, characterized in that The steps of calling a preset scaffolding tool through the preset remote machine, executing the execution instruction, and creating a preset file package include: Clone the warehouse data indicated by the warehouse address carried in the product dependency file based on the updated product dependency file through the preset scaffolding tool, and pull the preset source file in the branch warehouse indicated by the branch identifier carried in the product dependency file based on the warehouse data; Compiling the preset source file to obtain a compressed file; Based on the low version set, a differential file and a signature file corresponding to each low version file package in the low version set are generated to complete the production of the preset file package.
5. The generation method according to claim 4, characterized in that After the preset file package is prepared, the following steps are also included: Based on the number of product versions pre-configured by the preset scaffolding tool, other low version sets on the preset remote machine are cleaned up, wherein the other low version sets are not in the low version set indicated by the number of product versions.
6. The generation method according to claim 4, characterized in that The folder set includes at least a first folder and a second folder, wherein the first folder stores the signature file, and the second folder stores the compressed file and the differential file. After the preset file package is prepared, the following steps are further included: Based on the package type of the preset file package, generating the information file corresponding to the preset file package, wherein the information file at least includes: a package identifier of the preset file package and a file path where the preset file package is stored in the preset remote machine; Creating a first file directory and a second file directory on the preset remote machine to obtain the download directory, wherein the first file directory points to the first folder and the second file directory points to the second folder; The information file is pushed to the branch repository where the preset source file is located, and the production process and production results of the preset file package are returned to the first scheduling service.
7. The generation method according to claim 6, characterized in that After pushing the information file to the branch repository where the preset source file is located, the method further includes: Based on the information file corresponding to the branch repository, obtaining the modified file of each branch repository; Initiating a file synchronization request, wherein the file synchronization request is used to synchronize the modified files of each branch repository to the target branch repository; Based on a preset merge strategy, determining whether the modified file for synchronization conflicts with the modified file in the target branch repository; In the case that there is a conflict between the modified file for synchronization and the modified file in the target branch repository, using the information file indicated by the modified file in the target branch repository as the target information file; When there is no conflict between the modified file for synchronization and the modified file in the target branch warehouse, the file synchronization request is executed, and the modified file for synchronization and the modified file in the target branch warehouse are merged to obtain the target information file of the target branch warehouse.
8. The generation method according to claim 1, characterized in that Before obtaining the version configuration information of the pre-built pipeline, it also includes: The pipeline is built using a preset continuous integration system, and version configuration is performed to obtain the version configuration information, wherein the version configuration information further includes: a scheduling service sequence; Based on the version configuration information, generate a preset scheduling task; Based on the scheduling service sequence, initiating a corresponding second scheduling service on the pipeline; Based on the second scheduling service, the preset scheduling task is sent to the compiler cluster; Based on a preset load balancing strategy, the preset compiler machine is selected from the compiler machine cluster.
9. The generation method according to claim 1, characterized in that In the case of traversing to other source code directories, the step of obtaining the source code files indicated by the other source code directories includes: Obtaining the preset language source code file indicated by the other source code directory; Compiling the preset language source code file to obtain a preset format file, and saving the preset format file to a temporary directory; The other language source code files indicated by the other source code directories and the preset format files indicated by the temporary directory are characterized as the source code files and saved to the target path.
10. A version generation device, characterized in that, include: An acquisition unit, configured to acquire version configuration information of a pre-built pipeline, wherein the version configuration information includes at least: a warehouse address and a branch identifier; A cloning unit, configured to clone the warehouse data indicated by the warehouse address using a preset compiler, and obtain, based on the warehouse data, an incremental file directory recorded in the branch warehouse indicated by the branch identifier; a traversal unit, configured to traverse the incremental file directory, and when traversing to an information file, read the information file to obtain a download directory of a preset file package corresponding to the information file; or, when traversing to another source code directory, obtain the source code file indicated by the other source code directory, wherein the preset file package is pre-stored in a preset remote machine; a storage unit, configured to store the folder set indicated by the download directory and the source code files indicated by the other source code directories in a target path of the preset compiler; A generating unit, configured to integrate the folder set and the source code file under the target path to generate a target version; The generation device also includes: a first return module, which is used to return the generation information of the target version to the second scheduling service after generating the target version, wherein the second scheduling service returns the generation information to the pipeline built by the preset continuous integration system; a first deployment module, which is used to obtain the target version based on the generation information when the pipeline transmits the generation information to the test environment, and deploy the target version on the test environment; a second cleanup module, which is used to clean up the inventory products on the preset remote machine based on the cleanup script carried by the target version when deploying the target version on the test environment, wherein the inventory products are redundant intermediate products generated in the process of making the target version.
11. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the version generation method according to any one of claims 1 to 9.
12. An electronic device, characterized in that: The system comprises one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the version generation method described in any one of claims 1 to 9.
Citation Information
Patent Citations
Version construction method, version construction device, electronic equipment and readable storage medium
CN113094083A
Version construction method, version construction device, electronic equipment and readable storage medium
CN113094084A