当前位置:网站首页>Jenkins - email notification plug-in
Jenkins - email notification plug-in
2022-06-28 02:14:00 【wumingxiaoyao】
introduction
utilize Jenkins establish Pipeline Job To achieve CICD, Email notification each Job The operation of is very necessary . Especially testing , Report the test case execution results , So this article introduces the related Jenkins Email notification plug-in ,Mailer Plugin and Email Extension Plugin.
Summary :
- Email Plugin
Mailer Plugin
Email Extension Plugin - Email Notification Jenkins The system configuration
- Email Extension Plugin application
- TroubleShooting Troubleshooting
Email Plugin
This paper mainly introduces 2 individual Email Plugin,Mailer Plugin and Extended E-mail Notification Plugin
Mailer Plugin
install Jenkins Suggested Plugin after , By default... Will be installed Mailer Plugin, Just for email notification Build result , Lack of customization space .
open Job Configure, It opens at Add post-build action Will see E-mail Notification Options 
add to E-mail Notification Few configurable options .
Email Extension Plugin
Email Extension Plugin Allows you to fully and flexibly configure email notifications , You can customize when mail is sent , Who should receive the mail , What is the content of the email .
adopt Manage Jenkins -> Plugin Manager To install the plug-in 
After successful installation , open Job Configure page , It opens at Add post-build action Will see Editable Email Notification Options 
Email Notification Jenkins The system configuration
Want to pass Jenkins Email sent successfully , Need to pass through Manage Jenkins -> Configure System To configure SMTP Sending server and Admin mailbox .
What I have configured is iCloud mailbox , Need to Apple Official website Find a way to iCloud Mail server settings for the e-mail client . Other emails are similar , Find the corresponding configuration information .
Applicable to sending server SMTP Information Server name :smtp.mail.me.com
If you need SSL: yes If you are using SSL When you see the error message , Please try using TLS or STARTTLS.
port :587
If you need SMTP Identification of : yes
user name : Your integrity iCloud E-mail address ( for example ,[email protected], instead of emilyparker)
password : Use the App Special password .
Each mailbox smtp Server and supported protocols The mailbox configuration is mentioned In particular :
about ssl/tls encryption , Use 465 port
about starttls In general use 587 port
Mailer Plugin Configuration of
stay E-mail Notifiction part , The configuration is as follows :
stay Jenkins Location Part of the configuration Admin mailbox , Be careful : Not set up Admin Mailbox cannot send mail , This Admin E-mail must follow SMTP authentication The sender mailbox in the configuration is consistent .
Email Extension Plugin To configure
stay Extended E-mail Notification part ,SMTP and Admin The mailbox settings are the same as Mailer Plugin equally , I won't repeat it here .
You can also set the default recipient , List of respondents , Of course, if in Job Configure There are configurations in that will override the default settings , Or access variables $DEFAULT_RECIPIENTS and $DEFAULT_REPLYTO Use the default settings directly .

Default email Subject and Content, Empathy Job Configure The settings in will override the default settings .
The conditions that trigger email notifications can also be overridden

It opens at Content Token Reference You can see the description of the available variables of the plug-in , Use... When customizing message headers and content . Please refer to Jenkins - Built in variable access The article specifically lists the mail configuration variables .
Here are some common variables
Build The cause of the trigger , such as : It may be caused by some Pipeline job The trigger 
The message content is from a file , This is more commonly used , Content files can be generated by scripts , Be careful PATH yes workspace Relative path to root .
Email Extension Plugin application
stay Job Configure in ,Add build-post actions add to Editable Email Notification
Be careful : Email attachment , And content documents PATH It's all based on workspace Relative path to root . If the message content is also embedded with pictures , You also need to add this picture to the attachment , Generated html Just apply this image directly to the content , No additional paths are required .
<img src="cid:trend_image.png">

Click on Advance
Set up Mail trigger condition ,Always It doesn't matter build What state , Send email notifications .
Set up recipients , There's a little pit here , The default may be to Developers add , This results in a custom recipient list for each recipient , And other people , This other person is still dynamic every day , It was later discovered that these dynamic recipients actually have submitted PR Code change people . If you don't want these people to receive emails, you have to remove them .

The following is the email notification content after application : For the sake of content sensitivity, the fuzzy processing is carried out , Just know the general content 
TroubleShooting Troubleshooting
Through arbitrary SMPT Service needs TLS To send email notifications , Default Jenkisn yes Disable 了 mail.smtp.starttls Options , I'm through icloud SMTP Service , And it uses 587 port , This is an application starttls , need Enable This option .
If Disable This option , You will receive the following exception :com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first
Windows Solution :
- open Jenkins The installation directory , Can pass Jenkins UI To know the installation directory Manage Jenkins find Home directory attribute . The default installation path is C:\Program Files (x86)\Jenkins
- open jenkins.xml And add -Dmail.smtp.starttls.enable=true stay arguments part
<executable>%BASE%\jre\bin\java</executable>
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -Dmail.smtp.starttls.enable=true -jar "%BASE%\jenkins.war" --httpPort=8080 --webroot="%BASE%\war"</arguments>
- restart Jenkins: adopt URL {base_jenkins_url}/restart
Linux Please refer to :Fixing SMTPSendFailedException on Ubuntu 16.04
边栏推荐
- Cesium obtains the latitude and longitude range of the screen
- 【永艺XY椅】试用体验
- ionic4实现半星评分
- MySQL十种锁,一篇文章带你全解析
- JS 随机数(随机数 小数)
- Appium automation test foundation ADB common commands (I)
- Réseau neuronal pour la solution détaillée Multi - diagrammes de fondation zéro
- [Yocto RM]8 - OpenEmbedded Kickstart (.wks) Reference
- [embedded foundation] memory (cache, ram, ROM, flash)
- OS模块与OS.path 模块的学习
猜你喜欢

Adobe Premiere基础-编辑素材文件常规操作(脱机文件,替换素材,素材标签和编组,素材启用,便捷调节不透明度,项目打包)(十七)

Jenkins - Copy Artifact 插件 Build 之间数据共享传递

Appium自动化测试基础— 补充:App的包名(appPackage)和启动名(appActivity)

Cesium anti aliasing (lines, borders, etc.)

Implementation of timed tasks in laravel framework

Google Earth engine (GEE) -- an error caused by the imagecollection (error) traversing the image collection

Jenkins - Groovy Postbuild 插件丰富 Build History 信息

Cesium 抗锯齿(线,边框等)

The practice of dual process guard and keeping alive in IM instant messaging development

类的初始化与回调的用法
随机推荐
Class initialization and callback usage
一张图弄懂 MIT,BSD,Apache几种开源协议之间的区别
【ELT.ZIP】OpenHarmony啃论文俱乐部—数据密集型应用内存压缩
声网 VQA:将实时互动中未知的视频画质用户主观体验变可知
Cesium obtains the latitude and longitude range of the screen
TI AM3352/54/59 工业核心板硬件说明书
Numpy----np. Tile() function parsing
Adobe Premiere foundation - sound adjustment (volume correction, noise reduction, telephone tone, pitch shifter, parameter equalizer) (XVIII)
Jenkins - Groovy Postbuild 插件丰富 Build History 信息
Database query optimization: master-slave read-write separation and common problems
Cesium anti aliasing (lines, borders, etc.)
1382. balancing binary search tree - General method
Implementation of timed tasks in laravel framework
Capacitor
【嵌入式基础】串口通信
深入解析kubernetes controller-runtime
Take n multiple table names of a database as the values of a column in another table (the range can be a table in another database)
mysql面试百题集
Numpy----np.tile()函数解析
OS module and os Learning of path module