CN115390912B - Resource discovery method, device, computer equipment and storage medium - Google Patents

Resource discovery method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN115390912B
CN115390912B CN202211319409.0A CN202211319409A CN115390912B CN 115390912 B CN115390912 B CN 115390912B CN 202211319409 A CN202211319409 A CN 202211319409A CN 115390912 B CN115390912 B CN 115390912B
Authority
CN
China
Prior art keywords
project
resource file
target
file
target project
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202211319409.0A
Other languages
Chinese (zh)
Other versions
CN115390912A (en
Inventor
张民遐
李飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Gaodeng Computer Technology Co ltd
Original Assignee
Shenzhen Gaodeng Computer Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Gaodeng Computer Technology Co ltd filed Critical Shenzhen Gaodeng Computer Technology Co ltd
Priority to CN202211319409.0A priority Critical patent/CN115390912B/en
Publication of CN115390912A publication Critical patent/CN115390912A/en
Application granted granted Critical
Publication of CN115390912B publication Critical patent/CN115390912B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Computational Linguistics (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to a resource discovery method, a resource discovery device, a computer device and a storage medium. The method comprises the following steps: acquiring a target project and determining an initial resource file of the target project; generating a user resource file to which the target project belongs and a configuration resource file when the target project is issued according to the initial resource file; when the publishing platform publishes the target project, transmitting the configuration resource file to the container platform, and generating an operation resource file of the target project when the container platform operates according to the configuration resource file; associating the user resource file with the operating resource file to obtain an association relation corresponding to the target project; the association relationship is used for resource discovery of the target project at runtime. By adopting the method, the efficiency of resource discovery can be improved.

Description

Resource discovery method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a resource discovery method and apparatus, a computer device, and a storage medium.
Background
With the development of computer technology, a cloud containerization platform capable of constructing business systems of enterprises to cloud service providers appears, and the containerization platform brings distributed operation capability to the business systems and also brings new challenges to the business systems in the resource management and operation and maintenance processes.
An open source distributed tracking system, such as Jaeger, is currently used to monitor and diagnose a container platform based on micro services, and perform resource discovery on items in a business system running on the container platform through a call relationship between business system interfaces. However, to implement the calling of the service system and the identification of the service fault, a corresponding software development kit needs to be embedded in the service system, which causes intrusion to the service system, and also causes higher implementation cost of resource discovery. Therefore, how to efficiently perform resource discovery on items in a business system without using a tracking system is a problem to be solved by the present disclosure.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a resource discovery method, apparatus, computer device and computer readable storage medium capable of improving resource discovery efficiency.
In a first aspect, the present application provides a resource discovery method. The method comprises the following steps:
acquiring a target project and determining an initial resource file of the target project;
generating a user resource file to which the target project belongs according to the initial resource file, and generating a configuration resource file when the target project is released;
when the issuing platform issues the target project, transmitting the configuration resource file to a container platform, and generating an operating resource file of the target project when the container platform operates according to the configuration resource file;
associating the user resource file with the operation resource file to obtain an association relation corresponding to the target project; the incidence relation is used for carrying out resource discovery on the target project at runtime.
In one embodiment, the target item includes an item name; the determining the initial resource file of the target project comprises: searching a first configuration file in the publishing platform through the project name; the first configuration file comprises a warehouse address of the target item; determining a publishing record of the target project through the first configuration file; the release record is obtained through information in a code warehouse; the information at least comprises branch parameters and version numbers corresponding to the latest project codes of the target projects; when the release record comprises the module parameter, acquiring the module parameter, the branch parameter and the version number from the release record; the module parameters characterize that the latest project codes are included in the code warehouse; and synthesizing the project name, the warehouse address, the module parameters, the branch parameters and the version number to obtain an initial resource file of the target project.
In one embodiment, the initial resource file includes a repository address and module parameters; the generating the user resource file to which the target project belongs according to the initial resource file comprises: using the warehouse address in the initial resource file as an index field, and finding out an item identifier of the target item from a code warehouse; determining the project user to which the target project belongs according to the project identifier in the code warehouse; using the warehouse address and the module parameter as an index field, and finding out maintainer information of the target item from the code warehouse; and integrating the project name, the warehouse address, the project user and the maintainer information to obtain a user resource file of the target project.
In one embodiment, the initial resource file includes module parameters; the generating the configuration resource file when the target project is released comprises: determining project characteristics required by the target project when the target project is released from the release platform according to the module parameters in the initial resource file; determining a project frame of the target project according to the project characteristics, and determining a second configuration file of the target project through the project frame; and performing field processing on the second configuration file to obtain a configuration resource file when the target project is issued.
In an embodiment, the performing field processing on the second configuration file to obtain a configuration resource file required when the target item is published includes: determining the file type of the second configuration file, and preprocessing the second configuration file according to the file type to obtain a preprocessing result; extracting a domain name field, a website field and a port field in the preprocessing result, and carrying out field combination on the domain name field, the website field and the port field to obtain a field combination result; detecting the availability of the domain name corresponding to the domain name field, the website corresponding to the website field and the port corresponding to the port field according to the field combination result; and when the domain name, the website and the port are all represented to be available, synthesizing the domain name field, the website field and the port field of the initial resource file and the second configuration file to obtain the configuration resource file of the target project.
In one embodiment, the configuration resource file includes project parameters; the project parameters at least comprise project names, warehouse addresses, module parameters, branch parameters and version numbers; when the publishing platform publishes the target item, the transferring the configuration resource file to a container platform comprises: determining a project script when the target project is issued by the issuing platform, and adding the project parameters to the annotation field of the container platform in the project script; the configuration resource file further comprises a field parameter; the field parameters comprise a domain name field, a website address field and a port field; the generating, according to the configuration resource file, an operation resource file of the target project when the container platform runs includes: determining a target node of the target item when the container platform runs; acquiring project parameters corresponding to the target project when the container platform operates according to the annotation field corresponding to the target node; and associating the project parameters, the field parameters of the configuration resource file and the target node to obtain the running resource file of the target project when the container platform runs.
In an embodiment, the associating the user resource file with the operating resource file to obtain an association relationship corresponding to the target project includes: determining respective corresponding query parameters of the user resource file and the operating resource file; the query parameters at least comprise item names or warehouse addresses; and when the corresponding query parameters of the user resource file and the operating resource file are the same, associating the user resource file with the operating resource file to obtain the association relation of the target project.
In one embodiment, the method further comprises: when acquiring a query parameter provided by a user, determining a user resource file corresponding to the query parameter; performing resource discovery on the target project operated on the container platform through the user resource file and the association relation; and when the found resource is the running resource file, performing chain indexing on the target project until an initial resource file of the target project is found.
In a second aspect, the present application further provides a resource discovery apparatus. The method comprises the following steps:
the project acquisition module is used for acquiring a target project and determining an initial resource file of the target project;
the file determining module is used for generating a user resource file to which the target project belongs according to the initial resource file and generating a configuration resource file when the target project is issued; when the issuing platform issues the target project, transmitting the configuration resource file to a container platform, and generating an operating resource file of the target project when the container platform operates according to the configuration resource file;
the file association module is used for associating the user resource file with the operating resource file to obtain an association relation corresponding to the target project; the incidence relation is used for carrying out resource discovery on the target project in the operation process.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory and a processor, the memory stores a computer program, and the processor realizes the following steps when executing the computer program:
acquiring a target project and determining an initial resource file of the target project;
generating a user resource file to which the target project belongs according to the initial resource file, and generating a configuration resource file when the target project is released;
when the issuing platform issues the target project, transmitting the configuration resource file to a container platform, and generating an operation resource file of the target project when the container platform operates according to the configuration resource file;
associating the user resource file with the operating resource file to obtain an association relation corresponding to the target project; the incidence relation is used for carrying out resource discovery on the target project in the operation process.
In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium has stored thereon a computer program which, when executed by a processor, performs the steps of:
acquiring a target project and determining an initial resource file of the target project;
generating a user resource file to which the target project belongs according to the initial resource file, and generating a configuration resource file when the target project is released;
when the issuing platform issues the target project, transmitting the configuration resource file to a container platform, and generating an operating resource file of the target project when the container platform operates according to the configuration resource file;
associating the user resource file with the operating resource file to obtain an association relation corresponding to the target project; the incidence relation is used for carrying out resource discovery on the target project at runtime.
According to the resource discovery method, the resource discovery device, the computer equipment and the storage medium, the target project is obtained, the initial resource file of the target project is determined, so that the user resource file to which the target project belongs is generated according to the initial resource file, and the configuration resource file when the target project is issued is generated; when the publishing platform publishes the target project, the configuration resource file is transmitted to the container platform, and the running resource file of the target project when the container platform runs is generated according to the configuration resource file, so that the user resource file and the running resource file can be associated to obtain the association relation corresponding to the target project. According to the method and the system, the resource discovery can be directly carried out on the target projects running on the container platform through the association relation, so that the resource discovery efficiency is improved; in addition, the running resource file is obtained by transmitting the configuration resource file to the container platform, and the configuration resource file is determined by the initial resource file, so that when the running resource file is found, the initial resource file of the target project can be determined by the chained index, and the efficient resource discovery of the issuing process and the running process of the target project is ensured.
Drawings
FIG. 1 is a diagram of an application environment of a resource discovery method in one embodiment;
FIG. 2 is a flow diagram illustrating a method for resource discovery in one embodiment;
FIG. 3 is a schematic diagram of resource discovery in one embodiment;
FIG. 4 is a flowchart illustrating the determination of a configuration resource file in one embodiment;
FIG. 5 is a block diagram of an apparatus for resource discovery in one embodiment;
FIG. 6 is a diagram of the internal structure of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The resource discovery method provided by the embodiment of the application can be applied to the application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a network. The data storage system may store data that the server 104 needs to process. The data storage system may be integrated on the server 104, or may be located on the cloud or other network server. The terminal 102 is configured to send the obtained target item to the server 104. The server 104 is configured to determine an initial resource file of the target project, generate a user resource file to which the target project belongs according to the initial resource file, and generate a configuration resource file when the target project is published. The server 104 is further configured to transmit the configuration resource file to the container platform when the publishing platform publishes the target project, and generate an operating resource file of the target project when the container platform operates according to the configuration resource file; and associating the user resource file with the operating resource file to obtain an association relation corresponding to the target project. The terminal 102 may be but is not limited to a personal computer, a notebook computer, a smart phone, a tablet computer, an internet of things device and a portable wearable device, and the internet of things device may be a smart sound box, a smart television, a smart air conditioner, a smart car device, and the like. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, and the like. The server 104 may be implemented as a stand-alone server or a server cluster comprised of multiple servers.
In one embodiment, as shown in fig. 2, a resource discovery method is provided, which is described by taking the method as an example applied to a computer device, where the computer device may be a terminal or a server in fig. 1, and includes the following steps:
step 202, acquiring a target project and determining an initial resource file of the target project.
The business system of the enterprise is deployed in the container platform, and the business system comprises a plurality of executable projects; the executable project representation is primarily published through the publishing platform, and then the executable project is transmitted to the container platform, so that the executable project can be deployed on the container platform to run, and at the moment, publishing information of the executable project after primary publishing is usually recorded on the publishing platform. And when the version of the executable project is modified or updated, obtaining a target project, wherein the target project is a project which needs to be released again based on the release information and the release platform. The release platform can be a Jenkins-based platform, and can integrate various open-source software into a whole, so that the dispatching work of different functions is realized.
Specifically, the computer device may obtain an initial resource file pre-configured on the publishing platform through an interface of the publishing platform, where the initial resource file corresponds to the target project. The initial resource file comprises project parameters, wherein the project parameters at least comprise a project name, a warehouse address, module parameters, branch parameters and a version number; the initial resource file may be a type of build.
And step 204, generating a user resource file to which the target project belongs according to the initial resource file, and generating a configuration resource file when the target project is released.
Specifically, as shown in fig. 3, fig. 3 is a schematic diagram of a resource discovery. Since it is necessary to ensure that the target project can run on the container platform before resource discovery is performed on the target project running on the container platform, the computer device needs to determine a user resource file to which the target project belongs through the code repository and the initial resource file, and determine a configuration resource file required when the target project is published through the publishing platform and the initial resource file. The user resource file may be a repolnfo.
In one embodiment, generating a user resource file to which the target project belongs according to the initial resource file includes: using the warehouse address in the initial resource file as an index field, and searching the item identifier of the target item from the code warehouse; determining a project user to which the target project belongs according to the project identifier in the code warehouse; using the warehouse address and the module parameter as an index field, and searching maintainer information of the target item from the code warehouse; and integrating the project name, the warehouse address, the project user and the maintainer information to obtain a user resource file of the target project.
Specifically, the computer device determines an interface in the code repository associated with the root element < project >, and finds an item identification for the target item, with the repository address in the initial resource file as an index field, the item identification corresponding to the item name. The computer device determines an interface in the code repository associated with the item identification and obtains creator information and an item description for the target item through the interface. The computer device determines an interface in the code repository associated with the project identification and the creator information, and obtains a project user to which the target project belongs through the interface. Wherein the creator information and the project user can be presented in the form of a user list.
The computer equipment determines an interface associated with the module parameter in the code warehouse, and finds out maintainer information of the target project by taking the warehouse address and the module parameter in the initial resource file as index fields; wherein the maintainer information characterizes the maintainer information maintaining the latest project code. Therefore, the user resource file of the target project can be obtained by integrating the project name, the warehouse address, the project user and maintainer information, and integrating the creator information and the project description. As will be readily appreciated, the project name and repository address in the user resource file are the same as the project name and repository address in the original resource file.
In one embodiment, the computer device configures the code warehouse information to which the target project belongs in the publishing platform, and the code warehouse information can also be regarded as a user resource file.
And step 206, when the publishing platform publishes the target project, transmitting the configuration resource file to the container platform, and generating an operation resource file of the target project when the container platform operates according to the configuration resource file.
Wherein the configuration resource file comprises project parameters; the project parameters include at least a project name, a warehouse address, module parameters, branch parameters, and a version number. The configuration resource file further comprises field parameters; the field parameters include a domain name field, a web address field, and a port field.
In one embodiment, when the publishing platform publishes the target item, passing the configuration resource file to the container platform includes: and determining a project script when the issuing platform issues the target project, and adding project parameters to the annotation field of the container platform in the project script.
Specifically, in the process of publishing the target project by the publishing platform, that is, in the process of publishing project parameters such as a project name, a warehouse address, module parameters, branch parameters, and a version number, the computer device needs to transmit the configuration resource file to the container platform, so that after the target project is published, the related resources of the target project in operation can be acquired through the annotation field on the container platform.
In one embodiment, the computer device may add the variables $ BUILD _ URL entry path, $ JOB _ NAME entry NAME, $ GIT _ BRANCH entry BRANCH, $ GIT _ COMMIT entry version number, $ GIT _ URL entry warehouse address, $ module entry module parameter, annotation fields to the resource objects of the container platform in the entry script.
In one embodiment, generating a run resource file of the target project when the container platform runs according to the configuration resource file comprises: determining a target node of a target project when a container platform runs; acquiring project parameters corresponding to the target project when the container platform operates according to the annotation field corresponding to the target node; and associating the project parameters, the field parameters of the configuration resource file and the target node to obtain the running resource file of the target project when the container platform runs.
In particular, since a plurality of servers carrying the service system are all deployed on the container platform, each server can be regarded as a node in the container platform. When the target project is released and operated, the computer equipment can transmit the configuration resource file to the container platform through the release platform, determine a target node of the target project when the container platform operates, and acquire node information of a server corresponding to the target node through an interface of the container platform; the node information may be a server ip or a host name. Because the project parameters and the field parameters in the configured resource file are transmitted to the container platform along with the project publishing process, the computer equipment can directly read the project parameters corresponding to the target project when the container platform runs according to the annotation fields corresponding to the target node, so that the computer equipment associates the project parameters, the field parameters and the node information of the target node to obtain the running resource file of the target project when the container platform runs.
In an embodiment, the running resource file may be a resource call table including a server corresponding to the service system, or may be a resource.
And 208, associating the user resource file with the operating resource file to obtain an association relation corresponding to the target project.
In one embodiment, associating the user resource file with the operating resource file to obtain an association relationship corresponding to the target project includes: determining respective corresponding query parameters of a user resource file and an operating resource file; and when the corresponding query parameters of the user resource file and the operating resource file are the same, associating the user resource file with the operating resource file to obtain the association relation of the target project.
The incidence relation is used for carrying out resource discovery on the target project in the running process; the query parameters include at least an item name or a repository address.
Specifically, because the target projects published through the publishing platform usually include a plurality of target projects, the user resource files and the operating resource files generated through the initial resource files corresponding to different target projects are also different. Therefore, it is necessary to determine the user resource files and the operating resource files with the same query parameters from the multiple user resource files and the multiple operating resource files, and associate the user resource files and the operating resource files to obtain an association relationship between the target items corresponding to the query parameters.
In one embodiment, referring to fig. 3, for each target project in a plurality of target projects, the user resource file and the run resource file are stored in a record file in a standard format according to the association relationship of the current target project. The standard format may be a json data format.
According to the resource discovery method, the target project is obtained, the initial resource file of the target project is determined, so that the user resource file to which the target project belongs and the configuration resource file when the target project is issued are generated according to the initial resource file; when the publishing platform publishes the target project, the configuration resource file can be transmitted to the container platform, and the running resource file of the target project when the container platform runs is generated according to the configuration resource file, so that the user resource file and the running resource file can be associated to obtain the association relation corresponding to the target project. According to the resource discovery method and device, the resource discovery can be directly carried out on the target projects running on the container platform through the association relation, so that the efficiency of resource discovery on the target projects is improved.
In one embodiment, determining an initial resource file for a target project comprises: searching a first configuration file in a release platform through the project name; determining a release record of the target project through the first configuration file; when the release record comprises the module parameters, acquiring the module parameters, the branch parameters and the version number from the release record; and integrating the project name, the warehouse address, the module parameter, the branch parameter and the version number to obtain an initial resource file of the target project.
The target item comprises an item name, and the item name can be called as a jobName; the first configuration file includes a repository address of the target item, and the first configuration file may be a type of config. The release record represents the related information recorded before the target project is released, and the release record is obtained through the information in the code warehouse; the information in the code repository includes at least the branch parameter and version number corresponding to the latest item code of the target item, and the version number may be referred to as commit id.
Because one project may be developed by a plurality of developers, and each project can also independently generate branches corresponding to project codes of different versions according to different project requirements or environment deployment requirements, different business problems are solved; the version number representation means that when a developer submits project codes to a code warehouse, an identifier is generated every submission. Therefore, when the branch parameter and the version number corresponding to the latest item code in the code repository are transmitted to the release record, the branch parameter and the version number can be used as the basis for generating the initial resource file.
Specifically, when the computer device searches for a first configuration file in the publishing platform, the computer device may obtain a warehouse address of the target item from the first configuration file, and obtain a publishing number corresponding to the target item through the first configuration file; the publishing number can represent the identifier of the target item published on the publishing platform. The computer device may determine a release record for the target item based on the release number and determine whether the module parameter is included in the release record. The Module parameter Module can be called Module parameter, and the Module parameter characterizes that the latest project code is included in the code warehouse. When the release record comprises the module parameters, the computer equipment can synthesize the module parameters, the branch parameters, the version numbers, the project names and the warehouse addresses in the release record to obtain the initial resource file of the target project.
In one embodiment, an initial first configuration file is looked up in the project directory of the publishing platform and filtered, e.g., the first configuration file with the root element of < project > is obtained after filtering. And generating a list file in a temporary folder, wherein the list file can be a jobConfig. list file, and the list file records first configuration files corresponding to all target items of the publishing platform. The computer device can obtain the item name corresponding to the target item based on the record in the list file.
In one embodiment, the computer device obtains a release number corresponding to the target item based on a nextBuildNumber file at the same level as the config.xml file, and obtains a release record of the target item by reading a peer directory build/$ { release number-1 }/changelog.xml file.
In one embodiment, the initial resource file of the target item includes a first configuration file.
In this embodiment, the release record of the target project can be quickly obtained through the first configuration file in the release platform, and since the project parameters associated with the target project are recorded in the release record, the initial resource file of the target project can be accurately obtained through the project parameters in the release record, and the accuracy of subsequently generating the user resource file to which the target project belongs according to the initial resource file is also improved.
In one embodiment, as shown in fig. 4, generating a configuration resource file when a target project is published includes the following steps:
step 402, determining project characteristics required by the target project to be published from the publishing platform according to the module parameters in the initial resource file.
Wherein the item features characterize features of item components on which the target item depends.
Specifically, the computer device determines a path for the item cache based on a path of a first configuration file in the initial resource file. The project cache path on the publishing platform is usually fixed, and is all under a fixed project cache folder, the project name created on the publishing platform is taken as an identifier, and a corresponding folder is created under the project cache path. The computer device detects the module parameters or the project names in the project cache path according to the module parameters or the project names in the initial resource file, namely, the project cache path is regarded as a source of the module parameters. And determining the project characteristics required by the target project when the target project is issued according to the latest project code corresponding to the module parameter.
And step 404, determining a project frame of the target project according to the project characteristics, and determining a second configuration file of the target project through the project frame.
The project framework at least comprises a Php framework and a go custom framework, and the Php framework comprises a Php yii framework, a Php msf framework, a Php swoft framework, a Php hyperf framework, a Php laravel framework and the like.
Specifically, when determining the project characteristics required by the target project, the computer device may screen out the project frames corresponding to the target project from the multiple frames, where the project root directory corresponding to the project cache path contains the files corresponding to the project characteristics. For example, when an item feature corresponds to a vendor component, the item frame is simply a php frame. When the project framework is the php yii framework, the environments folder in the project root directory can be determined, and all files in the environments folder can be used as the second configuration file of the target project. When the project framework is the Php msf framework, the config folder in the project root directory can be determined, and all files in the config folder can be used as the second configuration file of the target project.
In one embodiment, for the php swoft framework, the project root directory contains the files src/vector/swoft/frame/composer json, and the second configuration file is in the env file of the project root directory. The project root directory contains the files vector/hyper/frame/composer json, and the second configuration file is in the env file contained in the project root directory, at this time, to the pyhphyperf framework. For the php great frame, the project root directory contains the file vector/great/frame/composition. For the go custom framework, the item directory contains files ($ module /) config/prod-config.yaml, and ($ module /) config/prod-config.yam is the path of the second configuration file.
And step 406, performing field processing on the second configuration file to obtain a configuration resource file when the target item is issued.
In one embodiment, the field processing on the second configuration file to obtain the configuration resource file required by the target item when being issued includes: determining the file type of the second configuration file, and preprocessing the second configuration file according to the file type to obtain a preprocessing result; extracting a domain name field, a website field and a port field in the preprocessing result, and combining the domain name field, the website field and the port field to obtain a field combination result; detecting the domain name corresponding to the domain name field, the website corresponding to the website field and the availability of the port corresponding to the port field according to the field combination result; and when the domain name, the website and the port are all represented to be available, synthesizing the domain name field, the website field and the port field of the initial resource file and the second configuration file to obtain a configuration resource file of the target project.
The file type includes a character type and a special type. The second configuration file determined by the Php yii frame and the Php msf frame belongs to a Text file type, also called a character type; the second configuration file determined by the php swoft framework, the php hyperf framework, the php laravel framework and the go custom framework belongs to a Yaml file type, which is also called a special type. Preprocessing characterizes the process of preliminary filtering of non-emphasized content in the second configuration file, such as deleting empty lines and annotation lines.
Specifically, the computer device may extract a domain name field, a website field, and a port field, which are also referred to as an IP field, a url field, and a port field in sequence, from the preprocessing result in a character regular expression manner, and perform field combination on the domain name field, the website field, and the port field to obtain a field combination result. Wherein the field combination result includes, but is not limited to "ip: port" and "url: port". The computer device may perform port detection, for example, tcping detection, according to the field combination result, and further determine the domain name corresponding to the domain name field, the website corresponding to the website field, and the availability of the port corresponding to the port field. When the domain name, the website and the port are all represented to be available, the computer equipment can synthesize the domain name field, the website field and the port field of the initial resource file and the second configuration file to obtain the configuration resource file of the target project.
In one embodiment, the process of preprocessing the second configuration file of the character type may be: removing a blank space at the beginning of each line, removing an empty line, removing an annotation line, removing a comma and a semicolon, removing the content of the special mark annotation, removing a line containing 127.0.0.1,0.0.0 and localhost, and obtaining the next character string of the special separator.
In one embodiment, the process of preprocessing the second configuration file of a specific type may be: removing the space at the beginning of each line- > removing the empty line- > removing the annotation line- > obtaining the next segment of the space separator- > removing the line containing 127.0.0.1,0.0.0.0, localhost.
In this embodiment, the project framework to which the target project belongs is determined by the module parameter in the initial resource file, so that second configuration files of the target project can be accurately obtained for different project frameworks, and thus, the second configuration files of different file types can be respectively subjected to field processing, and when the domain name, the website address and the port are all represented to be available, the configuration resource file when the target project is published is accurately obtained, and the efficiency of subsequently publishing the target project is also improved.
In one embodiment, the method further comprises: when acquiring a query parameter provided by a user, determining a user resource file corresponding to the query parameter; performing resource discovery on the target project running on the container platform through the user resource file and the association relation; and when the found resource is the running resource file, performing chain index on the target project until the initial resource file of the target project is found.
Specifically, the computer device provides a query entry script, when the computer device responds to a query operation of a user, the record file is accessed through the query entry script, and a user resource file corresponding to a query parameter is acquired from the record file. The user resource file and the operation resource file are stored in the record file according to the association relationship, so the operation resource file in the record file can be directly inquired through the user resource file and the association relationship. The operating resource file is obtained through the configuration resource file transmitted to the container platform, and the configuration resource file is obtained through the initial resource file, so that the configuration resource file and the initial resource file can be inquired when the target project is subjected to chain type indexing on the basis of the operating resource file, and the issuing process of the target project and the resource discovery of the operating process are realized.
In one embodiment, referring to FIG. 3, a computer device may directly obtain a user resource file through an interface of a code repository, and the user resource file may be referred to as code repository project information; the computer equipment can directly acquire running resource files of the target project during running through an interface of the container platform, wherein the running resource files can also be called project transmission information; the computer equipment can obtain an initial resource file and a configuration resource file through a file path of the publishing platform, and the initial resource file and the configuration resource file can be collectively referred to as project publishing information. When the computer equipment responds to the query operation of a user, the code warehouse item information, the item transmission information or the item release information is acquired, and the resource discovery of the target item is realized.
In an embodiment, the association relationship may also be obtained by associating the user resource file with the configuration resource file, or by associating the initial resource file with the operating resource file. Thus, an associative relationship may be a user-item-resource relationship. It is easy to understand that, because the resource discovery process adopts a chain index manner, no matter which two or more files are associated with the association relationship, the resource discovery can be performed on the publishing process and the running process of the target project in the record document.
In one embodiment, when a maintainer conducts resource discovery through a computer device, the discovered resources can be conveniently utilized to conduct system maintenance on a business system where a target project is located.
In the embodiment, the information in the record document can be acquired based on the association relationship, so that a user can quickly and conveniently inquire various information of the target project, and meanwhile, due to the adoption of a chain index mode, the target project can be dynamically discovered in real time when being circulated among the code warehouse, the release platform and the container platform.
It should be understood that, although the steps in the flowcharts related to the embodiments are shown in sequence as indicated by the arrows, the steps are not necessarily executed in sequence as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a part of the steps in the flowcharts related to the above embodiments may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the steps or stages is not necessarily sequential, but may be performed alternately or alternately with other steps or at least a part of the steps or stages in other steps.
Based on the same inventive concept, the embodiment of the present application further provides a resource discovery apparatus for implementing the above-mentioned resource discovery method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, so specific limitations in one or more embodiments of the resource discovery device provided below may refer to the limitations in the above resource discovery method, and are not described herein again.
In one embodiment, as shown in fig. 5, there is provided a resource discovery apparatus 500, including: an item acquisition module 502, a file determination module 504, and a file association module 506, wherein:
a project obtaining module 502, configured to obtain a target project and determine an initial resource file of the target project;
a file determining module 504, configured to generate, according to the initial resource file, a user resource file to which the target project belongs, and a configuration resource file when the target project is published; when the publishing platform publishes the target project, transmitting the configuration resource file to the container platform, and generating an operation resource file of the target project when the container platform operates according to the configuration resource file;
the file association module 506 is configured to associate the user resource file with the operating resource file to obtain an association relationship corresponding to the target project; the incidence relation is used for carrying out resource discovery on the target project of the runtime.
In an embodiment, the item obtaining module 502 is further configured to search for a first configuration file in the publishing platform by the item name; the first configuration file includes a warehouse address of the target item; determining a publishing record of the target project through the first configuration file; the release record is obtained through the information in the code warehouse; the information at least comprises branch parameters and version numbers corresponding to the latest project codes of the target projects; when the release record comprises the module parameters, acquiring the module parameters, the branch parameters and the version number from the release record; the module parameter representation code warehouse comprises latest project codes; and integrating the project name, the warehouse address, the module parameter, the branch parameter and the version number to obtain an initial resource file of the target project.
In one embodiment, the file determination module 504 includes a user resource file module 5041, configured to find the item identifier of the target item from the code repository using the repository address in the initial resource file as an index field; determining a project user to which the target project belongs according to the project identifier in the code warehouse; using the warehouse address and the module parameter as an index field, and searching maintainer information of the target item from the code warehouse; and integrating the project name, the warehouse address, the project user and the maintainer information to obtain a user resource file of the target project.
In one embodiment, the file determining module 504 includes a configuration resource file module 5042, configured to determine project characteristics required for publishing the target project from the publishing platform according to the module parameters in the initial resource file; determining a project frame of the target project according to the project characteristics, and determining a second configuration file of the target project through the project frame; and carrying out field processing on the second configuration file to obtain a configuration resource file when the target project is issued.
In an embodiment, the resource file configuration module 5042 is further configured to determine a file type of the second configuration file, and perform preprocessing on the second configuration file according to the file type to obtain a preprocessing result; extracting a domain name field, a website field and a port field in the preprocessing result, and carrying out field combination on the domain name field, the website field and the port field to obtain a field combination result; detecting the domain name corresponding to the domain name field, the website corresponding to the website field and the availability of the port corresponding to the port field according to the field combination result; and when the domain name, the website and the port are all represented to be available, synthesizing the domain name field, the website field and the port field of the initial resource file and the second configuration file to obtain the configuration resource file of the target project.
In one embodiment, the file determination module 504 includes a run resource file module 5043, configured to determine a project script when the publishing platform publishes the target project, and add project parameters to the annotation field of the container platform in the project script; determining a target node of a target project when a container platform runs; acquiring project parameters corresponding to the target project when the container platform operates according to the annotation field corresponding to the target node; and integrating the project parameters, the field parameters of the configuration resource file and the target node to obtain the running resource file of the target project when the container platform runs.
In an embodiment, the file association module 506 is further configured to determine query parameters corresponding to the user resource file and the operating resource file; the query parameters at least comprise item names or warehouse addresses; and when the corresponding query parameters of the user resource file and the operating resource file are the same, associating the user resource file with the operating resource file to obtain the association relation of the target project.
In one embodiment, the resource discovery apparatus 500 further includes a user query module 508, configured to, when obtaining a query parameter provided by a user, determine a user resource file corresponding to the query parameter; performing resource discovery on the target project running on the container platform through the user resource file and the association relation; and when the found resource is the running resource file, performing chain index on the target project until the initial resource file of the target project is found.
The respective modules in the resource finding apparatus may be wholly or partially implemented by software, hardware, and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 6. The computer device includes a processor, a memory, an Input/Output (I/O) interface, a communication interface, a display unit, and an Input apparatus. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operating system and the computer program to run on the non-volatile storage medium. The input/output interface of the computer device is used for exchanging information between the processor and an external device. The communication interface of the computer device is used for communicating with an external terminal in a wired or wireless manner, and the wireless manner can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a method of resource discovery. The display unit of the computer equipment is used for forming a visual and visible picture, and can be a display screen, a projection device or a virtual reality imaging device, the display screen can be a liquid crystal display screen or an electronic ink display screen, the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 6 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In an embodiment, a computer device is further provided, which includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the above method embodiments when executing the computer program.
In an embodiment, a computer-readable storage medium is provided, in which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.
In one embodiment, a computer program product or computer program is provided that includes computer instructions stored in a computer readable storage medium. The computer instructions are read by a processor of a computer device from a computer-readable storage medium, and the computer instructions are executed by the processor to cause the computer device to perform the steps in the above-mentioned method embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above may be implemented by hardware instructions of a computer program, and the computer program may be stored in a non-volatile computer-readable storage medium, and when executed, may include the processes of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high-density embedded nonvolatile Memory, resistive Random Access Memory (ReRAM), magnetic Random Access Memory (MRAM), ferroelectric Random Access Memory (FRAM), phase Change Memory (PCM), graphene Memory, and the like. Volatile Memory can include Random Access Memory (RAM), external cache Memory, and the like. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others. The databases referred to in various embodiments provided herein may include at least one of relational and non-relational databases. The non-relational database may include, but is not limited to, a block chain based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing based data processing logic devices, etc., without limitation.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above examples only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.

Claims (11)

1. A method for resource discovery, the method comprising:
acquiring a target project and determining an initial resource file of the target project; the target project is positioned in a business system; a plurality of servers bearing the service system are deployed on a container platform; each of the servers acts as a node in the container platform;
generating a user resource file to which the target project belongs according to the initial resource file, and generating a configuration resource file when the target project is released;
when the target project is published by the publishing platform, the configuration resource file is transmitted to a container platform, and a target node of the target project during the operation of the container platform is determined;
acquiring project parameters of the target project during the operation of the container platform according to the annotation field corresponding to the target node;
associating the project parameters, the field parameters in the configuration resource file and the target node to generate a running resource file of the target project when the container platform runs;
associating the user resource file with the operation resource file to obtain an association relation corresponding to the target project; the incidence relation is used for carrying out resource discovery on the target project operated in the business system.
2. The method of claim 1, wherein the target item comprises an item name; the determining the initial resource file of the target project comprises:
searching a first configuration file in a publishing platform through the project name; the first configuration file comprises a warehouse address of the target item;
determining a publishing record of the target project through the first configuration file; the release record is obtained through information in a code warehouse; the information at least comprises a branch parameter and a version number corresponding to the latest project code of the target project;
when the release record comprises module parameters, acquiring the module parameters, the branch parameters and the version number from the release record; the module parameters characterize that the latest project codes are included in the code warehouse;
and synthesizing the project name, the warehouse address, the module parameter, the branch parameter and the version number to obtain an initial resource file of the target project.
3. The method of claim 1, wherein the initial resource file comprises a repository address and module parameters; the generating a user resource file to which the target project belongs according to the initial resource file comprises:
using the warehouse address in the initial resource file as an index field, and finding out an item identifier of the target item from a code warehouse; the item identification corresponds to an item name;
determining the project user to which the target project belongs according to the project identifier in the code warehouse;
using the warehouse address and the module parameter as an index field, and finding out maintainer information of the target item from the code warehouse;
and integrating the project name, the warehouse address, the project user and the maintainer information to obtain a user resource file of the target project.
4. The method of claim 1, wherein the initial resource file comprises module parameters; the generating the configuration resource file when the target project is released comprises:
determining project characteristics required by the target project when the target project is released from the release platform according to the module parameters in the initial resource file;
determining a project frame of the target project according to the project characteristics, and determining a second configuration file of the target project through the project frame;
and carrying out field processing on the second configuration file to obtain a configuration resource file when the target project is released.
5. The method according to claim 4, wherein the performing field processing on the second configuration file to obtain a configuration resource file required when the target item is published comprises:
determining the file type of the second configuration file, and preprocessing the second configuration file according to the file type to obtain a preprocessing result; the file type comprises a character type and a special type;
extracting a domain name field, a website field and a port field in the preprocessing result, and carrying out field combination on the domain name field, the website field and the port field to obtain a field combination result;
detecting the availability of the domain name corresponding to the domain name field, the website corresponding to the website field and the port corresponding to the port field according to the field combination result;
and when the domain name, the website and the port are all represented to be available, synthesizing the domain name field, the website field and the port field of the initial resource file and the second configuration file to obtain the configuration resource file of the target project.
6. The method of claim 1, wherein the configuration resource file comprises project parameters; the project parameters at least comprise project names, warehouse addresses, module parameters, branch parameters and version numbers; when the publishing platform publishes the target project, the transferring the configuration resource file to the container platform comprises:
determining a project script when the publishing platform publishes the target project, and adding the project parameters to the annotation field of the container platform in the project script; the field parameters in the configuration resource file comprise a domain name field, a website address field and a port field.
7. The method according to claim 1, wherein the associating the user resource file with the operating resource file to obtain an association relationship corresponding to the target project comprises:
determining respective corresponding query parameters of the user resource file and the operating resource file; the query parameters at least comprise item names or warehouse addresses;
and when the corresponding query parameters of the user resource file and the operating resource file are the same, associating the user resource file with the operating resource file to obtain the association relation of the target project.
8. The method of claim 7, further comprising:
when acquiring a query parameter provided by a user, determining a user resource file corresponding to the query parameter;
performing resource discovery on the target project running on the container platform through the user resource file and the association relation;
and when the found resource is the running resource file, performing chain indexing on the target project until an initial resource file of the target project is found.
9. An apparatus for resource discovery, the apparatus comprising:
the project acquisition module is used for acquiring a target project and determining an initial resource file of the target project; the target project is positioned in a business system; a plurality of servers bearing the service system are deployed on a container platform; each of the servers acts as a node in the container platform;
the file determining module is used for generating a user resource file to which the target project belongs according to the initial resource file and generating a configuration resource file when the target project is issued; when the target project is published by the publishing platform, transmitting the configuration resource file to a container platform, and determining a target node of the target project when the container platform runs; acquiring project parameters of the target project during the operation of the container platform according to the annotation field corresponding to the target node; associating the project parameters, the field parameters in the configuration resource file and the target node to generate a running resource file of the target project when the container platform runs;
the file association module is used for associating the user resource file with the operating resource file to obtain an association relation corresponding to the target project; the incidence relation is used for carrying out resource discovery on the target project operated in the business system.
10. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 8 when executing the computer program.
11. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 8.
CN202211319409.0A 2022-10-26 2022-10-26 Resource discovery method, device, computer equipment and storage medium Active CN115390912B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211319409.0A CN115390912B (en) 2022-10-26 2022-10-26 Resource discovery method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211319409.0A CN115390912B (en) 2022-10-26 2022-10-26 Resource discovery method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115390912A CN115390912A (en) 2022-11-25
CN115390912B true CN115390912B (en) 2023-03-28

Family

ID=84127918

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211319409.0A Active CN115390912B (en) 2022-10-26 2022-10-26 Resource discovery method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115390912B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114721783A (en) * 2022-05-16 2022-07-08 龙芯中科技术股份有限公司 Resource file extraction method and device, electronic equipment and storage medium

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6510450B1 (en) * 1999-02-04 2003-01-21 Novell, Inc. Multiple storage class distributed nametags for locating items in a distributed computing system
CN111221699B (en) * 2018-11-27 2023-10-03 北京神州泰岳软件股份有限公司 Resource association relation discovery method and device and electronic equipment
CN111666081B (en) * 2020-04-30 2024-04-05 平安科技(深圳)有限公司 Git-based project version release method, device, equipment and medium
CN111831362A (en) * 2020-07-28 2020-10-27 浪潮云信息技术股份公司 Method for automatic discovery, classification, deployment and management of K8s environment monitoring
CN111930423B (en) * 2020-09-17 2021-08-24 四川新网银行股份有限公司 Method for tracing software release version based on microservice
CN113312337A (en) * 2021-06-24 2021-08-27 中国农业银行股份有限公司 Construction method and device of application configuration model
CN114911595A (en) * 2022-05-13 2022-08-16 北京字跳网络技术有限公司 Animation resource information processing method, device, equipment, medium and product
CN115185907A (en) * 2022-06-27 2022-10-14 北京奇艺世纪科技有限公司 Front-end resource management method, device, equipment and storage medium

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114721783A (en) * 2022-05-16 2022-07-08 龙芯中科技术股份有限公司 Resource file extraction method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN115390912A (en) 2022-11-25

Similar Documents

Publication Publication Date Title
US9996565B2 (en) Managing an index of a table of a database
US10291704B2 (en) Networked solutions integration using a cloud business object broker
US10002170B2 (en) Managing a table of a database
CN109964216A (en) Identify unknown data object
CN111901294A (en) Method for constructing online machine learning project and machine learning system
CN109582473A (en) Across chain data access method and device based on block chain
CN106648569B (en) Target serialization realization method and device
CN112860777B (en) Data processing method, device and equipment
US20220309105A1 (en) Apparatuses, methods, and computer program products for generating interaction vectors within a multi-component system
US11537367B1 (en) Source code conversion from application program interface to policy document
CN114997111B (en) Service processing method, device, computer equipment and storage medium
CN115390912B (en) Resource discovery method, device, computer equipment and storage medium
CN116204540A (en) Operation log recording method, device, equipment and storage medium
CN113704120A (en) Data transmission method, device, equipment and storage medium
US20140379762A1 (en) Content management system
Mayernik et al. The role of metadata and vocabulary standards in enabling scientific data interoperability: A study of earth system science data facilities
US11468101B2 (en) Context-rich key framework implementations for global concept management
US20210286819A1 (en) Method and System for Operation Objects Discovery from Operation Data
CN113806595B (en) Code search system generation method, code search method and search server
US20240028408A1 (en) Reference implementation of cloud computing resources
Komawar SOLR supported search on an OpenStack metadata service
CN117632965A (en) Identification generation method, device, computer equipment and storage medium
Mansoor Amazon web services
WO2022212379A1 (en) Apparatuses, methods, and computer program products for generating interaction vectors within a multi-component system
CN117312307A (en) Service data processing method, device, computer equipment and storage medium

Legal Events

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