provo nuova versione changelog in email...
This commit is contained in:
Vendored
+37
-2
@@ -1,5 +1,8 @@
|
||||
pipeline {
|
||||
agent none
|
||||
environment {
|
||||
EMAIL_RECIPIENTS = 'samuele@steamware.net'
|
||||
}
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
agent any
|
||||
@@ -99,13 +102,45 @@ pipeline {
|
||||
}
|
||||
post {
|
||||
success {
|
||||
mail to:"samuele@steamware.net", subject:"SUCCESS: ${currentBuild.fullDisplayName}", body: "Build passed."
|
||||
// mail to:"samuele@steamware.net", subject:"SUCCESS: ${currentBuild.fullDisplayName}", body: "Build passed."
|
||||
sendEmail("Successful")
|
||||
}
|
||||
failure {
|
||||
mail to:"samuele@steamware.net", subject:"FAILURE: ${currentBuild.fullDisplayName}", body: "Build failed."
|
||||
// mail to:"samuele@steamware.net", subject:"FAILURE: ${currentBuild.fullDisplayName}", body: "Build failed."
|
||||
sendEmail("Failed")
|
||||
}
|
||||
unstable {
|
||||
mail to:"samuele@steamware.net", subject:"UNSTABLE: ${currentBuild.fullDisplayName}", body: "Build is unstable."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@NonCPS
|
||||
def getChangeString() {
|
||||
MAX_MSG_LEN = 100
|
||||
def changeString = ""
|
||||
|
||||
echo "Gathering SCM changes"
|
||||
def changeLogSets = currentBuild.changeSets
|
||||
for (int i = 0; i < changeLogSets.size(); i++) {
|
||||
def entries = changeLogSets[i].items
|
||||
for (int j = 0; j < entries.length; j++) {
|
||||
def entry = entries[j]
|
||||
truncated_msg = entry.msg.take(MAX_MSG_LEN)
|
||||
changeString += " - ${truncated_msg} [${entry.author}]\n"
|
||||
}
|
||||
}
|
||||
|
||||
if (!changeString) {
|
||||
changeString = " - No new changes"
|
||||
}
|
||||
return changeString
|
||||
}
|
||||
|
||||
def sendEmail(status) {
|
||||
mail (
|
||||
to: "$EMAIL_RECIPIENTS",
|
||||
subject: "Build $BUILD_NUMBER - " + status + " ($JOB_NAME)",
|
||||
body: "Changes:\n " + getChangeString() + "\n\n Check console output at: $BUILD_URL/console" + "\n")
|
||||
}
|
||||
Reference in New Issue
Block a user