当前位置:网站首页>Teach you how to configure Jenkins automated email notifications
Teach you how to configure Jenkins automated email notifications
2022-07-31 01:10:00 【Rejoice in the testing world】
完成基于JenkinsAfter the continuous integration is deployed,After the automated test is executed,The test results need to be notified to the relevant personnel,In addition to the DingTalk notification, we can also passEmailNotify the corresponding person in charge,Record the test results hereJenkinsConfiguration and deployment of email notifications
01 安装插件
方法1: 进入Jenkins-系统管理–插件管理-可选插件,安装Email Extension Plugin和Build Timestamp插件
方法2:进入Jenkins插件下载email-ext和build-timestampInstead of relying on plugins,进入Jenkins-系统管理–插件管理-高级-上传插件, 上传安装
Email Extension Plugin:通过STMP协议发送电子邮件
Build Timestamp:Get the timestamp at build time and convert to the specified format 用于获取log和htmlTest report name to send email attachment
02 SMTP介绍
SMTP 的全称是“Simple Mail Transfer Protocol”,即简单邮件传输协议.它是一组用于从源地址到目的地址传输邮件的规范,通过它来控制邮件的中转方式.SMTP 协议属于 TCP/IP 协议簇,它帮助每台计算机在发送或中转信件时找到下一个目的地.SMTP 服务器就是遵循 SMTP 协议的发送邮件服务器.
SMTP认证 简单地说就是要求必须在提供了账户名和密码之后才可以登录 SMTP 服务器,这就使得那些垃圾邮件的散播者无可乘之机
STMP授权码的获取:
QQ邮箱获取授权码
163邮箱获取授权码
03 Jenkins系统配置
进入系统管理 - 系统配置
- Configure the obtained timestamp format Obtained when sending an emaillog和htmlReports are email attachments
- Configure outbox and mail type
- Set default receipt、邮件标题和邮件内容
- Set trigger type and repeat outbox configuration
注:After the configuration is complete, you can send a test email to see if the configuration is correct
04 配置Job
进入Job - 配置 - 构建后操作 - -增加构建后步骤 - Editable Email Notification, 配置如下
- 配置收件人列表、邮件标题和邮件内容,Parameters that can override system configuration
- 获取邮件附件 Log和html测试报告
- Configure whether to send build logs as attachments、Shipment Type and Shipment Object
Default Subject
【接口自动化】$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!
Default Content
<!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>本邮件由系统自动发出,无需回复!
<br/>各位同事,大家好,以下为${PROJECT_NAME }项目构建信息</br>
<td><font color="#CC0000">构建结果 - ${BUILD_STATUS}</font></td>
</tr>
<tr>
<td><br />
<b><font color="#0B610B">构建信息</font></b>
<hr size="2" width="100%" align="center" /></td>
</tr>
<tr>
<td>
<ul>
<li>项目名称:${PROJECT_NAME}</li>
<li>构建编号:第${BUILD_NUMBER}次构建</li>
<li>触发原因:${CAUSE}</li>
<li>构建状态:${BUILD_STATUS}</li>
<li>项目URL:<a href="${PROJECT_URL}">${PROJECT_URL}</a></li>
<li>工作目录:<a href="${PROJECT_URL}ws">${PROJECT_URL}ws</a></li>
<li>构建URL:<a href="${BUILD_URL}">${BUILD_URL}</a></li>
<li>构建日志: <a href="${BUILD_URL}console">${BUILD_URL}console</a></li>
<li>测试报告:<a href="${BUILD_URL}HTML_20Report/">${BUILD_URL}HTML_20Report/</a></li>
</ul>
<h4><font color="#0B610B">失败用例</font></h4>
<hr size="2" width="100%" />$FAILED_TESTS<br/>
<h4><font color="#0B610B">最近提交版本(git:$GIT_REVISION)</font></h4>
<hr size="2" width="100%" />
<ul>
${CHANGES_SINCE_LAST_SUCCESS, reverse=true, format="%c", changesFormat="<li>%d[%a] %m</li>"}
</ul>
详细提交: <a href="${PROJECT_URL}changes">${PROJECT_URL}changes</a><br/>
</td>
</tr>
</table>
</body>
</html>
05 Email sending effect preview
最后: 可以在公众号:伤心的辣条 ! 自行领取一份216页软件测试工程师面试宝典文档资料【免费的】.以及相对应的视频学习教程免费分享!,其中包括了有基础知识、Linux必备、Shell、互联网程序原理、Mysql数据库、抓包工具专题、接口测试工具、测试进阶-Python编程、Web自动化测试、APP自动化测试、接口自动化测试、测试高级持续集成、测试架构开发测试框架、性能测试、安全测试等.
现在我邀请你进入我们的软件测试学习交流群:【746506216
】,备注“入群”, 大家可以一起探讨交流软件测试,共同学习软件测试技术、面试等软件测试方方面面,还会有免费直播课,收获更多测试技巧,我们一起进阶Python自动化测试/测试开发,走向高薪之路.
喜欢软件测试的小伙伴们,如果我的博客对你有帮助、如果你喜欢我的博客内容,请 “点赞” “评论” “收藏” 一 键三连哦!
软件测试工程师自学教程:
这才是2022最精细的自动化测试自学教程,我把它刷了无数遍才上岸字节跳动,做到涨薪20K【值得自学软件测试的人刷】
软件测试工程师月薪2W以上薪资必学技能 — Python接口自动化框架封装.
美团面试真题_高级测试25K岗位面试 — 软件测试人都应该看看
软件测试必会_Jmeter大厂实战 — 仅6步可实现接口自动化测试
边栏推荐
- Xiaohei's leetcode journey: 104. The maximum depth of a binary tree
- 使用PageHelper实现分页查询(详细)
- 设置浏览器滚动条样式
- background has no effect on child elements of float
- ShardingSphere之未分片表配置实战(六)
- Meta元宇宙部门第二季度亏损28亿 仍要继续押注?元宇宙发展尚未看到出路
- Can deep learning solve the parameters of a specific function?
- 【Demo】ABAP Base64加解密测试
- Typescript14 - (type) of the specified parameters and return values alone
- ELK deployment script---pro test available
猜你喜欢
【952. Calculate the maximum component size according to the common factor】
VS warning LNK4099: No solution found for PDB
深度学习可以求解特定函数的参数么?
这个项目太有极客范儿了
typescript12-联合类型
4G通信模块CAT1和CAT4的区别
ShardingSphere之公共表实战(七)
Mini Program - Global Data Sharing
In Google Cloud API gateway APISIX T2A and T2D performance test
Huawei's "genius boy" Zhihui Jun has made a new work, creating a "customized" smart keyboard from scratch
随机推荐
查看zabbix-release-5.0-1.el8.noarch.rpm包内容
【Mysql】——索引的深度理解
蓝牙mesh系统开发二 mesh节点开发
场景之多数据源查询及数据下载问题
The level of ShardingSphere depots in actual combat (4)
小程序-全局数据共享
typescript11 - data types
Typescript14 - (type) of the specified parameters and return values alone
Analyze the capabilities and scenarios of the cloud native message flow system Apache Pulsar
MySql data recovery method personal summary
《实战》基于电商领域的词性提取及其决策树模型建模
DOM系列之scroll系列
Jetpack Compose learning (8) - State and remeber
Xiaohei's leetcode journey: 104. The maximum depth of a binary tree
手把手教你配置Jenkins自动化邮件通知
ShardingSphere之读写分离(八)
297. 二叉树的序列化与反序列化
使用PageHelper实现分页查询(详细)
typescript14-(单独指定参数和返回值的类型)
Unity2D horizontal version game tutorial 4 - item collection and physical materials