How to set programmatically recipients of Jenkins Email-ext plugin?

前端 未结 2 1413
情话喂你
情话喂你 2021-01-16 13:01

I\'m trying to set the recipients of the Email-ext (aka Editable Email Notficiation) to the owners of failed tests. Since the owners can\'t be calc

2条回答
  •  时光说笑
    2021-01-16 13:17

    In the Advanced... section create the following Pre-send Script:

    import javax.mail.Message
    import javax.mail.internet.InternetAddress
    
    msg.addRecipient(Message.RecipientType.TO, new InternetAddress('recipient@example.com'))
    

    You'll also need to set Project Recipient List (maybe to some dummy value) since if it's empty, the plugin decides there's nothing to do.

    The script runs on the master so you'll need to ssh onto the slave from the master if you need to process its workspace.

提交回复
热议问题