Send email on jenkins pipeline failure

前端 未结 6 1496
不知归路
不知归路 2021-01-30 17:16

How can i add to a jenkins pipeline an old-style post-build task which sends email when the build fails? I cannot find \"Post-build actions\" in the GUI for a pipeline. I know t

6条回答
  •  感情败类
    2021-01-30 17:53

    Almost all above answers are correct but this one I am using in post section when the build is failed. Maybe this can be useful

    post {
    always {
      script {
        if (currentBuild.currentResult == 'FAILURE') {
          step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "abc.xyz@blabl.com, sendToIndividuals: true])
        }
      }
    }
    

提交回复
热议问题