Use extended email to send emails on failed build

This commit is contained in:
Dan Hawkins 2021-11-20 18:57:02 +00:00
commit d7fae344ef

View file

@ -36,6 +36,9 @@
"To": [
"dan.hawkins@globalinkjetsystems.com"
]
},
"ExtEmail": {
"Description": "Send an email using Extended Email plugin"
}
}
}
@ -156,6 +159,26 @@ def sendemails(emailtolist) {
}
}
def sendextemail() {
emailext(
subject: "Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}",
body: """
${JELLY_SCRIPT,template="html"}
""",
attachLog: true,
attachmentsPattern: '',
compressLog: false,
// from : '',
// mimeType: '',
// postsendScript: '',
// presendScript: '',
recipientProviders: [culprits(), requestor(), developers()], // Could be: buildUser, culprits, developers, brokenTestsSuspects, brokenBuildSuspects, recipients, requestor, upstreamDevelopers
// replyTo: '',
// saveOutput: true,
// to: '',
)
}
def performFailedBuildActions() {
def postbuildactions = null
if (params.POST_BUILD_INFO != null) {
@ -172,6 +195,9 @@ def performFailedBuildActions() {
if (emailtolist) {
sendemails(emailtolist)
}
if (postbuildactions['ExtEmail']) {
sendextemail()
}
}
}