美文网首页
jenkins+git+robot报告+邮件发送

jenkins+git+robot报告+邮件发送

作者: 清水秋香 | 来源:发表于2020-05-12 03:00 被阅读0次

    构建自由风格的项目


    image.png

    点击配置,首先配置git地址及登陆账号密码


    image.png
    轮询git,如有提交代码执行构建
    image.png

    执行robot测试


    image.png
    jenkins输出robot报告
    image.png
    设置邮件发送
    image.png
    邮件类型
    image.png
    发送邮件的内容
    image.png

    添加的附件,因为报告在项目根目录下,所以不需要写路径


    image.png

    邮件模版(仅供参考)

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>${ENV, var="JOB_NAME"}-第${BUILD_NUMBER}次构建日志</title>
    </head>
    <body leftmargin="8" marginwidth="0" topmargin="8" marginheight="4" offset="0">
    <table width="95%" cellpadding="0" cellspacing="0" style="font-size: 11pt; font-family: Tahoma, Arial, Helvetica, sans-serif">
    <tr>
       <td>本邮件是程序自动下发,请勿回复!</td>
    </tr>
    <tr>
       <td><h2><font color="#0000FF">构建结果 - ${BUILD_STATUS}</font></h2></td>
    </tr>
    <tr>
       <td><br /> <b><font color="#0B610B">构建信息</font></b> <hr size="2" width="100%" align="center" /></td> 
    </tr> 
    <tr>
    <td> 
         <ul> 
              <li>项目名称&nbsp;:&nbsp;${PROJECT_NAME}</li>
              <li>构建编号&nbsp;:&nbsp;第${BUILD_NUMBER}次构建</li>
              <li>触发原因:&nbsp;${CAUSE}</li>
              <li>构建日志:&nbsp;<a href="${BUILD_URL}console">${BUILD_URL}console</a></li>
              <li>构建&nbsp;&nbsp;Url&nbsp;:&nbsp;<a href="${BUILD_URL}">${BUILD_URL}</a></li>
              <li>工作目录&nbsp;:&nbsp;<a href="${PROJECT_URL}ws">${PROJECT_URL}ws</a></li>
              <li>项目&nbsp;&nbsp;Url&nbsp;:&nbsp;<a href="${PROJECT_URL}">${PROJECT_URL}</a></li>
         </ul> 
    </td> 
    </tr>
    <tr>
         <td>
              <b><font color="#0B610B">Changes Since Last Successful Build:</font></b>
              <hr size="2" width="100%" align="center" />
         </td> 
    </tr> 
    <tr> 
         <td>
             <ul> 
                  <li>历史变更记录 : <a href="${PROJECT_URL}changes">${PROJECT_URL}changes</a></li>
             </ul></td> 
    </tr>
    <tr>
         <td>
              <b>Failed Test Results</b> <hr size="2" width="100%" align="center" />
         </td> 
    </tr>
    <tr>
         <td>
              <pre style="font-size: 11pt; font-family: Tahoma, Arial, Helvetica, sans-serif">$FAILED_TESTS</pre> <br />
         </td>
    </tr>
    <tr>
         <td><b><font color="#0B610B">构建日志 (最后 100行):</font></b> <hr size="2" width="100%" align="center" /></td>
    </tr> <!-- <tr> <td>Test Logs (if test has ran): <a href="${PROJECT_URL}ws/TestResult/archive_logs/Log-Build-${BUILD_NUMBER}.zip">${PROJECT_URL}/ws/TestResult/archive_logs/Log-Build-${BUILD_NUMBER}.zip</a> <br /> <br /> </td> </tr> --> 
    <tr>
    <td>
         <textarea cols="80" rows="30" readonly="readonly" style="font-family: Courier New">${BUILD_LOG, maxLines=100}</textarea> 
    </td> 
    </tr>
    </table>
    </body>
    </html>
    

    点击构建,查看报告与邮件把


    image.png

    相关文章

      网友评论

          本文标题:jenkins+git+robot报告+邮件发送

          本文链接:https://www.haomeiwen.com/subject/awamnhtx.html