forked from elnuraa/Content
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfilenotification
30 lines (27 loc) · 1 KB
/
Jenkinsfilenotification
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
node {
checkout scm;
notifyStarted()
}
def notifyStarted() {
def changeLogSets = currentBuild.rawBuild.changeSets
def result = ''
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]
result =result + "${entry.commitId} by ${entry.author} on ${new Date(entry.timestamp)}: ${entry.msg}"
def files = new ArrayList(entry.affectedFiles)
for (int k = 0; k < files.size(); k++) {
def file = files[k]
result =result + "${file.editType.name} ${file.path}"
}
}
}
// send to email
emailext (
subject: "STARTED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
body: """<p>STARTED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]':</p>
<p>Check console output at "<a href="${env.BUILD_URL}">${env.JOB_NAME} [${env.BUILD_NUMBER}]</a>"</p><p>[${result}]</p>""",
recipients: '[email protected]'
)
}