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