简体   繁体   English

如何在 Jenkins email 通知中将诱惑或 html 报告作为附件发送

[英]How to send allure or html report as an attachment in the Jenkins email notifications

How to send allure or html report as an attachment in the Jenkins email notifications.如何在 Jenkins email 通知中将诱惑或 html 报告作为附件发送。 This is example of the pipeline i am using in my Pipeline script in Jenkins.这是我在 Jenkins 的管道脚本中使用的管道示例。 I have setup my email notifcations, however i want to get some sort of report in the email.我已经设置了我的 email 通知,但是我想在 email 中获得某种报告。 Please note that providing a link is not enough because my tests are setup on a different machine with the reports.请注意,仅提供链接是不够的,因为我的测试是在带有报告的另一台机器上设置的。

pipeline {  
     agent any  
     stages {  
         stage('Test') {  
             steps {  
                 sh 'echo "Fail!"; exit 1'  
             }  
         }  
     }  
     post {  
         always {  
             echo 'This will always run'  
         }  
         success {  
             echo 'This will run only if successful'  
         }  
         failure {  
             mail bcc: '', body: "<b>Example</b><br>Project: ${env.JOB_NAME} <br>Build Number: ${env.BUILD_NUMBER} <br> URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "ERROR CI: Project name -> ${env.JOB_NAME}", to: "foo@foomail.com";  
         }  
         unstable {  
             echo 'This will run only if the run was marked as unstable'  
         }  
         changed {  
             echo 'This will run only if the state of the Pipeline has changed'  
             echo 'For example, if the Pipeline was previously failing but is now successful'  
         }  
     }  
 }

You should use emailext plugin not mail您应该使用emailext插件而不是mail

failure {
  emailext(
    attachmentsPattern: "<path to report>", 
    body: '', 
    subject: "", 
    to: ""
  )
}

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

相关问题 Jenkins黄瓜报告以电子邮件附件形式发送 - Jenkins Cucumber report send as an Email attachment 未在 jenkins email 中附上诱惑报告 - Not attaching the allure report in the jenkins email 如何在电子邮件中使用Jenkins发送最新附件? - How to Send latest attachment using Jenkins in Email? Jenkins Pipeline 发送带有附件的电子邮件 - Jenkins Pipeline Send email with an attachment 如何使用emailext发送带有正确格式的HTML文件附件的Jenkins电子邮件通知 - How to send Jenkins email notification with HTML file attachment with proper format using emailext 如何在 Jenkins 中通过电子邮件发送测试报告 - How to send testng report through email in Jenkins 如何在一个电子邮件线程中发送同一Jenkins作业的电子邮件通知 - How to send email notifications for the same Jenkins job in one email thread 我如何在詹金斯电子邮件附件中发送故障测试用例的快照 - how i can send the snapshots of failure testcases in the jenkins email attachment 如何在运行后将 Jenkins 工作区的内容作为 email 附件发送 - How to send the contents of Jenkins workspace as email attachment following the run 通过 Jenkins 将 HTML 报告和 Cucumber 报告发送到电子邮件 - Send HTML report and Cucumber reports through Jenkins to email
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM