如何将发布时间通知发送到Jenkins管道中的多个接收方

Yas*_*ash 5 jenkins jenkins-pipeline

我正在设置一个Jenkins管道,我想将帖子构建通知发送给多个接收器.我无法找到如何设置"CC",有人可以帮助.

我的管道的一个例子如下:

pipeline {
    agent any
    stages {
        stage('No-op') {
            steps {
                sh 'ls'
            }
        }
    }
    post {
        failure {
        mail to: 'team@example.com',
             subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
             body: "Something is wrong with ${env.BUILD_URL}"
    }
}
Run Code Online (Sandbox Code Playgroud)

}

以上示例对我来说工作正常,但我想修改以下行以向多人发送通知(最好在CC中):

mail to: 'team@example.com',
Run Code Online (Sandbox Code Playgroud)

我正在使用Jenkins ver.2.41

Dav*_*que 8

我不知道你是否可以CC它们,但要发送给多个收件人尝试使用逗号分隔列表:

mail to: 'team@example.com,blah@example.com',
Run Code Online (Sandbox Code Playgroud)


Aru*_*n.D 6

使用代码段生成器探索有关大多数步骤的更多选项。你可以CC甚至BCC喜欢:

管道命令:

mail bcc: 'foo@example.com', body: 'Test CC Pipeline', cc: 'xyz@example.com', from: '', replyTo: '', subject: 'Testing CC', to: 'abc@example.com'
Run Code Online (Sandbox Code Playgroud)


shr*_*ari 6

对于emailext脚本,请在以下部分cc中使用:to

emailext body: 'testing',subject: 'testing', to: 'xyz@example.com,cc:abc@example.com'
Run Code Online (Sandbox Code Playgroud)

参考:https ://issues.jenkins-ci.org/plugins/servlet/mobile#issus/JENKINS-6703