Guest User

Untitled

a guest
Apr 1st, 2019
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Where the changelog file will be created
  4. outputFile='%system.teamcity.build.tempDir%/releasenotesfile_%teamcity.build.id%.txt'
  5. # the url of teamcity server
  6. teamcityUrl='%teamcity.serverUrl%'
  7. # username to access Teamcity REST API
  8. username='%system.teamcity.auth.userId%'
  9. # password to access Teamcity REST API
  10. password='%system.teamcity.auth.password%'
  11. # Build id for the release notes
  12. buildTypeId=%system.teamcity.buildType.id%
  13.  
  14. request="$teamcityUrl/app/rest/buildTypes/id:$buildTypeId/builds/running:true"
  15. echo request = $request
  16. curl -o lastBuild.tmp $request --user $username:$password
  17. cat lastBuild.tmp
  18. last_commit=`xpath lastBuild.tmp '/build/revisions/revision/@version'| awk -F"\"" '{print $2}'`
  19.  
  20. request="$teamcityUrl/app/rest/buildTypes/id:$buildTypeId/builds/start:0"
  21. echo request = $request
  22. curl -o lastBuild1.tmp $request --user $username:$password
  23. cat lastBuild1.tmp
  24. previous_commit=`xpath lastBuild1.tmp '/build/revisions/revision/@version'| awk -F"\"" '{print $2}'`
  25.  
  26. echo "git log --pretty=format:"- %%s" $last_commit..$previous_commit"
  27. git log --pretty=format:"- %%s" $previous_commit..$last_commit > $outputFile
  28.  
  29. cat $outputFile
  30. echo "Changelog saved to $outputFile:"
Add Comment
Please, Sign In to add comment