jenkins Email-ext plugin插件中Pre-send Script设置说明


在使用jenkins Email-ext plugin发送邮件时,项目中使用了SVN去同步,发现每次有同步,都会发送邮件,现只想SVN只更新,不发送邮件通知,这就要在Pre-send中做修改

看看官网说明:

Pre-send Script
The pre-send script is a feature which allows you to write a script that can modify the MimeMessage object prior to sending. This would allow adding custom headers, modifying the body, etc. Predefined variables include:
msg - the MimeMessage object which can be modified
logger - a PrintStream and will write to the job's log. 
build - the build this message belongs to
cancel - a boolean, which when set to true will cancel the sending of the email

  只官网中可以看到cancel可以满足我们的需求,只要设置cancel为true就行,怎么设置呢?

下面这样写吗?

Jenkins > Manage > script 
if (build.changeSet.emptySet) cancel=true;

  好像也不对,在多次尝试后,发出其实只需要这样写就可以

如下图:


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM