Go API Client Gem

This gem provides access to the ThoughtWorks Studios Go API, it is capable of parsing out the atom feed and generate an object graph with all the pipelines/stages/jobs and committer information.

Installation

$ [sudo] gem install go_api_client

Usage

See GoApiClient for supported options and more details.


require 'go_api_client'

# check if the server is building
GoApiClient.build_in_progress?(:host => 'go.example.com')

# check if the build has finished
GoApiClient.build_finished?(:host => 'go.example.com')

# schedule a pipeline
GoApiClient.schedule_pipeline(:host => 'go.example.com', :pipeline_name => 'MyProject')

# fetch a list of all pipelines
latest_atom_entry_id = nil
while true
  last_run = GoApiClient.runs(:host => 'go.example.com', :pipeline_name => 'MyProject', :latest_atom_entry_id => latest_atom_entry_id)
  latest_atom_entry_id = last_run.latest_atom_entry_id # => the last stage that was seen by the api client, keep this for further calls to #runs

  pipelines = last_run.pipelines
  last_pipeline = pipelines.last
  puts "Finished running stage #{last_pipeline.stages.last.name} from pipeline #{last_pipeline.name}."
  puts "The last commit(#{last_pipeline.commits.last.revision}) was checked in by #{last_pipeline.commits.last.user}"
  sleep 10
end

License

Go API Client Gem is MIT Licensed

The MIT License

Copyright © 2012 ThoughtWorks, Inc. (http://thoughtworks.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.