在 Jenkins 中解析 HTML
Parsing HTML in Jenkins
我正在使用 poll-mailbox-trigger-plugin 根据收到的电子邮件触发 Jenkins 作业。
其中一个构建参数 (pmt_content
) 包含 HTML 中指定的电子邮件正文。
是否有可以解析 HTML 并检索用户指定标签值的 Jenkins 插件?
电子邮件内容示例:
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=UTF-8">
<title></title>
</head>
<body style='margin:20px'>
<p>The following user has registered a device, click on the link below to
review the user and make any changes if necessary.</p>
<ul style='list-style-type:none; margin:25px 15px;'>
<li><b>User name:</b> Test User</li>
<li><b>User email:</b> test@abc.com</li>
<li><b>Identifier:</b> abc123def132afd1213afas</li>
<li><b>Description:</b> Tom's iPad</li>
<li><b>Model:</b> iPad 3</li>
<li><b>Platform:</b></li>
<li><b>App:</b> Test app name</li>
<li><b>UserID:</b></li>
</ul>
<p>Review user: https://cirrus.app47.com/users?search=test@abc.com</p>
<hr style='height=2px; color:#aaa'>
<p>We hope you enjoy the app store experience!</p>
<p style='font-size:18px; color:#999'>Powered by App47</p><img alt='' src=
'https://cirrus.app47.com/notifications/562506219ac25b1033000904/img'>
</body>
</html>
具体来说,我如何检索 "Identifier:" 标签的值?
我确定我可以编写一个脚本来完成它,但我更喜欢 Jenkins 中的逻辑。
Is there a Jenkins plugin that can parse the HTML and retrieve the values of user-specified tags?
它是 shell 上的一行或您选择的脚本语言中的几行。不过看来,这不是你要找的。
一般来说,不,没有用于解析 HTML 和检索标签值的插件,请参阅 https://wiki.jenkins-ci.org/display/JENKINS/Plugins
How could I retrieve the value of the "Identifier:" tag?
有一个名为 Conditional BuildStep 的通用插件,
支持参数正则表达式。
当 HTML 电子邮件内容在 pmt_content
中时,您可以使用以下
正则表达式
<li><b>Identifier:<\/b>(.*)<\/li>
提取值 abc123def132afd1213afas
(或匹配并执行另一个命令,如果找到的话)。
我正在使用 poll-mailbox-trigger-plugin 根据收到的电子邮件触发 Jenkins 作业。
其中一个构建参数 (pmt_content
) 包含 HTML 中指定的电子邮件正文。
是否有可以解析 HTML 并检索用户指定标签值的 Jenkins 插件?
电子邮件内容示例:
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=UTF-8">
<title></title>
</head>
<body style='margin:20px'>
<p>The following user has registered a device, click on the link below to
review the user and make any changes if necessary.</p>
<ul style='list-style-type:none; margin:25px 15px;'>
<li><b>User name:</b> Test User</li>
<li><b>User email:</b> test@abc.com</li>
<li><b>Identifier:</b> abc123def132afd1213afas</li>
<li><b>Description:</b> Tom's iPad</li>
<li><b>Model:</b> iPad 3</li>
<li><b>Platform:</b></li>
<li><b>App:</b> Test app name</li>
<li><b>UserID:</b></li>
</ul>
<p>Review user: https://cirrus.app47.com/users?search=test@abc.com</p>
<hr style='height=2px; color:#aaa'>
<p>We hope you enjoy the app store experience!</p>
<p style='font-size:18px; color:#999'>Powered by App47</p><img alt='' src=
'https://cirrus.app47.com/notifications/562506219ac25b1033000904/img'>
</body>
</html>
具体来说,我如何检索 "Identifier:" 标签的值?
我确定我可以编写一个脚本来完成它,但我更喜欢 Jenkins 中的逻辑。
Is there a Jenkins plugin that can parse the HTML and retrieve the values of user-specified tags?
它是 shell 上的一行或您选择的脚本语言中的几行。不过看来,这不是你要找的。
一般来说,不,没有用于解析 HTML 和检索标签值的插件,请参阅 https://wiki.jenkins-ci.org/display/JENKINS/Plugins
How could I retrieve the value of the "Identifier:" tag?
有一个名为 Conditional BuildStep 的通用插件, 支持参数正则表达式。
当 HTML 电子邮件内容在 pmt_content
中时,您可以使用以下
正则表达式
<li><b>Identifier:<\/b>(.*)<\/li>
提取值 abc123def132afd1213afas
(或匹配并执行另一个命令,如果找到的话)。