1
我試圖通過一個郵件獲取GitHub更改日誌更改,當通過Jenkins進行構建時。Jenkins更新日誌
我有下面的代碼,這是給我的提交信息,但不是作者信息。我將如何獲取提交的作者信息?我在「getChangeString函數」中丟失了什麼?
@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)
echo "******${entry.author}**********"
changeString += " <tr><td> ${truncated_msg} </td><td> [${entry.author}]
</td></tr>\n"
}
}
if (!changeString) {
changeString = " <tr><td> No changes </td><td> No changes </td></tr>"
}
return changeString
}
def sendEmail() {
String Changelog=getChangeString()
body 1, body 2, body 3 = some of my personal text
def body=body1+getChangeString()+body2+build_url+body3
mail(to:"[email protected]",
subject:"${env.JOB_NAME}(${env.BUILD_NUMBER}) completed",
mimeType:'text/html',
body:"${body}")
}
Stage('Notification'){
echo "***** Send Email Notification *****"
sendEmail()
}
請讓我知道,謝謝!