Created
February 12, 2015 20:14
-
-
Save jeffryvu/e67e21708c0c876a8f0d to your computer and use it in GitHub Desktop.
Bash script to get the changelog from a certain jenkins build, format it in a nice way and write it to a properties file.
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
# Based on http://stackoverflow.com/questions/11823826/get-access-to-build-changelog-in-jenkins | |
# Get changelog and format it properly | |
CHANGELOG=$(curl "http://localhost:8080/job/MyProject/$UPSTREAM_BUILD_NUMBER/api/xml?wrapper=changes&xpath=//changeSet//comment" | sed -e "s/<\/comment>//g; s/<comment>/* /g; s/<\/*changes>//g" | sed '/^$/d;G') | |
# Write result to properties file | |
echo CHANGELOG=$CHANGELOG > build.properties |
Its working but format is not same
Thank you so much for this command! I was not aware that the job can be queried with XPath. I have tweaked it a little bit so that it drops the current build changelog to a variable.
CHANGELOG=$(curl "$BUILD_URL/api/xml?wrapper=changes&xpath=//changeSet//comment" | sed -e "s/<\/comment>//g; s/<comment>/* /g; s/<\/*changes>//g" | sed '/^$/d;G')
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
is there a way to get the changelog between a build to the other? Is there an xml exposed by Jenkins?