zoukankan      html  css  js  c++  java
  • Jenkins运行结果发送邮件失败的各种坑……

    已在 Jenkins的 job-构建后操作设置了邮件发送通知:(但是发送不成功,且报错)

       

     1、跑完工程后,发送邮件触发失败 ?

       

    Email was triggered for: Failure - Any
    Sending email for trigger: Failure - Any
    An attempt to send an e-mail to empty list of recipients, ignored.
    Finished: FAILURE

    2、使用上一次跑的测试报告index.html(因为跑一份新的需要1个多小时,成本太大,),来打包发邮件,会报这个错误:

    + zip -r report.zip test-output/index.html
    updating: test-output/index.html (deflated 96%)
    Recording test results
    ERROR: Step ‘Publish JUnit test result report’ failed: Test reports were found but none of them are new. Did leafNodes run?
    For example, /Users/XXX/.jenkins/workspace/YYY-project/test-output/index.html is 23 分 old
    
    Email was triggered for: Failure - Any
    Sending email for trigger: Failure - Any
    An attempt to send an e-mail to empty list of recipients, ignored.
    Finished: FAILURE

    这个问题找到解决办法:

    Jenkins在执行JUnit报告时报错Test reports were found but none of them are new. Did leafNodes run? 问题解决:https://blog.csdn.net/lhh08hasee/article/details/82588539
    ——提到说,如果测试运行和JUnit插件运行间隔超过3秒,则插件将忽略这些文件。
    ——解决办法:更新这个文件的时间
     
    3、同时需要确保已经配置了 "Extended E-mail Notification" 
    —— inspired by 【Jenkins Email sending fails
    (在Jerkins-->Manage Jenkins -->Configure System -->"Extended E-mail Notification" 中进行配置 ) 
     
    ——Extended E-mail Notification Plugin 插件的详细讲解

    设置了邮箱之后,又报这个错:

     

    + zip -r report.zip test-output/index.html
    updating: test-output/index.html (deflated 96%)
    Recording test results
    ERROR: Step ‘Publish JUnit test result report’ failed: Test reports were found but none of them are new. Did leafNodes run?
    For example, /Users/yyy/.jenkins/workspace/CXXX/test-output/index.html is 1 小时 39 分 old
    
    Checking for post-build
    Performing post-build step
    Checking if email needs to be generated
    Email was triggered for: Failure - Any
    Sending email for trigger: Failure - Any
    messageContentType = text/html; charset=UTF-8
    Collecting change authors...
    build: 47
    Adding recipients from trigger recipient list
    Successfully created MimeMessage
    An attempt to send an e-mail to empty list of recipients, ignored.
    Some error occurred trying to send the email...check the Jenkins log
    Finished: FAILURE
    4、根据另一个接口自动化的Jenkins任务,参考其具体的配置,对此UI自动化工程进行配置,如下:
        在:Jenkins --系统管理 --配置系统。
     4.1)Jenkins Location 
        

     4.2)Extended E-mail Notification

       

       

       4.3)邮件通知

        

    5、build #55 又发生下面这个错: —— Publish Junit test result report的问题,换成 Publish HTML Report 就不会报此错了。(详见:Jenkins安装 HTML Publisher plugin插件

       

    + zip -r report.zip test-output/index.html
    adding: test-output/index.html (deflated 94%)
    Recording test results
    ERROR: Step ‘Publish JUnit test result report’ aborted due to exception:
    org.xml.sax.SAXParseException; lineNumber: 670; columnNumber: 36; 在实体引用中, 实体名称必须紧跟在 '&' 后面。
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
    at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1472)

    6、出现的终极大问题:

    SendFailedException message: 451 5.7.3 STARTTLS is required to send mail [SHAPR01CA039.CHNPR01.prod.partner.outlook.cn] 

    按照对应的内容配置好了,项目构建也成功了,发送报告邮件的时候,报错。

      

     百度了这个错,并没有找到,最后通过FQGoogle找到的一个回答是:

      需要去修改Jenkins启动命令文件,在该文件中加一句命令:   -Dmail.smtp.starttls.enable=true

      可是找到这个一个类似的文件:是jenkins_runner.sh,发现它里面已经有上述的那句命令了……(晕了)

      

     所以,这个也解决不了……

    7、问了下IT负责人,建议SMTP服务器和端口换一个试试,于是试了如下:

    smtp服务器:XXX-com.mail.protection.partner.outlook.cn   

    端口 25

       

     ——然后测试邮件发送就可以了!!!

    【Reference】
    1、Jenkins在执行JUnit报告时报错Test reports were found but none of them are new. Did leafNodes run? 问题解决:https://blog.csdn.net/lhh08hasee/article/details/82588539
    —— 提示需要配置 "Extended E-mail Notification" 
    ——Extended E-mail Notification Plugin 插件的详细讲解
    4、jenkins邮件持续集成之后,显示发送成功,未收到邮件问题:https://blog.csdn.net/zhichuan0307/article/details/105930543
    5、Jenkins构建Job,通过Extended E-mail Notification发送邮件时遇到的问题:https://blog.csdn.net/Eri_Feng/article/details/80410701

    6、Jenkins - 邮件配置

  • 相关阅读:
    sendmessage参数
    combobox添加选项
    sql数据库时间转换convert
    Javascript知识四(DOM)
    Javascript知识三
    JavaScript知识(二)
    JavaScript知识(一)
    三层架构
    ADO知识的运用二(Day 28)
    SQL知识三(Day 27)
  • 原文地址:https://www.cnblogs.com/shenxiaolin/p/14491566.html
Copyright © 2011-2022 走看看