Alex Sprint Ответов: 1

Как автоматически добавлять получателей почты в конвейер Дженкинса при сбое сборки


I am working on to send an email on build failure to the users who had committed the code in Jenkins. I am using pipeline script. But i am struck now as i am manually adding the username. How to automatically add recipient mail in Jenkins.

Here is the code i have written.

emailtext attachLog: true,body: '', compressLog: true, recipientProviders: [[$class: 'DevelopersRecipientProvider']], subject:'Test results' emailtext body : 'Commit failure', subject: 'Test-failure', to: 'abc@xyz.com'


Что я уже пробовал:

emailtext attachLog: true,body: '', compressLog: true, recipientProviders: [[$class: 'DevelopersRecipientProvider']], subject:'Test results' emailtext body : 'Commit failure', subject: 'Test-failure', to: 'abc@xyz.com'

1 Ответов

Рейтинг:
12

Alex Sprint

Я получил это решение, я просто добавил следующий код!!!

           script{ def recipients = emailextrecipients([ [$class: 'DevelopersRecipientProvider'],[$class: 'CulpritsRecipientProvider']])
             
             mail to: recipients, subject: "Failure", body: "failure"
}