Method and system for automatically compiling and constructing database codes

Through automated construction of the compilation operating system and preparation work, the problems of low efficiency and low credibility of database code compilation are solved, and efficient and reliable database code compilation and construction are achieved, reducing manual operations and ensuring consistency of the compilation environment .

CN119045826APending Publication Date: 2024-11-29SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411118495.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-15
Publication Date
2024-11-29

AI Technical Summary

Technical Problem

During the database research and development and distribution process, the database code compilation and construction in the existing technology is inefficient, the labor cost is high, and the credibility is not high, resulting in the problem of competing for compilation resources and inconsistent compilation environment.

Method used

By building an automated compilation operating system, installing compilation software, preparing to compile dependency files and database code, and signing and publishing compilation products, using configuration files and scripts to automatically build a compilation environment and execute compilation tasks, achieving multi-task parallel compilation and environment consistency.

Benefits of technology

Improve database development efficiency, reduce manual operations, ensure consistency of the compilation environment and code, reduce labor costs and improve the credibility of compilation results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119045826A_ABST
    Figure CN119045826A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of database compiling and building environment building, in particular to a method and system for automatically compiling and building database codes, and the method comprises the following steps: building a compiling operation system; installing compiling software; preparing a compilation dependent file; database codes are prepared; signing and publishing a compiled product; the method and the system for automatically compiling and constructing the database codes have the beneficial effects that elements required by a database compiling environment are packaged, an automatic compiling script and a configuration file are configured in advance, and the system automatically builds the compiling environment and executes a compiling task. According to the system, an isolation environment is created in a physical host to realize that one compiling machine carries out a plurality of compiling construction tasks at the same time, and a pure compiling environment is efficiently provided for each compiling task by establishing a compiling environment in a flow manner.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of database compilation and construction environment construction, and in particular to a method and system for automatic compilation and construction of database codes. Background Art

[0002] During the database development and release process, it is necessary to build a database code compilation and construction environment to compile the new version of the database code. The final compilation product is an rpm package used to test functions or release new versions.

[0003] During the development phase, multiple people in the R&D team usually need to compile database code at the same time, but the compilation environment can only perform one compilation task at a time, and other compilation tasks need to wait, resulting in competition for compilation resources; in addition, if multiple compilation versions require different compilation environments, the workload of configuring the compilation environment will also be greatly increased. During the release phase, it is necessary to ensure that the compilation results of the same release version are consistent each time, and a non-pure compilation environment may cause changes in the compilation results, which requires enhancing the credibility of the compilation environment.

[0004] In summary, the methods used for compiling and constructing database codes in the prior art have the problems of low efficiency, high labor cost and low reliability. Summary of the invention

[0005] The purpose of the present invention is to provide a method and system for automatically compiling and constructing database codes to solve the problems raised in the above background technology.

[0006] To achieve the above object, the present invention provides the following technical solution: a method for automatically compiling and constructing database code, the method comprising the following steps:

[0007] Build and compile the operating system;

[0008] Install the compiler software;

[0009] Prepare to compile dependency files;

[0010] Prepare database code;

[0011] Sign and publish the compiled products.

[0012] Preferably, the specific operations of building a compiled operating system include:

[0013] Database compilation usually requires a specified operating system for compilation. To ensure accurate control of the compiled operating system version and installed software for each build, the system environment information is configured through the project configuration file. The dependency management module in the system will automatically parse the configuration items and provide the worker with a list of software installed in the environment and installation details. The system administrator pre-installs the operating system kernel and system files for the isolated environment through the Preinstall field, installs dependent software and third-party dependent files through the Support field, defines macros through the % symbol, controls the version number of the compiled product through Release, and<CI_CNT> The variables obtain the current compilation version and compilation times. After receiving the compilation task, the task execution module first creates an isolated environment and installs the operating system in the new isolated environment.

[0014] Preferably, the specific operations of installing the compilation software include:

[0015] The newly built blank operating system needs to install the specified version of the compilation dependency software to meet the needs of compiling the database code. The dependency software required for database compilation is specified in the database compilation script spec file. The dependency management module parses the spec file in the database code to obtain the specific information of the dependency software. The task execution module will install the dependency software after installing the operating system.

[0016] The specific operations to prepare the compilation dependency files include:

[0017] The database compilation dependency also requires a third-party dependency file. The administrator uses the third-party dependency code to compile the rpm package of the third-party dependency in advance, introduces the third-party dependency through the Support field in the project configuration file, and uses the Substitute field to help the compilation script find the third-party dependency file.

[0018] Preferably, the specific operations of preparing the database code include:

[0019] Compile the service configuration file corresponding to the project configuration, which is used to specify the database code that needs to be compiled. Usually git is used to manage the project code. The system needs to automatically use git to pull the code. The source code management module is configured with scripts: git_scm, recompress, extract_file, set_version, local_file_cp. The source code management module parses the service configuration file, obtains parameters from the configuration file, and executes the corresponding step tasks; the git_scm script configures the url and revision parameters, pulls the code from the git repository where the url is located, switches to the branch code specified by the revision, and finally archives it as a tarball; the recompress script configures the compression parameter to archive ta r package is compressed into a compressed file of a specified format; the set_version script configures the version parameter to specify the code version; since the compilation script may be in the compressed package, use extract_file to configure the files parameter to extract the specified file from the compressed file, use the local_file_cp script to configure the path and filename parameters to copy the file from the specified path; the embodiment configures the service configuration file, uses git_scm to obtain the code, recompress to obtain the code compression package, extract_file to extract the compilation script spec file, and set_version to specify the compilation version; after completing the first three tasks, the task execution module obtains the code from the source code management module, and finally executes the compilation script to perform the compilation task.

[0020] Preferably, the specific operations of signing and publishing the compiled product include:

[0021] After the task execution module completes the compilation and construction, it notifies the task release scheduling module to send the compilation product from the worker node to the server node, schedules the signature module to sign the compilation product rpm, schedules the release management module to release the version, and according to the project configuration file, if the compilation product is dependent on other projects, it will be saved to the dependency management module and provided to other projects as a compilation dependency file.

[0022] A database code automatic compilation and construction system, the system consists of a front-end module, a timed compilation and backup module, a source code management module, a dependency management module, a release management module, a signature module, a task release scheduling module and a task execution module;

[0023] Front-end module, used for page visualization configuration compilation project;

[0024] The scheduled compilation and backup module regularly updates and compiles the code of the specified compilation project, regularly backs up the compilation products, and automatically backs up the products released by the release management module;

[0025] Source code management module, used to manage database code;

[0026] Dependency management module, used to manage system software, software dependencies, and third-party dependency files required for compilation;

[0027] Release management module, used to respond to compilation tasks triggered by source code and dependency management modules or administrators;

[0028] Signature module, used to sign the compiled product to prevent it from being tampered with;

[0029] The task publishing and scheduling module is used to respond to the compilation tasks triggered by the source code and dependency management module or the administrator. After receiving the task, it is automatically scheduled to the worker node of the corresponding architecture for execution;

[0030] The task execution module obtains the system files and dependency files required for environment construction from the dependency management module, obtains the database code of the version to be compiled from the source code management module, creates an isolated environment for environment construction, and finally executes the compilation task.

[0031] Preferably, the front-end module checks the compilation progress and compilation log to facilitate the troubleshooting and resolution of compilation problems, and checks the status of the system's server nodes and wokrer nodes to facilitate system operation and maintenance management.

[0032] Preferably, the source code management module monitors code changes, notifies the task release scheduling module to release tasks, and parses service configuration files for automatic preparation of database code.

[0033] Preferably, the dependency management module monitors changes in dependency files, notifies the task release scheduling module to release tasks, parses project configuration files, provides scripts for automatically building and compiling operating systems, and provides compiled software files and third-party dependency files.

[0034] Preferably, after receiving the task, the release management module automatically schedules it to the worker node of the corresponding architecture for execution.

[0035] Compared with the prior art, the present invention has the following beneficial effects:

[0036] The method and system for automatic compilation and construction of database code proposed in the present invention package the elements required for the database compilation environment, pre-configure the automatic compilation script and configuration file, and the system will automatically build the compilation environment and execute the compilation task. The system creates an isolated environment on the physical host to enable a compiler to perform multiple compilation and construction tasks at the same time, and efficiently provides a pure compilation environment for each compilation task by constructing the compilation environment in a process-based manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 This is a system architecture diagram of the present invention. DETAILED DESCRIPTION

[0038] In order to make the purpose and technical solution of the present invention clearly and completely described, and the advantages more clearly understood, the embodiments of the present invention are further described in detail with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are part of the embodiments of the present invention, rather than all of the embodiments, and are only used to explain the embodiments of the present invention, and are not used to limit the embodiments of the present invention. All other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0039] Embodiment 1

[0040] The present invention provides a technical solution: a method for automatically compiling and constructing database code, the method comprising the following steps:

[0041] Build and compile the operating system, install the compilation software, prepare compilation dependency files, prepare database code, sign and publish the compilation products.

[0042] Build and compile the operating system: Database compilation usually requires a specified operating system for compilation. To ensure accurate control of the compiled operating system version and installed software each time, configure the system environment information through the project configuration file. The dependency management module in the system will automatically parse the configuration items and provide the worker with a list of software installed in the environment and installation details. The system administrator can pre-install the operating system kernel and system files for the isolated environment through the Preinstall field, install dependent software and third-party dependent files through the Support field, define macros through the % symbol, control the version number of the compiled product through Release, and<CI_CNT> The variable obtains the current compilation version and the number of compilations. After receiving the compilation task, the task execution module first creates an isolated environment and installs the operating system in the new isolated environment.

[0043] Install compilation software: The newly built blank operating system needs to install the specified version of compilation dependency software to meet the needs of compiling database code. The dependency software required for database compilation can be specified in the database compilation script spec file. The dependency management module will parse the spec file in the database code and obtain the specific information of the dependency software. The task execution module will install the dependency software after installing the operating system.

[0044] Prepare compilation dependency files: Database compilation dependencies also require third-party dependency files. The administrator uses the third-party dependency code to compile the rpm package of the third-party dependency in advance, introduces the third-party dependency through the Support field in the project configuration file, and uses the Substitute field to help the compilation script find the third-party dependency file.

[0045] Prepare database code: A compilation project needs to configure the corresponding service configuration file to specify the database code that needs to be compiled. Usually, git is used to manage project code, and the system needs to be able to automatically use git to pull code. The source code management module is configured with scripts: git_scm, recompress, extract_file, set_version, and local_file_cp. The source code management module parses the service configuration file, obtains parameters from the configuration file, and executes the corresponding step tasks. The git_scm script configures the url and revision parameters, pulls the code from the git repository where the url is located, switches to the branch code specified by the revision, and finally archives it as a tarball. The recompress script configures the compression parameter to compress the archived tarball into a compressed file in a specified format. The set_version script configures the version parameter to specify the code version. Since the compilation script may be in a compressed package, use extract_file to configure the files parameter to extract the specified file from the compressed file. You can also use the local_file_cp script to configure the path and filename parameters to copy files from the specified path. The embodiment configures the service configuration file, uses git_scm to obtain the code, recompress to obtain the code compression package, extract_file to extract the compilation script spec file, and set_version to specify the compilation version. After completing the first three steps, the task execution module will obtain the code from the source code management module and finally execute the compilation script to perform the compilation task.

[0046] Sign and publish the compiled product: After the task execution module completes the compilation and build, it will notify the task release scheduling module to send the compiled product from the worker node to the server node, schedule the signature module to sign the compiled product rpm, schedule the release management module to publish the version, and according to the project configuration file, if the compiled product is dependent on other projects, it will be saved to the dependency management module and provided to other projects as a compilation dependency file.

[0047] The present invention proposes a method and system for automatically compiling and building database code, which can automate the construction of the compilation environment and preparation work. Through the coordination of configuration files, predetermined scripts and various system modules, the preparation work of building the compilation environment and related files such as database code can be automatically completed. The present invention aims to improve the efficiency of database development, reduce manual operations, and ensure the consistency of the compilation environment and code. It solves the following problems:

[0048] Automated environment construction: Traditional database code compilation and construction requires manual environment setup, configuration of compilers, linkers, etc., while the present invention can automatically complete this process through configuration files and scripts, greatly reducing labor costs and the possibility of errors. Consistency guarantee: Since it is automatically executed through predetermined scripts and configuration files, it can ensure that the environment and process of each compilation and construction are consistent, which helps to improve the stability and reproducibility of the code. Flexibility and customizability: Administrators can customize it according to actual needs. Collaborative work: The collaborative work between the various modules of the system ensures the smoothness of the entire compilation and construction process, so that most processes do not require human intervention.

[0049] Embodiment 2

[0050] Based on the first embodiment, a database code automatic compilation and construction system is proposed, which consists of a front-end module, a scheduled compilation and backup module, a source code management module, a dependency management module, a release management module, a signature module, a task release scheduling module and a task execution module;

[0051] Front-end module: used for page visualization configuration compilation project, viewing compilation progress and compilation logs, facilitating the troubleshooting and resolution of compilation problems, viewing the status of the system's server nodes and wokrer nodes, and facilitating system operation and maintenance management.

[0052] Scheduled compilation and backup module: It will perform regular code updates and compilations on the specified compilation projects, regularly back up the compilation products, and automatically back up the products released by the release management module.

[0053] Source code management module: used to manage database code, monitor code changes, notify the task release scheduling module to release tasks, parse service configuration files, and automatically prepare database code.

[0054] Dependency management module: used to manage the system software, software dependencies and third-party dependency files required for compilation, monitor changes in dependency files to notify the task release scheduling module to release tasks, parse project configuration files, provide scripts for automatically building and compiling operating systems, and provide compiled software files and third-party dependency files.

[0055] Task release scheduling module: used to respond to compilation tasks triggered by the source code and dependency management module or the administrator. After receiving the task, it is automatically scheduled to the worker node of the corresponding architecture for execution.

[0056] Task execution module: obtains the system files and dependency files required for environment construction from the dependency management module, obtains the database code of the version to be compiled from the source code management module, creates an isolated environment for environment construction, and finally executes the compilation task.

[0057] Signature module: used to sign the compiled product to prevent it from being tampered with.

[0058] Release management module: used to manage and release the compiled rpm package products after the worker is compiled, synchronize important compiled products and update the release source warehouse, and trigger the backup tasks of the scheduled compilation and backup modules to back up the compiled products.

[0059] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A method for automatically compiling and building database code, characterized in that: The method comprises the following steps: Build and compile the operating system; Install the compiler software; Prepare to compile dependency files; Prepare database code; Sign and publish the compiled products.

2. A method for automatically compiling and constructing database code according to claim 1, characterized in that: The specific operations of building a compiled operating system include: Database compilation usually requires a specified operating system for compilation. To ensure accurate control of the compiled operating system version and installed software for each build, the system environment information is configured through the project configuration file. The dependency management module in the system will automatically parse the configuration items and provide the worker with a list of software installed in the environment and installation details. The system administrator pre-installs the operating system kernel and system files for the isolated environment through the Preinstall field, installs dependent software and third-party dependent files through the Support field, defines macros through the % symbol, controls the version number of the compiled product through Release, and<CI_CNT> The variables obtain the current compilation version and compilation times. After receiving the compilation task, the task execution module first creates an isolated environment and installs the operating system in the new isolated environment.

3. A method for automatically compiling and constructing database code according to claim 1, characterized in that: The specific operations for installing the compilation software include: The newly built blank operating system needs to install the specified version of the compilation dependency software to meet the needs of compiling the database code. The dependency software required for database compilation is specified in the database compilation script spec file. The dependency management module parses the spec file in the database code to obtain the specific information of the dependency software. The task execution module will install the dependency software after installing the operating system. The specific operations to prepare the compilation dependency files include: The database compilation dependency also requires a third-party dependency file. The administrator uses the third-party dependency code to compile the rpm package of the third-party dependency in advance, introduces the third-party dependency through the Support field in the project configuration file, and uses the Substitute field to help the compilation script find the third-party dependency file.

4. A method for automatically compiling and constructing database code according to claim 1, characterized in that: The specific operations for preparing database code include: Compile the service configuration file corresponding to the project configuration, which is used to specify the database code that needs to be compiled. Usually git is used to manage the project code. The system needs to automatically use git to pull the code. The source code management module is configured with scripts: git_scm, recompress, extract_file, set_version, local_file_cp. The source code management module parses the service configuration file, obtains parameters from the configuration file, and executes the corresponding step tasks; the git_scm script configures the url and revision parameters, pulls the code from the git repository where the url is located, switches to the branch code specified by the revision, and finally archives it as a tarball; the recompress script configures the compression parameter to archive ta r package is compressed into a compressed file of a specified format; the set_version script configures the version parameter to specify the code version; since the compilation script may be in the compressed package, use extract_file to configure the files parameter to extract the specified file from the compressed file, use the local_file_cp script to configure the path and filename parameters to copy the file from the specified path; the embodiment configures the service configuration file, uses git_scm to obtain the code, recompress to obtain the code compression package, extract_file to extract the compilation script spec file, and set_version to specify the compilation version; after completing the first three tasks, the task execution module obtains the code from the source code management module, and finally executes the compilation script to perform the compilation task.

5. The method for automatically compiling and constructing database code according to claim 1, characterized in that: The specific operations for signing and publishing the compiled product include: After the task execution module completes the compilation and construction, it notifies the task release scheduling module to send the compilation product from the worker node to the server node, schedules the signature module to sign the compilation product rpm, schedules the release management module to release the version, and according to the project configuration file, if the compilation product is dependent on other projects, it will be saved to the dependency management module and provided to other projects as a compilation dependency file.

6. A database code automatic compilation and construction system according to the database code automatic compilation and construction method according to any one of claims 1 to 5, characterized in that: The system consists of a front-end module, a scheduled compilation and backup module, a source code management module, a dependency management module, a release management module, a signature module, a task release scheduling module, and a task execution module; Front-end module, used for page visualization configuration compilation project; The scheduled compilation and backup module regularly updates and compiles the code of the specified compilation project, regularly backs up the compilation products, and automatically backs up the products released by the release management module; Source code management module, used to manage database code; Dependency management module, used to manage system software, software dependencies, and third-party dependency files required for compilation; Release management module, used to respond to compilation tasks triggered by source code and dependency management modules or administrators; Signature module, used to sign the compiled product to prevent it from being tampered with; The task publishing and scheduling module is used to respond to the compilation tasks triggered by the source code and dependency management module or the administrator. After receiving the task, it is automatically scheduled to the worker node of the corresponding architecture for execution; The task execution module obtains the system files and dependency files required for environment construction from the dependency management module, obtains the database code of the version to be compiled from the source code management module, creates an isolated environment for environment construction, and finally executes the compilation task.

7. A database code automatic compilation and construction system according to claim 6, characterized in that: The front-end module can check the compilation progress and compilation log to facilitate the troubleshooting and resolution of compilation problems, and check the status of the system's server nodes and wokrer nodes to facilitate system operation and maintenance management.

8. A database code automatic compilation and construction system according to claim 6, characterized in that: The source code management module monitors code changes, notifies the task release scheduling module to release tasks, and parses service configuration files to automatically prepare database code.

9. A database code automatic compilation and construction system according to claim 6, characterized in that: The dependency management module monitors changes in dependency files, notifies the task release scheduling module to release tasks, parses project configuration files, provides scripts for automatically building and compiling operating systems, and provides compiled software files and third-party dependency files.

10. A database code automatic compilation and construction system according to claim 6, characterized in that: After receiving the task, the release management module automatically schedules it to the worker node of the corresponding architecture for execution.