Last active
July 5, 2016 11:12
-
-
Save matthewprenger/e13d1a4e47ccb5c920a9 to your computer and use it in GitHub Desktop.
Jenkins Gradle Changelog Init Script, place this in ~/.gradle/init.d/changelog.gradle on your Jenkins server. Projects can simply call 'project.changelog' to get the changes for the current build.
This file contains 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
def buildUrl = System.getenv().BUILD_URL | |
if (buildUrl != null) { | |
def auth = "<USER>:<APITOKEN>".getBytes().encodeBase64().toString() | |
def url = new URL("$buildUrl/api/xml?depth=20").openConnection() | |
url.setRequestProperty("Authorization", "Basic " + auth) | |
String data = url.getInputStream().text | |
def changelog = "" | |
def xml = new XmlSlurper().parseText(data) | |
xml.changeSet.item.each { change -> | |
changelog += "$change.author.fullName: $change.msg" + '\n' | |
} | |
allprojects { | |
project.ext.changelog = changelog | |
} | |
} |
This file contains 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
def buildUrl = System.getenv().BUILD_URL | |
if (buildUrl != null) { | |
def url = new URL("$buildUrl/api/xml?depth=20").openConnection() | |
String data = url.getInputStream().text | |
def changelog = "" | |
def xml = new XmlSlurper().parseText(data) | |
xml.changeSet.item.each { change -> | |
changelog += "$change.author.fullName: $change.msg" + '\n' | |
} | |
allprojects { | |
project.ext.changelog = changelog | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
noice, keeping this for future reference