2017-09-18 58 views
0

我正在致力於向Jenkins中提交代碼的用戶發送構建失敗的電子郵件。我正在使用管道腳本。但我現在正在手動添加用戶名。如何在Jenkins中自動添加收件人郵件。如何在Jenkins管道中自動添加郵件收件人

這是我寫的代碼。

emailtext attachLog: true,body: '', 
compressLog: true, 
recipientProviders: [[$class: 'DevelopersRecipientProvider']], 
subject:'Test results' 
emailtext body : 'Commit failure', subject: 'Test-failure', to: '[email protected]' 

回答

0

這樣做的正確的結構是:

emailext (
    subject: yoursubject, 
    body: yourbody, 
    recipientProviders: [[$class: 'DevelopersRecipientProvider']] 
) 

您的代碼可以類似於:

emailext (
    emailtext attachLog: true, 
    compressLog: true, 
    subject: 'Test results failure', 
    body: 'Build failure', 
    recipientProviders: [[$class: 'DevelopersRecipientProvider']] 
) 

欲瞭解更多信息: Sending notifications pipeline

+0

TRISQUEL您好,我試過代碼,你已經建議,但我收到以下錯誤 - 「不發送郵件到unregiste紅色用戶[email protected],因爲您的SCM聲稱這與您的安全領域無法識別的用戶標識「abc」相關聯;您可能需要更改您的SCM插件 嘗試將電子郵件發送給收件人的空列表時忽略。「 –

相關問題