[go: up one dir, main page]

CN112256326B - Information processing method, device, equipment and storage medium - Google Patents

Information processing method, device, equipment and storage medium Download PDF

Info

Publication number
CN112256326B
CN112256326B CN202011162828.9A CN202011162828A CN112256326B CN 112256326 B CN112256326 B CN 112256326B CN 202011162828 A CN202011162828 A CN 202011162828A CN 112256326 B CN112256326 B CN 112256326B
Authority
CN
China
Prior art keywords
information
extraction function
information extraction
environment variable
target information
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
CN202011162828.9A
Other languages
Chinese (zh)
Other versions
CN112256326A (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.)
Beijing Zitiao Network Technology Co Ltd
Original Assignee
Beijing Zitiao Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Zitiao Network Technology Co Ltd filed Critical Beijing Zitiao Network Technology Co Ltd
Priority to CN202011162828.9A priority Critical patent/CN112256326B/en
Publication of CN112256326A publication Critical patent/CN112256326A/en
Application granted granted Critical
Publication of CN112256326B publication Critical patent/CN112256326B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/76Adapting program code to run in a different environment; Porting
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/74Reverse engineering; Extracting design information from source code
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the disclosure discloses a method, a device, equipment and a storage medium for processing information. Comprising the following steps: configuring an information extraction function body of a construction task, and injecting the information extraction function body into the construction task; acquiring environment variable information of the construction task; adding a context code for the information extraction function body according to the environment variable information to obtain a target information extraction function; and the operation library operates the target information extraction function to obtain target information in the environment variable information. According to the information processing method disclosed by the embodiment of the disclosure, the target information in the construction task is obtained by running the target information extraction function, and the task construction information can be extracted in a self-defined manner so as to realize unified management of information contained in environment variables of the construction task.

Description

信息的处理方法、装置、设备及存储介质Information processing method, device, equipment and storage medium

技术领域technical field

本公开实施例涉及计算机技术领域,尤其涉及一种信息的处理方法、装置、设备及存储介质。Embodiments of the present disclosure relate to the field of computer technology, and in particular, to an information processing method, device, device, and storage medium.

背景技术Background technique

若构建任务(如Jenkins任务)通过Hooks机制所启动,启动的过程为:开发者提交代码后,会通过Git仓库触发“Patchset created”事件,进而通知到Jenkins运行对应的构建任务。构建任务在运行时,会为任务进程提供许多内置的环境变量,这些环境变量可以包括任务序号、任务链接、任务名称等信息,而且环境变量中还会携带Git提交的主题、开发者名称、邮箱等具体信息。If the build task (such as the Jenkins task) is started through the Hooks mechanism, the start process is as follows: After the developer submits the code, the "Patchset created" event will be triggered through the Git warehouse, and then Jenkins will be notified to run the corresponding build task. When the build task is running, it will provide many built-in environment variables for the task process. These environment variables can include information such as task serial number, task link, task name, etc., and the environment variables will also carry the subject submitted by Git, developer name, email and other specific information.

构建任务在运行时,通常会获取环境变量中的信息以进行后续的流程(如:通知第三方系统进行状态更改或附加额外信息)。相关技术中,每次会获取到环境变量包含的所有信息,而实际场景中只会用到其中几个目标信息,因此,能够自定义的提取环境变量中的信息显得尤为重要。When the build task is running, it usually obtains the information in the environment variable for subsequent processes (such as: notifying the third-party system to change the state or attach additional information). In related technologies, all the information contained in the environment variable is obtained each time, but only a few of the target information are used in the actual scene. Therefore, it is particularly important to be able to customize and extract the information in the environment variable.

发明内容Contents of the invention

本公开实施例提供一种信息的处理方法、装置、设备及存储介质,可以自定义的提取任务构建信息,以实现对构建任务的环境变量包含的信息的统一管理。Embodiments of the present disclosure provide an information processing method, device, device, and storage medium, which can extract task construction information by self-definition, so as to realize unified management of information contained in environment variables of construction tasks.

第一方面,本公开实施例提供了一种信息的处理方法,包括:In a first aspect, an embodiment of the present disclosure provides an information processing method, including:

配置构建任务的信息提取函数体,并将所述信息提取函数体注入所述构建任务中;configuring the information extraction function body of the construction task, and injecting the information extraction function body into the construction task;

获取所述构建任务的环境变量信息;Obtain the environment variable information of the construction task;

根据所述环境变量信息为所述信息提取函数体添加上下文代码,获得目标信息提取函数;Adding context codes to the information extraction function body according to the environment variable information to obtain a target information extraction function;

运行所述目标信息提取函数,获得所述环境变量信息中的目标信息;其中,所述目标信息为所述目标信息提取函数预定义的信息。Running the target information extraction function to obtain target information in the environment variable information; wherein the target information is information predefined by the target information extraction function.

第二方面,本公开实施例还提供了一种信息的处理装置,包括:In the second aspect, the embodiment of the present disclosure also provides an information processing device, including:

信息提取函数体配置模块,用于配置构建任务的信息提取函数体,并将所述信息提取函数体注入所述构建任务中;An information extraction function body configuration module, configured to configure the information extraction function body of the construction task, and inject the information extraction function body into the construction task;

环境变量信息获取模块,用于获取所述构建任务的环境变量信息;An environment variable information acquisition module, configured to acquire the environment variable information of the construction task;

目标信息提取函数,用于根据所述环境变量信息为所述信息提取函数体添加上下文代码,获得目标信息提取函数;The target information extraction function is used to add context codes to the information extraction function body according to the environment variable information to obtain the target information extraction function;

目标信息获取模块,用于运行所述目标信息提取函数,获得所述环境变量信息中的目标信息;其中,所述目标信息为所述目标信息提取函数预定义的信息。A target information acquisition module, configured to run the target information extraction function to obtain target information in the environmental variable information; wherein the target information is information predefined by the target information extraction function.

第三方面,本公开实施例还提供了一种电子设备,所述电子设备包括:In a third aspect, an embodiment of the present disclosure further provides an electronic device, and the electronic device includes:

一个或多个处理装置;one or more processing devices;

存储装置,用于存储一个或多个程序;storage means for storing one or more programs;

当所述一个或多个程序被所述一个或多个处理装置执行,使得所述一个或多个处理装置实现如本公开实施例所述的信息的处理方法。When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the information processing method described in the embodiments of the present disclosure.

第四方面,本公开实施例还公开了一种计算机可读介质,其上存储有计算机程序,该程序被处理装置执行时实现如本公开实施例所述的信息的处理方法。In a fourth aspect, the embodiments of the present disclosure further disclose a computer-readable medium on which a computer program is stored, and when the program is executed by a processing device, the information processing method described in the embodiments of the present disclosure is implemented.

本公开实施例公开的信息的处理方法、装置、设备及存储介质,首先配置构建任务的信息提取函数体,并将信息提取函数体注入构建任务中,然后获取构建任务的环境变量信息,再然后根据环境变量信息为信息提取函数体添加上下文代码,获得目标信息提取函数,最后运行目标信息提取函数,获得环境变量信息中的目标信息。本公开实施例公开的信息的处理方法,通过运行目标信息提取函数,获得构建任务中的目标信息,可以自定义的提取任务构建信息,以实现对构建任务的环境变量包含的信息的统一管理。The information processing method, device, device, and storage medium disclosed in the embodiments of the present disclosure first configure the information extraction function body of the construction task, inject the information extraction function body into the construction task, and then obtain the environment variable information of the construction task, and then Add context codes to the information extraction function body according to the environment variable information to obtain the target information extraction function, and finally run the target information extraction function to obtain the target information in the environment variable information. The information processing method disclosed in the embodiment of the present disclosure obtains the target information in the construction task by running the target information extraction function, and can extract the task construction information in a customized manner, so as to realize the unified management of the information contained in the environment variables of the construction task.

附图说明Description of drawings

图1是本公开实施例中的一种信息的处理方法的流程图;FIG. 1 is a flowchart of an information processing method in an embodiment of the present disclosure;

图2是本公开实施例中的将信息提取函数体注入构建任务中的示例图;FIG. 2 is an example diagram of injecting an information extraction function body into a construction task in an embodiment of the present disclosure;

图3是本公开实施例中的一种信息的处理的信令图;FIG. 3 is a signaling diagram of information processing in an embodiment of the present disclosure;

图4是本公开实施例中的一种信息的处理的信令图;FIG. 4 is a signaling diagram of information processing in an embodiment of the present disclosure;

图5是本公开实施例中的一种信息的处理装置的结构示意图;Fig. 5 is a schematic structural diagram of an information processing device in an embodiment of the present disclosure;

图6是本公开实施例中的一种电子设备的结构示意图。Fig. 6 is a schematic structural diagram of an electronic device in an embodiment of the present disclosure.

具体实施方式Detailed ways

下面将参照附图更详细地描述本公开的实施例。虽然附图中显示了本公开的某些实施例,然而应当理解的是,本公开可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例,相反提供这些实施例是为了更加透彻和完整地理解本公开。应当理解的是,本公开的附图及实施例仅用于示例性作用,并非用于限制本公开的保护范围。Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the drawings, it should be understood that the disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein; A more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for exemplary purposes only, and are not intended to limit the protection scope of the present disclosure.

应当理解,本公开的方法实施方式中记载的各个步骤可以按照不同的顺序执行,和/或并行执行。此外,方法实施方式可以包括附加的步骤和/或省略执行示出的步骤。本公开的范围在此方面不受限制。It should be understood that the various steps described in the method implementations of the present disclosure may be executed in different orders, and/or executed in parallel. Additionally, method embodiments may include additional steps and/or omit performing illustrated steps. The scope of the present disclosure is not limited in this respect.

本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例”表示“至少一个另外的实施例”;术语“一些实施例”表示“至少一些实施例”。其他术语的相关定义将在下文描述中给出。As used herein, the term "comprise" and its variations are open-ended, ie "including but not limited to". The term "based on" is "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one further embodiment"; the term "some embodiments" means "at least some embodiments." Relevant definitions of other terms will be given in the description below.

需要注意,本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。It should be noted that concepts such as "first" and "second" mentioned in this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the sequence of functions performed by these devices, modules or units or interdependence.

需要注意,本公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应该理解为“一个或多个”。It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative and not restrictive, and those skilled in the art should understand that unless the context clearly indicates otherwise, it should be understood as "one or more" multiple".

本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。The names of messages or information exchanged between multiple devices in the embodiments of the present disclosure are used for illustrative purposes only, and are not used to limit the scope of these messages or information.

本公开实施例中,构建任务可以是Jenkins任务,Jenkins是一个开源的、提供友好操作界面的持续集成工具,主要用于持续、自动的构建/测试软件项目、监控外部任务的运行。而任务(Job)是Jenkins的一个执行计划,是一系列操作的集合。在Jenkins服务就绪之后,我们可以通过Web服务界面的“New Item”来创建具体的Jenkins Task。本公开实施例中,主要针对流水线类型的任务(以下简称为Jenkins Pipeline Task)In the embodiment of the present disclosure, the construction task may be a Jenkins task. Jenkins is an open source continuous integration tool that provides a friendly operation interface, and is mainly used for continuous and automatic construction/testing of software projects and monitoring the operation of external tasks. The task (Job) is an execution plan of Jenkins, which is a collection of a series of operations. After the Jenkins service is ready, we can create a specific Jenkins Task through the "New Item" of the Web service interface. In the embodiment of the present disclosure, it is mainly aimed at pipeline-type tasks (hereinafter referred to as Jenkins Pipeline Task)

其中,Jenkins Pipeline Task可以采用Groovy语法来定义。Jenkins PipelineTask定义的具体行为包括:通过label指定具体执行任务的Slave节点机器;定义此Task运行时的自定义环境变量;定义不同的执行阶段;使用简单的内置sh指令运行shell脚本或者python脚本。Among them, Jenkins Pipeline Task can be defined using Groovy syntax. The specific behaviors defined by Jenkins PipelineTask include: specifying the Slave node machine that executes the task through the label; defining custom environment variables when the Task is running; defining different execution stages; using simple built-in sh commands to run shell scripts or python scripts.

Jenkins Job运行的目标多种多样,例如:执行编译任务,生成编译后的产物;执行部署任务,部署某些服务。本公开实施例中,主要关注执行编译任务。Jenkins Job runs a variety of goals, such as: execute compilation tasks, generate compiled products; execute deployment tasks, and deploy certain services. In the embodiments of the present disclosure, the focus is mainly on executing compilation tasks.

Jenkins Job在启动时,会为每一个Job进程传递许多环境变量,使得当前运行的任务在运行自定义脚本时获知自己所处的环境,例如:BUILD_NUMBER:The current buildnumber,such as"153";BUILD_ID:The current build ID,identical to BUILD_NUMBERfor builds created in 1.597+,but a YYYY-MM-DD_hh-mm-ss timestamp for olderbuilds;BUILD_URL:Full URL of this build,like http://server:port/jenkins/job/foo/15/;JOB_URL:Full URL of this job,like http://server:port/jenkins/job/foo/。When Jenkins Job starts, it will pass many environment variables to each Job process, so that the currently running task knows its own environment when running a custom script, for example: BUILD_NUMBER: The current buildnumber, such as "153"; BUILD_ID :The current build ID,identical to BUILD_NUMBER for builds created in 1.597+,but a YYYY-MM-DD_hh-mm-ss timestamp for older builds; BUILD_URL:Full URL of this build,like http://server:port/jenkins/job /foo/15/; JOB_URL: Full URL of this job, like http://server:port/jenkins/job/foo/.

其中,BUILD_NUMBER为构建任务的排队序号;BUILD_ID为构建任务的ID;BUILD_URL为基于Web访问,当前正在运行的构建任务具体的Job地址;JOB_URL:基于Web访问,当前构建任务具体的Task地址。Among them, BUILD_NUMBER is the queuing number of the build task; BUILD_ID is the ID of the build task; BUILD_URL is the specific Job address of the currently running build task based on Web access; JOB_URL: the specific Task address of the current build task based on Web access.

图1为本公开实施例提供的一种信息的处理方法的流程图,本实施例可适用于对构建任务中的目标信息进行提取的情况,该方法可以由信息的处理装置来执行,该装置可由硬件和/或软件组成,并一般可集成在具有信息的处理功能的设备中,该设备可以是服务器、移动终端或服务器集群等电子设备。如图1所示,具体包括如下步骤:Fig. 1 is a flow chart of an information processing method provided by an embodiment of the present disclosure. This embodiment is applicable to the situation of extracting target information in a construction task, and the method can be executed by an information processing device, the device It can be composed of hardware and/or software, and can generally be integrated into a device with information processing functions, which can be an electronic device such as a server, a mobile terminal, or a server cluster. As shown in Figure 1, it specifically includes the following steps:

步骤110,配置构建任务的信息提取函数体,并将信息提取函数体注入构建任务中。Step 110, configure the information extraction function body of the construction task, and inject the information extraction function body into the construction task.

其中,信息提取函数体可以由原生JavaScript代码所编写的函数代码块,可以根据实际需求对函数体进行自定义。本公开实施例中,信息提取函数体的形式可以是:Wherein, the information extraction function body can be a function code block written by native JavaScript code, and the function body can be customized according to actual needs. In the embodiment of the present disclosure, the form of the information extraction function body may be:

Figure BDA0002744795230000061
Figure BDA0002744795230000061

如上所述,信息提取函数体通过changeInfo,buildInfo,accountInfo三个入参来提取构建任务在运行过程中环境变量中的信息。As mentioned above, the information extraction function body extracts the information in the environment variables during the running of the build task through three input parameters: changeInfo, buildInfo, and accountInfo.

其中,将信息提取函数体注入构建任务中的方式可以是:获取构建任务的环境变量配置入口;通过配置入口将信息提取函数体添加至构建任务的环境变量中。Wherein, the method of injecting the information extraction function body into the construction task may be: obtaining the environment variable configuration entry of the construction task; adding the information extraction function body to the environment variable of the construction task through the configuration entry.

本公开实施例中,信息提取函数体是一段以字符串形式保存的代码块,可以通过Jenkins Web界面提供的环境变量配置入口将信息提取函数体添加至构建任务的环境变量中。示例性的,图2为将信息提取函数体注入构建任务中的示例图,如图2所示,通过配置构建任务的环境变量,将信息提取函数体注入构建任务,且名称为“ISSUE_ID_EXTRACTOR”。这样做的好处可以是可以通过常规的获取环境变量的方式获取到信息提取函数体。In the embodiment of the present disclosure, the information extraction function body is a code block saved in the form of a string, and the information extraction function body can be added to the environment variable of the construction task through the environment variable configuration entry provided by the Jenkins Web interface. Exemplarily, FIG. 2 is an example diagram of injecting the information extraction function body into the construction task. As shown in FIG. 2 , by configuring the environment variables of the construction task, the information extraction function body is injected into the construction task, and the name is "ISSUE_ID_EXTRACTOR". The advantage of doing this may be that the body of the information extraction function can be obtained through a conventional way of obtaining environment variables.

步骤120,获取构建任务的环境变量信息。Step 120, obtaining environment variable information of the construction task.

其中,环境变量信息可以包括构建任务内置的环境变量信息和开发者提交的Git信息。内置的环境变量信息可以包括:任务序号、任务链接、任务名称等信息;Git信息可以包括主题、开发者名称、邮箱等具体信息。Wherein, the environment variable information may include built-in environment variable information of the build task and Git information submitted by the developer. The built-in environment variable information can include: task serial number, task link, task name and other information; Git information can include specific information such as subject, developer name, and email address.

本公开实施例中,开发者提交代码后,会通过Git仓库触发"Patchset created"事件,以通知Jenkins运行相关的构建任务,在构建任务运行中,可以获取到内置的环境变量信息和开发者提交的Git信息。In the embodiment of the present disclosure, after the developer submits the code, the "Patchset created" event will be triggered through the Git warehouse to notify Jenkins to run the related construction task. During the construction task operation, the built-in environment variable information and the developer's submission can be obtained. Git information.

获取的方式可以是:The way to get it can be:

1.const GERRIT_CHANGE_SUBJECT:string=process.env.GERRIT_CHANGE_SUBJECT||”;1.const GERRIT_CHANGE_SUBJECT:string=process.env.GERRIT_CHANGE_SUBJECT||";

2.const GERRIT_CHANGE_URL:string=process.env.GERRIT_CHANGE_URL||”;2.const GERRIT_CHANGE_URL:string=process.env.GERRIT_CHANGE_URL||";

3.//生成器函数体作为环境变量被传递进来我们可以直接取到3.//The generator function body is passed in as an environment variable and we can get it directly

4.const ISSUE_ID_EXTRACTOR:string=process.env.ISSUE_ID_EXTRACTOR||”;。4. const ISSUE_ID_EXTRACTOR:string=process.env.ISSUE_ID_EXTRACTOR||";.

步骤130,根据环境变量信息为信息提取函数体添加上下文代码,获得目标信息提取函数。Step 130, adding context codes to the body of the information extraction function according to the environment variable information to obtain the target information extraction function.

本公开实施例中,要使信息提取函数体运行起来,需要一个“上下文环境”,因此,需要为信息提取函数体添加上下文代码。其中,目标信息提取函数包括上下文代码和信息提取函数体。In the embodiment of the present disclosure, a "context environment" is needed to make the information extraction function body run. Therefore, context code needs to be added to the information extraction function body. Wherein, the target information extraction function includes context code and information extraction function body.

具体的,根据环境变量信息为信息提取函数体添加上下文代码,获得目标信息提取函数的方式可以是:对信息提取函数体添加上下文代码模板;根据环境变量信息替换上下文代码模板中的占位符变量。Specifically, adding context codes to the information extraction function body according to the environment variable information, the way to obtain the target information extraction function can be: adding a context code template to the information extraction function body; replacing the placeholder variables in the context code template according to the environment variable information .

其中,上下文模块中包含有占位符变量。示例性的,可以将上下文模板命名为extractor.tps,该上下文模块的内容如下:Among them, the context module contains placeholder variables. Exemplarily, the context template can be named extractor.tps, and the content of the context module is as follows:

Figure BDA0002744795230000071
Figure BDA0002744795230000071

Figure BDA0002744795230000081
Figure BDA0002744795230000081

如上述文件,扩展名为"tps",且不可以直接运行,其中${GERRIT_XXX}形式的字符串为各个占位符变量,终会被实际变量给替换掉。且为了方便取到各个信息,上述上下文代码模板中,针对不同种类的参数进行了聚合,并且使得变量命名更具语义化。上述上下文代码模板中,除去"ISSUE_ID_EXTRACTOR",其余的占位符都需要使用单引号扩起来。因为"ISSUE_ID_EXTRACTOR"本身将要作为一个函数来运行,故其不需要增加单引号包裹的。而其他的占位符则是各个作为字符串传递进来的环境变量,因此需要采用单引号包裹起来。As in the above file, the extension is "tps" and cannot be run directly. The strings in the form of ${GERRIT_XXX} are placeholder variables, which will eventually be replaced by actual variables. And in order to facilitate access to various information, in the above context code template, different types of parameters are aggregated, and the variable naming is more semantic. In the above context code template, except "ISSUE_ID_EXTRACTOR", the remaining placeholders need to be expanded with single quotes. Because "ISSUE_ID_EXTRACTOR" itself will be run as a function, it does not need to be wrapped in single quotes. The other placeholders are environment variables passed in as strings, so they need to be wrapped in single quotes.

本公开实施例中,根据环境变量信息替换上下文代码模板中的占位符变量的过程可以是:基于设定标准函数读取上下文代码模板,获得占位符变量;将占位符变量替换为环境变量信息中对应的实际变量。In the embodiment of the present disclosure, the process of replacing the placeholder variable in the context code template according to the environment variable information may be: read the context code template based on the set standard function to obtain the placeholder variable; replace the placeholder variable with the environment The corresponding actual variable in the variable information.

其中,设定标准函数可以是fs.readFileSync。本公开实施例中,读取上下文代码模板时,需要先执行如下操作:Wherein, the setting standard function may be fs.readFileSync. In the disclosed embodiment, when reading the context code template, the following operations need to be performed first:

1.const EXTRACTER_PATH:string=path.resolve(__dirname,'sandbox/extracter.tps');1.const EXTRACTER_PATH:string=path.resolve(__dirname,'sandbox/extracter.tps');

2.const EXTRACTER_TPL:string=fs.readFileSync(EXTRACTER_PATH).toString();。2. const EXTRACTER_TPL:string = fs.readFileSync(EXTRACTER_PATH).toString();.

即需要先确定上下文代码模块所在的位置,再进行读取。示例性的,将占位符变量替换为环境变量信息中对应的实际变量的方式可以如下所示:That is, it is necessary to determine the location of the context code module before reading it. Exemplarily, the manner of replacing the placeholder variable with the corresponding actual variable in the environment variable information may be as follows:

Figure BDA0002744795230000091
Figure BDA0002744795230000091

Figure BDA0002744795230000101
Figure BDA0002744795230000101

由上述代码可以看出,最终通过ISSUE_ID_EXTRACTOR(changeInfo,buildInfo,accountInfo)语句调用信息提取函数。changeInfo,buildInfo,accountInfo为上下文代码模板中定义的三个变量,且三个变量中对于每一个可使用的环境变量做了归类、聚合,以便于Jenkins Task管理员在完善生成器函数逻辑时可以直接通过入参访问到这些变量:It can be seen from the above code that the information extraction function is finally called through the ISSUE_ID_EXTRACTOR (changeInfo, buildInfo, accountInfo) statement. changeInfo, buildInfo, and accountInfo are the three variables defined in the context code template, and each of the three variables is classified and aggregated for each available environment variable, so that the Jenkins Task administrator can improve the logic of the generator function. Access these variables directly through input parameters:

Figure BDA0002744795230000102
Figure BDA0002744795230000102

如上代码,最终的生成器函数体中,我们可以直接访问到changeInfo.subject这个变量。此变量对应于具体的环境变量为:process.env.GERRIT_CHANGE_SUBJECT。In the above code, in the final generator function body, we can directly access the variable changeInfo.subject. This variable corresponds to a specific environment variable: process.env.GERRIT_CHANGE_SUBJECT.

可选的,在根据环境变量信息为信息提取函数体添加上下文代码之前,还包括如下步骤:为构建任务添加调用脚本。Optionally, before adding context codes to the information extraction function body according to the environment variable information, the following step is further included: adding a calling script for the build task.

其中,调用脚本用于当构建任务运行至设定阶段时,执行根据环境变量信息为信息提取函数体添加上下文代码的操作。Wherein, the call script is used to execute the operation of adding context codes to the information extraction function body according to the environment variable information when the construction task runs to the setting stage.

本公开实施例中,要使得构建任务运行至设定阶段,执行某一逻辑,需要配置脚本。示例性的,如下是本公开实施例的调用脚本的例子:In the embodiment of the present disclosure, to make the construction task run to the setting stage and execute a certain logic, a configuration script is required. Exemplarily, the following is an example of calling a script in an embodiment of the present disclosure:

Figure BDA0002744795230000103
Figure BDA0002744795230000103

Figure BDA0002744795230000111
Figure BDA0002744795230000111

如上所示,配置的调用脚本为当构建任务运行成功后,运行一个build_success.ts脚本,以执行根据环境变量信息对信息提取函数体添加上下文代码的操作。As shown above, the configured calling script is to run a build_success.ts script after the build task runs successfully to execute the operation of adding context code to the information extraction function body according to the environment variable information.

可选的,根据所述环境变量信息为所述信息提取函数体添加上下文代码,的过程可以是:当所述构建任务运行至所述设定阶段时,根据所述环境变量信息为所述信息提取函数体添加上下文代码。Optionally, the process of adding context codes to the information extraction function body according to the environment variable information may be: when the construction task runs to the setting stage, add the information to the information according to the environment variable information Extract function body to add context code.

示例性的,图3是本公开实施例中一种信息的处理的信令图。如图3所示,任务管理员通过环境变量对构建任务配置信息提取函数,配置成功后,启动静态任务,通过创建任务实例以运行构建任务,在构建任务运行至设定阶段时,通过运行配置的信息提取函数提取构建任务中的目标信息,并将结果返回至任务管理员。Exemplarily, FIG. 3 is a signaling diagram of information processing in an embodiment of the present disclosure. As shown in Figure 3, the task administrator configures the information extraction function for the construction task through environment variables. After the configuration is successful, the static task is started, and the construction task is run by creating a task instance. The information extraction function extracts the target information in the build task and returns the result to the task manager.

步骤140,运行目标信息提取函数,获得环境变量信息中的目标信息。Step 140, run the target information extraction function to obtain the target information in the environment variable information.

其中,目标信息为目标信息提取函数预定义的信息。Wherein, the target information is information predefined by the target information extraction function.

可选的,运行库运行目标信息提取函数,获得环境变量信息中的目标信息的方式可以是:调用第三方运行库,并获取第三方运行库关联的构造函数;基于构造函数创建函数运行环境;将目标信息提取函数发送至函数运行环境中运行,获得环境变量信息中的目标信息。Optionally, the runtime library runs the target information extraction function, and the way to obtain the target information in the environment variable information may be: calling a third-party runtime library and obtaining a constructor associated with the third-party runtime library; creating a function runtime environment based on the constructor; The target information extraction function is sent to the function running environment to run, and the target information in the environment variable information is obtained.

其中,第三方运行库可以通过sandbox机制实现,例如可以是Node Sandbox库。该第三方运行库支持如下功能:可以用来执行非信任的代码、支持执行时长超长过期、支持内存错误报警、支持优雅的错误处理及支持严格模式等。函数运行环境可以是沙盒环境。获取第三方运行库关联的构造函数的方式可以是:采用Typescript的引入关联的语法,例如:import Sandbox from'sandbox'。创建函数运行环境的方式可以是:根据sandbox所提供的官方api,可以通过如下步骤创建一个node.js沙盒环境:const sandbox=new Sandbox()。Wherein, the third-party runtime library can be implemented through a sandbox mechanism, for example, it can be a Node Sandbox library. The third-party runtime library supports the following functions: it can be used to execute untrusted code, it supports long execution time and expires, it supports memory error alarms, it supports elegant error handling, and it supports strict mode, etc. The function execution environment may be a sandbox environment. The way to obtain the constructor associated with the third-party runtime library can be: use Typescript's syntax for importing associations, for example: import Sandbox from'sandbox'. The way to create a function running environment can be: according to the official API provided by the sandbox, a node.js sandbox environment can be created through the following steps: const sandbox=new Sandbox().

可选的,运行目标信息提取函数,获得环境变量信息中的目标信息的过程可以是:将目标信息提取函数的运行结果转换为字符串类型;对字符串类型的运行结果进行裁剪处理,获得目标信息。Optionally, the process of running the target information extraction function to obtain the target information in the environment variable information may be: converting the operation result of the target information extraction function into a string type; cutting the operation result of the string type to obtain the target information.

其中,裁剪处理可以是去掉前后的空格等。Wherein, the cropping process may be to remove spaces before and after, and the like.

本公开实施例中,在获得环境变量信息中的目标信息后,可以通过回调函数承接返回值,然后自定义回调函数接收的目标信息。In the embodiment of the present disclosure, after the target information in the environment variable information is obtained, the return value can be accepted through the callback function, and then the target information received by the callback function can be customized.

本公开实施例中,在获得目标信息后,可以根据目标信息进行通知第三方系统进行状态更改或附加额外信息等后续操作。In the embodiment of the present disclosure, after the target information is obtained, follow-up operations such as notifying the third-party system to perform state changes or adding additional information may be performed according to the target information.

示例性的,图4是本公开实施例中的一种信息的处理的信令图。如图4所示,当构建任务运行至设定阶段时,运行调用脚本,通过调用脚本读取上下文代码模板;获取环境变量信息;再然后根据将所述占位符变量替换为所述环境变量信息中对应的实际变量;将生成的信息提取函数进行存储;调用第三方运行库;由第三方运行库运行信息提取函数;由回调函数获得提取的目标信息,将结果返回。Exemplarily, FIG. 4 is a signaling diagram of information processing in an embodiment of the present disclosure. As shown in Figure 4, when the construction task runs to the setting stage, run the calling script, read the context code template by calling the script; obtain the environment variable information; then replace the placeholder variable with the environment variable according to The corresponding actual variable in the information; store the generated information extraction function; call the third-party runtime; run the information extraction function by the third-party runtime; obtain the extracted target information by the callback function, and return the result.

本公开实施例的技术方案,首先配置构建任务的信息提取函数体,并将信息提取函数体注入构建任务中,然后获取构建任务的环境变量信息,再然后根据环境变量信息为信息提取函数体添加上下文代码,获得目标信息提取函数,最后运行库运行目标信息提取函数,获得环境变量信息中的目标信息。本公开实施例公开的信息的处理方法,通过运行目标信息提取函数,获得构建任务中的目标信息,可以自定义的提取任务构建信息,以实现对构建任务的环境变量包含的信息的统一管理。In the technical solution of the disclosed embodiment, first configure the information extraction function body of the construction task, inject the information extraction function body into the construction task, then obtain the environment variable information of the construction task, and then add the information extraction function body according to the environment variable information The context code obtains the target information extraction function, and finally the runtime library runs the target information extraction function to obtain the target information in the environment variable information. The information processing method disclosed in the embodiment of the present disclosure obtains the target information in the construction task by running the target information extraction function, and can extract the task construction information in a customized manner, so as to realize the unified management of the information contained in the environment variables of the construction task.

图5是本公开实施例提供的一种信息的处理装置的结构示意图,如图5所示,该装置包括:信息提取函数体配置模块210,环境变量信息获取模块220,目标信息提取函数获取模块230和目标信息获取模块240。Fig. 5 is a schematic structural diagram of an information processing device provided by an embodiment of the present disclosure. As shown in Fig. 5, the device includes: an information extraction function body configuration module 210, an environment variable information acquisition module 220, and a target information extraction function acquisition module 230 and target information acquisition module 240.

信息提取函数体配置模块210,用于配置构建任务的信息提取函数体,并将信息提取函数体注入构建任务中;The information extraction function body configuration module 210 is configured to configure the information extraction function body of the construction task, and inject the information extraction function body into the construction task;

环境变量信息获取模块220,用于获取构建任务的环境变量信息;The environment variable information acquisition module 220 is used to acquire the environment variable information of the construction task;

目标信息提取函数获取模块230,用于根据环境变量信息为信息提取函数体添加上下文代码,获得目标信息提取函数;The target information extraction function acquisition module 230 is used to add context codes to the information extraction function body according to the environment variable information to obtain the target information extraction function;

目标信息获取模块240,用于运行库运行目标信息提取函数,获得环境变量信息中的目标信息;其中,所述目标信息为所述目标信息提取函数预定义的信息。The target information acquisition module 240 is used to run the library to run the target information extraction function to obtain the target information in the environment variable information; wherein, the target information is information predefined by the target information extraction function.

可选的,信息提取函数体配置模块210,还用于:Optionally, the information extraction function body configuration module 210 is also used for:

获取构建任务的环境变量配置入口;Obtain the environment variable configuration entry of the build task;

通过配置入口将信息提取函数体添加至构建任务的环境变量中。Add the information extraction function body to the environment variable of the build task through the configuration entry.

可选的,目标信息提取函数获取模块230,还用于:Optionally, the target information extraction function acquisition module 230 is also used for:

对信息提取函数体添加上下文代码模板;Add a contextual code template to the body of the information extraction function;

根据环境变量信息替换上下文代码模板中的占位符变量。Replace placeholder variables in context code templates based on environment variable information.

可选的,目标信息提取函数获取模块230,还用于:Optionally, the target information extraction function acquisition module 230 is also used for:

基于设定标准函数读取上下文代码模板,获得占位符变量;Read the context code template based on the set standard function to obtain the placeholder variable;

将占位符变量替换为环境变量信息中对应的实际变量。Replace the placeholder variables with the corresponding actual variables in the environment variable information.

可选的,还包括:调用脚本添加模块,用于:Optionally, also include: calling scripts to add modules for:

为构建任务添加调用脚本;调用脚本用于当构建任务运行至设定阶段时,执行根据环境变量信息对信息提取函数体添加上下文代码的操作;Add a call script for the build task; the call script is used to perform the operation of adding context code to the information extraction function body according to the environment variable information when the build task runs to the setting stage;

可选的,目标信息提取函数获取模块230,还用于:Optionally, the target information extraction function acquisition module 230 is also used for:

当构建任务运行至设定阶段时,根据环境变量信息对信息提取函数体添加上下文代码。When the construction task runs to the setting stage, context code is added to the body of the information extraction function according to the environment variable information.

可选的,目标信息提取模块240,还用于:Optionally, the target information extraction module 240 is also used for:

调用第三方运行库,并获取第三方运行库关联的构造函数;Call the third-party runtime library and obtain the constructor associated with the third-party runtime library;

基于构造函数创建函数运行环境;Create a function runtime environment based on the constructor;

将目标信息提取函数发送至函数运行环境中运行,获得环境变量信息中的目标信息。The target information extraction function is sent to the function running environment to run, and the target information in the environment variable information is obtained.

可选的,目标信息提取模块240,还用于:Optionally, the target information extraction module 240 is also used for:

将目标信息提取函数的运行结果转换为字符串类型;Convert the running result of the target information extraction function into a string type;

对字符串类型的运行结果进行裁剪处理,获得目标信息。Cut out the operation result of the string type to obtain the target information.

上述装置可执行本公开前述所有实施例所提供的方法,具备执行上述方法相应的功能模块和有益效果。未在本实施例中详尽描述的技术细节,可参见本公开前述所有实施例所提供的方法。The above-mentioned device can execute the methods provided by all the foregoing embodiments of the present disclosure, and has corresponding functional modules and advantageous effects for executing the above-mentioned methods. For technical details not described in detail in this embodiment, reference may be made to the methods provided in all the foregoing embodiments of the present disclosure.

下面参考图6,其示出了适于用来实现本公开实施例的电子设备300的结构示意图。本公开实施例中的电子设备可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字TV、台式计算机等等的固定终端,或者各种形式的服务器,如独立服务器或者服务器集群。图6示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。Referring now to FIG. 6 , it shows a schematic structural diagram of an electronic device 300 suitable for implementing an embodiment of the present disclosure. The electronic equipment in the embodiment of the present disclosure may include but not limited to such as mobile phone, notebook computer, digital broadcast receiver, PDA (personal digital assistant), PAD (tablet computer), PMP (portable multimedia player), vehicle terminal (such as Mobile terminals such as car navigation terminals) and fixed terminals such as digital TVs, desktop computers, etc., or various forms of servers, such as independent servers or server clusters. The electronic device shown in FIG. 6 is only an example, and should not limit the functions and application scope of the embodiments of the present disclosure.

如图6所示,电子设备300可以包括处理装置(例如中央处理器、图形处理器等)301,其可以根据存储在只读存储装置(ROM)302中的程序或者从存储装置305加载到随机访问存储装置(RAM)303中的程序而执行各种适当的动作和处理。在RAM 303中,还存储有电子设备300操作所需的各种程序和数据。处理装置301、ROM 302以及RAM 303通过总线304彼此相连。输入/输出(I/O)接口305也连接至总线304。As shown in FIG. 6 , an electronic device 300 may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 301, which may be stored in a read-only storage device (ROM) 302 or loaded into a random Various appropriate actions and processes are executed by accessing programs in the storage device (RAM) 303 . In the RAM 303, various programs and data necessary for the operation of the electronic device 300 are also stored. The processing device 301 , ROM 302 and RAM 303 are connected to each other through a bus 304 . An input/output (I/O) interface 305 is also connected to the bus 304 .

通常,以下装置可以连接至I/O接口305:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置306;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置307;包括例如磁带、硬盘等的存储装置308;以及通信装置309。通信装置309可以允许电子设备300与其他设备进行无线或有线通信以交换数据。虽然图6示出了具有各种装置的电子设备300,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。Typically, the following devices can be connected to the I/O interface 305: input devices 306 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a liquid crystal display (LCD), speaker, vibrating an output device 307 such as a computer; a storage device 308 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 309. The communication means 309 may allow the electronic device 300 to perform wireless or wired communication with other devices to exchange data. While FIG. 6 shows electronic device 300 having various means, it should be understood that implementing or having all of the means shown is not a requirement. More or fewer means may alternatively be implemented or provided.

特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行词语的推荐方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置309从网络上被下载和安装,或者从存储装置305被安装,或者从ROM 302被安装。在该计算机程序被处理装置301执行时,执行本公开实施例的方法中限定的上述功能。In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer readable medium, the computer program comprising program code for performing a word recommendation method. In such an embodiment, the computer program may be downloaded and installed from a network via communication means 309 , or from storage means 305 , or from ROM 302 . When the computer program is executed by the processing device 301, the above-mentioned functions defined in the methods of the embodiments of the present disclosure are performed.

需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer diskettes, hard disks, random access memory (RAM), read-only memory (ROM), erasable Programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present disclosure, however, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave carrying computer-readable program code therein. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can transmit, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device . Program code embodied on a computer readable medium may be transmitted by any appropriate medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

在一些实施方式中,客户端、服务器可以利用诸如HTTP(HyperText TransferProtocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(“LAN”),广域网(“WAN”),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。In some embodiments, the client and the server can communicate using any currently known or future-developed network protocols such as HTTP (HyperText Transfer Protocol, Hypertext Transfer Protocol), and can communicate with digital data in any form or medium (eg, communication network) interconnections. Examples of communication networks include local area networks ("LANs"), wide area networks ("WANs"), internetworks (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network of.

上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。The above-mentioned computer-readable medium may be included in the above-mentioned electronic device, or may exist independently without being incorporated into the electronic device.

上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:配置构建任务的信息提取函数体,并将所述信息提取函数体注入所述构建任务中;获取所述构建任务的环境变量信息;根据所述环境变量信息为所述信息提取函数体添加上下文代码,获得目标信息提取函数;运行库运行所述目标信息提取函数,获得所述环境变量信息中的目标信息。The above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by the electronic device, the electronic device: configures the information extraction function body of the construction task, and injects the information extraction function body into In the construction task; obtain the environment variable information of the construction task; add context codes to the information extraction function body according to the environment variable information to obtain the target information extraction function; run the target information extraction function in the runtime library to obtain Target information in the environment variable information.

可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, or combinations thereof, including but not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and Includes conventional procedural programming languages - such as the "C" language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In cases involving a remote computer, the remote computer can be connected to the user computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as through an Internet service provider). Internet connection).

附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, program segment, or portion of code that contains one or more logical functions for implementing specified executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved. It should also be noted that each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented by a dedicated hardware-based system that performs the specified functions or operations , or may be implemented by a combination of dedicated hardware and computer instructions.

描述于本公开实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,单元的名称在某种情况下并不构成对该单元本身的限定。The units involved in the embodiments described in the present disclosure may be implemented by software or by hardware. Wherein, the name of a unit does not constitute a limitation of the unit itself under certain circumstances.

本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、片上系统(SOC)、复杂可编程逻辑设备(CPLD)等等。The functions described herein above may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), System on Chips (SOCs), Complex Programmable Logical device (CPLD) and so on.

在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media would include one or more wire-based electrical connections, portable computer discs, hard drives, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, compact disk read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.

根据本公开实施例的一个或多个实施例,本公开实施例公开一种信息的处理方法,包括:According to one or more embodiments of the embodiments of the present disclosure, the embodiments of the present disclosure disclose a method for processing information, including:

配置构建任务的信息提取函数体,并将所述信息提取函数体注入所述构建任务中;configuring the information extraction function body of the construction task, and injecting the information extraction function body into the construction task;

获取所述构建任务的环境变量信息;Obtain the environment variable information of the construction task;

根据所述环境变量信息为所述信息提取函数体添加上下文代码,获得目标信息提取函数;Adding context codes to the information extraction function body according to the environment variable information to obtain a target information extraction function;

运行所述目标信息提取函数,获得所述环境变量信息中的目标信息;所述目标信息为所述目标信息提取函数预定义的信息。Running the target information extraction function to obtain target information in the environment variable information; the target information is information predefined by the target information extraction function.

进一步地,将所述信息提取函数体注入所述构建任务中,包括:Further, injecting the information extraction function body into the construction task includes:

获取所述构建任务的环境变量配置入口;Obtain the environment variable configuration entry of the construction task;

通过所述配置入口将所述信息提取函数体添加至所述构建任务的环境变量中。Add the information extraction function body to the environment variable of the construction task through the configuration entry.

进一步地,根据所述环境变量信息为所述信息提取函数体添加上下文代码,获得目标信息提取函数,包括:Further, add context codes to the information extraction function body according to the environment variable information to obtain the target information extraction function, including:

对所述信息提取函数体添加上下文代码模板;Adding a context code template to the information extraction function body;

根据所述环境变量信息替换所述上下文代码模板中的占位符变量。The placeholder variable in the context code template is replaced according to the environment variable information.

进一步地,根据所述环境变量信息替换所述上下文代码模板中的占位符变量,包括:Further, replacing the placeholder variable in the context code template according to the environment variable information includes:

基于设定标准函数读取所述上下文代码模板,获得占位符变量;Reading the context code template based on the set standard function to obtain a placeholder variable;

将所述占位符变量替换为所述环境变量信息中对应的实际变量。The placeholder variable is replaced with a corresponding actual variable in the environment variable information.

进一步地,在根据所述环境变量信息为所述信息提取函数体添加上下文代码之前,还包括:Further, before adding context codes to the information extraction function body according to the environment variable information, it also includes:

为所述构建任务添加调用脚本;所述调用脚本用于当所述构建任务运行至设定阶段时,执行根据所述环境变量信息为所述信息提取函数体添加上下文代码的操作;Adding a call script to the construction task; the call script is used to execute the operation of adding context codes to the information extraction function body according to the environment variable information when the construction task runs to the setting stage;

相应的,根据所述环境变量信息为所述信息提取函数体添加上下文代码,包括:Correspondingly, add context codes to the information extraction function body according to the environment variable information, including:

当所述构建任务运行至所述设定阶段时,根据所述环境变量信息对所述信息提取函数体添加上下文代码。When the construction task runs to the setting stage, context code is added to the information extraction function body according to the environment variable information.

进一步地,调用第三方运行库运行所述目标信息提取函数,以提取所述环境变量信息中的目标信息,包括:Further, calling a third-party runtime library to run the target information extraction function to extract the target information in the environment variable information, including:

调用第三方运行库,并获取第三方运行库关联的构造函数;Call the third-party runtime library and obtain the constructor associated with the third-party runtime library;

基于所述构造函数创建函数运行环境;Create a function execution environment based on the constructor;

将所述目标信息提取函数发送至所述函数运行环境中运行,获得所述环境变量信息中的目标信息。Send the target information extraction function to run in the function running environment to obtain the target information in the environment variable information.

进一步地,,运行所述目标信息提取函数,获得所述环境变量信息中的目标信息,包括:Further, the target information in the environment variable information is obtained by running the target information extraction function, including:

将所述目标信息提取函数的运行结果转换为字符串类型;converting the operation result of the target information extraction function into a string type;

对所述字符串类型的运行结果进行裁剪处理,获得目标信息。The operation result of the character string type is clipped to obtain the target information.

注意,上述仅为本公开的较佳实施例及所运用技术原理。本领域技术人员会理解,本公开不限于这里所述的特定实施例,对本领域技术人员来说能够进行各种明显的变化、重新调整和替代而不会脱离本公开的保护范围。因此,虽然通过以上实施例对本公开进行了较为详细的说明,但是本公开不仅仅限于以上实施例,在不脱离本公开构思的情况下,还可以包括更多其他等效实施例,而本公开的范围由所附的权利要求范围决定。Note that the above are only preferred embodiments and technical principles used in the present disclosure. Those skilled in the art will understand that the present disclosure is not limited to the specific embodiments described herein, and that various obvious changes, rearrangements, and substitutions may be made by those skilled in the art without departing from the scope of the present disclosure. Therefore, although the present disclosure has been described in detail through the above embodiments, the present disclosure is not limited to the above embodiments, and can also include more other equivalent embodiments without departing from the concept of the present disclosure. The scope is determined by the scope of the appended claims.

Claims (8)

1. A method of processing information, comprising:
configuring an information extraction function body of a construction task, and injecting the information extraction function body into the construction task;
acquiring environment variable information of the construction task;
adding a context code for the information extraction function body according to the environment variable information to obtain a target information extraction function;
operating the target information extraction function to obtain target information in the environment variable information; wherein the target information is information predefined by the target information extraction function;
the operating the target information extraction function to obtain target information in the environment variable information includes:
calling a third-party operation library and acquiring a construction function associated with the third-party operation library;
creating a function running environment based on the constructor;
the target information extraction function is sent to the function operation environment to operate, and the target information in the environment variable information is obtained, or
Converting the operation result of the target information extraction function into a character string type;
and cutting the operation result of the character string type to obtain target information.
2. The method of claim 1, wherein injecting the information extraction function body into the build task comprises:
acquiring an environment variable configuration inlet of the construction task;
and adding the information extraction function body to the environment variable of the construction task through the configuration inlet.
3. The method according to claim 1, wherein adding a context code to the information extraction function body according to the environment variable information to obtain a target information extraction function, comprises:
adding a context code template to the information extraction function body;
and replacing the placeholder variables in the context code template according to the environment variable information.
4. A method according to claim 3, wherein replacing placeholder variables in the context code template according to the environment variable information comprises:
reading the context code template based on a set standard function to obtain a placeholder variable;
and replacing the placeholder variable with a corresponding actual variable in the environment variable information.
5. The method of claim 1, further comprising, prior to adding context code to the information extraction function body based on the environment variable information:
adding a call script for the construction task; the call script is used for executing the operation of adding context codes to the information extraction function body according to the environment variable information when the construction task runs to a setting stage;
correspondingly, adding a context code for the information extraction function body according to the environment variable information comprises the following steps:
and when the construction task runs to the setting stage, adding a context code for the information extraction function body according to the environment variable information.
6. An information processing apparatus, comprising:
the information extraction function body configuration module is used for configuring an information extraction function body of a construction task and injecting the information extraction function body into the construction task;
the environment variable information acquisition module is used for acquiring environment variable information of the construction task;
the target information extraction function acquisition module is used for adding a context code to the information extraction function body according to the environment variable information to obtain a target information extraction function;
the target information acquisition module is used for operating the target information extraction function to acquire target information in the environment variable information; wherein the target information is information predefined by the target information extraction function;
the target information acquisition module is also used for calling a third-party operation library and acquiring a construction function associated with the third-party operation library;
creating a function running environment based on the constructor;
the target information extraction function is sent to the function operation environment to operate, and the target information in the environment variable information is obtained, or
Converting the operation result of the target information extraction function into a character string type;
and cutting the operation result of the character string type to obtain target information.
7. An electronic device, the electronic device comprising:
one or more processing devices;
a storage means for storing one or more programs;
when the one or more programs are executed by the one or more processing devices, the one or more processing devices are caused to implement the method of processing information as claimed in any of claims 1-5.
8. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processing device, implements the method of processing information according to any one of claims 1-5.
CN202011162828.9A 2020-10-27 2020-10-27 Information processing method, device, equipment and storage medium Active CN112256326B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011162828.9A CN112256326B (en) 2020-10-27 2020-10-27 Information processing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011162828.9A CN112256326B (en) 2020-10-27 2020-10-27 Information processing method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112256326A CN112256326A (en) 2021-01-22
CN112256326B true CN112256326B (en) 2023-07-07

Family

ID=74262069

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011162828.9A Active CN112256326B (en) 2020-10-27 2020-10-27 Information processing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112256326B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115705184A (en) * 2021-08-06 2023-02-17 中国移动通信有限公司研究院 Data acquisition method, device, electronic device and readable storage medium
CN114579107A (en) * 2022-03-11 2022-06-03 北京字跳网络技术有限公司 Data processing method, device, equipment and medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103635885A (en) * 2011-06-28 2014-03-12 微软公司 Deploying environments for testing by providing instantaneous availability of prebuilt environments
CN110515625A (en) * 2019-08-02 2019-11-29 苏州浪潮智能科技有限公司 Task construction method, apparatus, device, and computer-readable storage medium

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9344833B2 (en) * 2013-07-31 2016-05-17 Sap Se Data component in a mobile application framework
US20150234796A1 (en) * 2014-02-18 2015-08-20 Mobile Oxygen Llc Creating, managing, and distributing dynamic content to smartphones
CN110058863A (en) * 2019-03-16 2019-07-26 平安城市建设科技(深圳)有限公司 Construction method, device, equipment and the storage medium of Docker container
CN110851211A (en) * 2019-11-13 2020-02-28 北京云途腾科技有限责任公司 Method, apparatus, electronic device, and medium for displaying application information
CN111221572B (en) * 2020-01-13 2023-09-01 北京字节跳动网络技术有限公司 Method, device, medium and equipment for automatically adapting to running environment
CN111309304B (en) * 2020-02-11 2023-07-11 北京字节跳动网络技术有限公司 Method, device, medium and electronic equipment for generating IDL file
CN111562942B (en) * 2020-04-30 2024-04-19 中国银行股份有限公司 Gitlab-based mobile APP continuous integration device and method
CN111767058A (en) * 2020-06-30 2020-10-13 上海商汤智能科技有限公司 Program compiling method and device, electronic device and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103635885A (en) * 2011-06-28 2014-03-12 微软公司 Deploying environments for testing by providing instantaneous availability of prebuilt environments
CN110515625A (en) * 2019-08-02 2019-11-29 苏州浪潮智能科技有限公司 Task construction method, apparatus, device, and computer-readable storage medium

Also Published As

Publication number Publication date
CN112256326A (en) 2021-01-22

Similar Documents

Publication Publication Date Title
CN110391938B (en) Method and apparatus for deploying services
CN113761588A (en) Data verification method and device, terminal equipment and storage medium
CN111309304B (en) Method, device, medium and electronic equipment for generating IDL file
CN112083945B (en) Update prompt method, device, electronic device and storage medium for NPM installation package
CN110851211A (en) Method, apparatus, electronic device, and medium for displaying application information
CN113138768B (en) Application package generation method, device, electronic device and readable storage medium
CN112596720B (en) Business operation method, platform, electronic device and computer storage medium
WO2019029451A1 (en) Method for publishing mobile applications and electronic apparatus
CN112433730B (en) Code detection rule generation method and device and electronic equipment
CN111090423A (en) Webhook framework system and method for realizing active calling and event triggering
WO2021129812A1 (en) Method and system for running artificial intelligence application, and device
CN112256326B (en) Information processing method, device, equipment and storage medium
CN111752644A (en) Interface simulation method, device, equipment and storage medium
CN111190657B (en) Activity configuration method and device, readable medium and electronic equipment
CN111124541A (en) Configuration file generation method, device, equipment and medium
CN115113898A (en) Dynamic update method, device, computer equipment and storage medium of micro-application
CN118519920A (en) Automatic test method, device, equipment and storage medium
CN109144864B (en) Method and device for testing window
CN110347575A (en) A kind of adjustment method based on big data component, device, terminal device and medium
CN115328506A (en) Application package generation method, loading method, device, medium and equipment
CN114936021A (en) Data processing method, device, equipment and medium
CN115840585A (en) Method, system, device, electronic equipment and medium for modifying component version
CN113760727A (en) Interface regression testing method and device
CN111309323A (en) Parameter initialization method and device and electronic equipment
CN116991380B (en) Application program construction method and device, electronic equipment and storage medium

Legal Events

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