如何在 Jenkins EmailExt 中将 "default recipients" ($DEFAULT_RECIPIENTS) 添加到 recipientProviders?
How to add "default recipients" ($DEFAULT_RECIPIENTS) to recipientProviders in Jenkins EmailExt?
我正在使用 Jenkins 和 Emailext 插件来发送电子邮件。这是一个测试管道,工作正常:
pipeline
{
agent any
stages
{
stage ('Start')
{
steps
{
echo 'Hello'
// error('Abort to test failure.')
}
}
}
post
{
success
{
emailext (
subject: '$DEFAULT_SUBJECT',
body: '$DEFAULT_CONTENT',
recipientProviders: [ requestor(), ? ]
)
}
failure
{
emailext (
subject: '$DEFAULT_SUBJECT',
body: '$DEFAULT_CONTENT',
recipientProviders: [developers(), requestor(), culprits()]
)
}
}
}
我想向 requestor
和我在 Manage Jenkins -> Configure System -> Extended E-mail Notification
下指定的“默认收件人”发送 success
封电子邮件。
如何将“默认收件人”($DEFAULT_RECIPIENTS
) 添加到 recipientProviders
?
这样试试:
success
{
emailext (
subject: '$DEFAULT_SUBJECT',
body: '$DEFAULT_CONTENT',
to: '$DEFAULT_RECIPIENTS',
recipientProviders: [ requestor() ]
)
}
recipientProviders
parameter is used to add additional recipients.
这将在作业成功时向 recipientProviders
和 DEFAULT_RECIPIENTS
发送电子邮件。
我正在使用 Jenkins 和 Emailext 插件来发送电子邮件。这是一个测试管道,工作正常:
pipeline
{
agent any
stages
{
stage ('Start')
{
steps
{
echo 'Hello'
// error('Abort to test failure.')
}
}
}
post
{
success
{
emailext (
subject: '$DEFAULT_SUBJECT',
body: '$DEFAULT_CONTENT',
recipientProviders: [ requestor(), ? ]
)
}
failure
{
emailext (
subject: '$DEFAULT_SUBJECT',
body: '$DEFAULT_CONTENT',
recipientProviders: [developers(), requestor(), culprits()]
)
}
}
}
我想向 requestor
和我在 Manage Jenkins -> Configure System -> Extended E-mail Notification
下指定的“默认收件人”发送 success
封电子邮件。
如何将“默认收件人”($DEFAULT_RECIPIENTS
) 添加到 recipientProviders
?
这样试试:
success
{
emailext (
subject: '$DEFAULT_SUBJECT',
body: '$DEFAULT_CONTENT',
to: '$DEFAULT_RECIPIENTS',
recipientProviders: [ requestor() ]
)
}
recipientProviders
parameter is used to add additional recipients.
这将在作业成功时向 recipientProviders
和 DEFAULT_RECIPIENTS
发送电子邮件。