Created
October 1, 2015 12:15
-
-
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.
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
#!/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