Use extended email to send emails on failed build
This commit is contained in:
parent
c4ea96adcc
commit
724179c07a
1 changed files with 19 additions and 16 deletions
|
|
@ -138,19 +138,23 @@ def performSuccessfulBuildActions() {
|
|||
deployjob(buildselector, postbuildactions, 'Release to git', 'RELEASE_TO_GIT_JOB')
|
||||
}
|
||||
|
||||
def sendemails(emailtolist) {
|
||||
def emailbody = """
|
||||
Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME} : ${BUILD_URL}
|
||||
def sendemails(emailinfo) {
|
||||
def emailtolist = emailinfo['To']
|
||||
|
||||
Console output: ${BUILD_URL}console
|
||||
"""
|
||||
for(emailto in emailtolist) {
|
||||
mail(
|
||||
subject: "[Jenkins] Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}",
|
||||
body: emailbody,
|
||||
to: emailto
|
||||
)
|
||||
echo "Send email to: ${emailto}"
|
||||
if (emailtolist) {
|
||||
def emailbody = """
|
||||
Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME} : ${BUILD_URL}
|
||||
|
||||
Console output: ${BUILD_URL}console
|
||||
"""
|
||||
for(emailto in emailtolist) {
|
||||
mail(
|
||||
subject: "[Jenkins] Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}",
|
||||
body: emailbody,
|
||||
to: emailto
|
||||
)
|
||||
echo "Send email to: ${emailto}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -220,9 +224,8 @@ def performFailedBuildActions() {
|
|||
}
|
||||
}
|
||||
if (postbuildactions) {
|
||||
def emailtolist = postbuildactions['Email']['To']
|
||||
if (emailtolist) {
|
||||
sendemails(emailtolist)
|
||||
if (postbuildactions['Email']) {
|
||||
sendemails(postbuildactions['Email'])
|
||||
}
|
||||
if (postbuildactions['ExtEmail']) {
|
||||
sendextemail(postbuildactions['ExtEmail'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue