Skip to content

Instantly share code, notes, and snippets.

@andyt
Created October 1, 2015 12:15
Show Gist options
  • Save andyt/dc9be414b8a1b0b5d2cd to your computer and use it in GitHub Desktop.
Save andyt/dc9be414b8a1b0b5d2cd to your computer and use it in GitHub Desktop.
Get and print a list of failing builds from the Concourse CI API.
#!/usr/bin/env ruby
require 'rest-client'
require 'json'
USER = 'username'
PASSWORD = 'password'
CCI_API_URL = 'https://cci.example.com/api/v1'
PIPELINE = 'cr'
def resource(path)
RestClient::Resource.new CCI_API_URL + path, user: USER, password: PASSWORD
end
def jobs
JSON.parse resource("/pipelines/#{PIPELINE}/jobs").get
end
jobs.each do |job|
puts job['name'] unless job['finished_build']['status'] == 'succeeded'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment