简体   繁体   English

从Jenkins发送SonarQube链接

[英]Send SonarQube link in mail from Jenkins

I am using Jenkins for Orchestrate a build of a Java Project. 我正在使用Jenkins来编排Java项目的构建。 I am scanning this project source with SonarQube Scanner in pre-build phase. 我正在使用SonarQube Scanner在预构建阶段扫描此项目源。 I need to send a mail for both pass and fail case to a list of Recipient. 我需要将传递和失败案例的邮件发送到收件人列表。

Client want this SonarQube result link in the mail. 客户希望在邮件中使用此SonarQube结果链接。 I manage to configure Jenkins to shoot the mail but I cant find any document which specify how to add SonarQube result. 我设法配置Jenkins拍摄邮件,但我找不到任何指定如何添加SonarQube结果的文档。

Jenkins do print the link in logs. Jenkins会在日志中打印链接。 I am using Jenkins 2.25 , SonarQube 5.6.4 and mail plugin Email Extension Plugin 2.58 . 我正在使用Jenkins 2.25SonarQube 5.6.4和邮件插件Email Extension Plugin 2.58

Please help. 请帮忙。

You can use BUILD_LOG_REGEX token to extract required information from the log. 您可以使用BUILD_LOG_REGEX令牌从日志中提取所需信息。 The syntax is as follows: 语法如下:

${BUILD_LOG_REGEX, regex, linesBefore, linesAfter, maxMatches, showTruncatedLines, substText}

Exemplary email notification content with a Sonar result URL (in a case of successful scan): 具有Sonar结果URL的示例性电子邮件通知内容(在成功扫描的情况下):

SonarQube result URL: ${BUILD_LOG_REGEX, regex=".*ANALYSIS SUCCESSFUL, you can browse (.*)", showTruncatedLines=false, substText="$1"}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM