[jenkins] jenkins configuration email sending allure report

Table of contents

1. Install the plugin Email Extension

2. Open the SMTP service

3. Configure mailbox in jenkins

1. Administrator mailbox configuration

2. System Management--System Configuration-Extended E-mail Notification

 4. Configuration in project tasks

1. Configure post-build steps

4.1.1 Template 1

 4.1.2 Template 2

 2. Set trigger conditions (seems optional)


1. Install the plugin Email Extension

2. Open the SMTP service

qq takes mailbox as an example

3. Configure mailbox in jenkins

1. Administrator mailbox configuration

After the plug-in installation is complete, [System Management] --> [System Configuration]

2. System Management--System Configuration-Extended E-mail Notification

 

 This email suffix doesn't make much sense

 

 

 here is new area

 

 4. Configuration in project tasks

1. Configure post-build steps

 Open the page as follows:

 Modify as shown below

html report template:

4.1.1 Template 1

<h1><center><font>以下是Jenkins自动发送的邮件,请勿回复!</font><center></h1>
<h3><center><font color="red">allure报告在线查看or下载allure-report.zip用firefox离线查看,测试用例见附件</font><center></h3>
<br>
<hr>
<br>
项目描述:${JOB_DESCRIPTION}<br>
<br>
<hr>
项目名称:$PROJECT_NAME<br>
 构建编号:$BUILD_NUMBER<br>
 构建状态:$BUILD_STATUS<br>
 触发原因:${CAUSE}<br>
 构建地址:<A HREF="${BUILD_URL}">${BUILD_URL}</A><br>
 构建日志地址:<A HREF="${BUILD_URL}console">${BUILD_URL}console</A><br>
 系统allure测试报告:<A HREF="${PROJECT_URL}${BUILD_NUMBER}/allure">${PROJECT_URL}${BUILD_NUMBER}/allure</a><br>
 <hr>
 ${JELLY_SCRIPT}

 4.1.2 Template 2

use this for now

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style type="text/css">
       .logo {
            float: left;
            min-width: 40px;
            height: 40px;
        }
        .title{
            text-align: center;
            color: rgb(235, 30, 15);
        }
        .desc{
            text-align: left;
        }
    </style>
</head>
<body>
    <div>
        <h1 class="title"> ${PROJECT_NAME}自动化测试报告</h1>
    </div>
    <div class="desc">
        <p><font color="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Jenkins自动发送的测试报告邮件,无需回复!</font></p>
        <h4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;各位同事,大家好,以下为${PROJECT_NAME}自动化测试构建信息</br><h4/>
        <h4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;在线测试报告直达链接:<a href="${PROJECT_URL}/${BUILD_NUMBER}/allure">${PROJECT_URL}/${BUILD_NUMBER}/allure</a></h4>
    </div>
    <br/>
    <div>
        <table width="900" cellpadding="8px" cellspacing="8px" class="table"> 
            <tbody>
                <tr>
                    <td><br/>
                    <b><font color="#0B610B">项目描述:${JOB_DESCRIPTION}<br></font></b>
                    <hr size="2" width="100%" align="center" /></td>
                </tr>
                <tr>
                    <td>项目名称 : ${PROJECT_NAME}</td>
                </tr>
                <tr>
                    <td>构建编号 : 第${BUILD_NUMBER}次构建</td>
                </tr>
                <tr>
                    <td>触发原因: ${CAUSE}</td>
                </tr>
                <tr>
                    <td>构建状态: ${BUILD_STATUS}</td>
                </tr>
                <tr>
                    <td>构建日志: <a href="${PROJECT_URL}${BUILD_NUMBER}/console">${PROJECT_URL}${BUILD_NUMBER}/console</a></td>
                </tr>
                <tr>
                    <td>构建Url : <a href="${BUILD_URL}">${BUILD_URL}</a></td>
                </tr>
                <tr>
                    <td>工作目录 : <a href="${PROJECT_URL}ws">${PROJECT_URL}ws</a></td>
                </tr>
                <tr>
                    <td>项目Url : <a href="${PROJECT_URL}">${PROJECT_URL}</a></td>
                </tr>
                <tr>
                    <td>allure在线测试报告:<a href="${PROJECT_URL}/${BUILD_NUMBER}/allure">${PROJECT_URL}/${BUILD_NUMBER}/allure</a></td>
                </tr>
            </tbody>
        </table>
 
    </div>
    
 
</body>

 2. Set trigger conditions (seems optional)

Guess you like

Origin blog.csdn.net/legend818/article/details/130061407