Skip to content

Instantly share code, notes, and snippets.

@eightbitraptor
Created November 24, 2011 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eightbitraptor/1391348 to your computer and use it in GitHub Desktop.
Save eightbitraptor/1391348 to your computer and use it in GitHub Desktop.
build status monitor
require 'rack'
require 'jenkins-remote-api'
class OhGodBuildBot
def initialize
@jenkins = Ci::Jenkins.new('http://172.21.6.241:8080/')
end
def failing?
@jenkins.list_all_job_names.map{ |job| @jenkins.current_status_on_job(job) }.include? "failure"
end
def build_status_page
colour = failing? ? "red" : "green"
return ["<body style='background-color: #{colour}; position: absolute; width: 100%; height: 100%'></body>"]
end
def call(env)
[200, {"Content-Type" => "text/html"}, OhGodBuildBot.new.build_status_page]
end
end
run OhGodBuildBot.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment