Last active
August 29, 2015 14:10
-
-
Save butaji/75ea9542905e238fa147 to your computer and use it in GitHub Desktop.
Generate changes by commits included in current TeamCity build
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
require 'net/http' | |
require 'json' | |
def get_json(uri) | |
url = URI.parse(uri) | |
req = Net::HTTP::Get.new(url, {'Accept' => "application/json"}) | |
res = Net::HTTP.start(url.host, url.port) {|http| | |
http.request(req) | |
} | |
JSON.parse(res.body) | |
end | |
def main | |
prefix = ARGV[1] | |
if !ARGV[0] | |
raise "You must pass the build_id as argument" | |
return 1 | |
end | |
build_id = ARGV[0] | |
changes = get_json("#{prefix}/httpAuth/app/rest/changes?build=id:#{build_id}")["change"] | |
if !changes | |
puts "nothing changed here" | |
return 0 | |
end | |
for c in changes | |
change_id = c["id"] | |
change_det = get_json("#{prefix}/httpAuth/app/rest/changes/id:#{change_id}") | |
puts change_det["comment"] | |
end | |
end | |
main() |
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
ruby changes.rb %teamcity.build.id% http://my_teamcity_server_url > changes.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using Powershell https://gist.github.com/jincod/03ed02181c83faf93081