Created
January 20, 2020 11:33
-
-
Save emexelem/f84aabb2b4e9bbe2f949e045917d210b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node('master') { | |
checkout(scm: [$class: 'GitSCM', | |
branches: [[name: "*/develop"]], | |
extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'repo1']], | |
userRemoteConfigs: [[credentialsId: 'bitbucket.jenkins', | |
url: 'urlToRepo.git']]], | |
changelog: true, poll: true) | |
showChangeLogs() | |
//currentBuild.result = 'FAILURE' | |
emailext( | |
subject: 'Deployment', | |
body: '${SCRIPT, template="groovy-html.template"}', | |
to: '[email protected]') | |
} | |
@NonCPS | |
def showChangeLogs() { | |
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] | |
echo "${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] | |
echo " ${file.editType.name} ${file.path}" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment