Begin fetching Jenkins master related information to present in the Canary homepage
This app is obvs. still janky AF
This commit is contained in:
parent
78719b0fce
commit
638ea446a9
1
Gemfile
1
Gemfile
|
@ -4,6 +4,7 @@ gem 'haml'
|
|||
gem 'sinatra'
|
||||
gem 'sentry-raven'
|
||||
gem 'sentry-api'
|
||||
gem 'httparty'
|
||||
|
||||
group :test do
|
||||
gem 'rspec'
|
||||
|
|
|
@ -50,6 +50,7 @@ PLATFORMS
|
|||
|
||||
DEPENDENCIES
|
||||
haml
|
||||
httparty
|
||||
rspec
|
||||
sentry-api
|
||||
sentry-raven
|
||||
|
|
10
README.adoc
10
README.adoc
|
@ -15,3 +15,13 @@ link:http://codevalet.io[Code Valet].
|
|||
. Provide Code Valet administrators with a centralized dashboard for service
|
||||
health.
|
||||
|
||||
|
||||
|
||||
== Hacking
|
||||
|
||||
This application requires a Sentry API token to be defined in the environment
|
||||
as `SENTRY_API_TOKEN` or else it simply won't work properly.
|
||||
|
||||
Once that environment variable has been defined, executing `make run` on a
|
||||
Docker-capable machine should bring Canary online at
|
||||
link:http://localhost:9292/[localhost:9292].
|
||||
|
|
|
@ -5,6 +5,8 @@ require 'raven'
|
|||
require 'sinatra/base'
|
||||
require 'sentry-api'
|
||||
|
||||
require 'canary/jenkins'
|
||||
|
||||
module CodeValet
|
||||
module Canary
|
||||
class App < Sinatra::Base
|
||||
|
@ -12,7 +14,8 @@ module CodeValet
|
|||
enable :raise_errors
|
||||
disable :show_exceptions
|
||||
|
||||
set :public_folder, File.dirname(__FILE__) + '/assets'
|
||||
set :public_folder, File.dirname(__FILE__) + '/../assets'
|
||||
set :views, File.dirname(__FILE__) + '/../views'
|
||||
|
||||
SentryApi.configure do |config|
|
||||
config.endpoint = 'https://app.getsentry.com/api/0'
|
||||
|
@ -32,6 +35,7 @@ module CodeValet
|
|||
:layout => :_base,
|
||||
:locals => {
|
||||
:projects => projects,
|
||||
:jenkins => Jenkins,
|
||||
}
|
||||
end
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
require 'httparty'
|
||||
|
||||
module CodeValet
|
||||
module Canary
|
||||
class Jenkins
|
||||
URL_BASE = ENV['JENKINS_URL_BASE'] || 'https://codevalet.io'
|
||||
|
||||
# https://codevalet.io/u/codevalet/userContent/builtOn.txt
|
||||
def self.rebuiltAlpha
|
||||
return self.rebuiltUrlFor('codevalet')
|
||||
end
|
||||
|
||||
def self.rebuiltGa
|
||||
return self.rebuiltUrlFor('rtyler')
|
||||
end
|
||||
|
||||
def self.rebuiltUrlFor(user)
|
||||
url = "#{URL_BASE}/u/#{user}/userContent/builtOn.txt"
|
||||
response = HTTParty.get(url)
|
||||
if response.ok?
|
||||
return response.body
|
||||
end
|
||||
return 'failed to retrieve last built information..'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
$LOAD_PATH << File.dirname(__FILE__)
|
||||
$LOAD_PATH << File.expand_path(File.dirname(__FILE__) + '/app')
|
||||
|
||||
ENV['RACK_ENV'] ||= 'development'
|
||||
|
||||
require 'app'
|
||||
require 'canary'
|
||||
require 'raven'
|
||||
|
||||
use Rack::Static, :urls => ["/css", "/img", "/js"], :root => "public"
|
||||
|
|
|
@ -13,34 +13,56 @@
|
|||
which provides radically transparent feedback for the service's
|
||||
operation. Canary allows developers to triage and understand issues
|
||||
affecting Code Valet, or one of its components.
|
||||
|
||||
- projects.auto_paginate do |project|
|
||||
.row
|
||||
.col-md-12
|
||||
%h3= project.name
|
||||
.row
|
||||
.col-md-12
|
||||
%h3
|
||||
Recent deployments
|
||||
.container
|
||||
%p
|
||||
- events = SentryApi.project_issues(project.slug)
|
||||
- unless events.size > 0
|
||||
No recent events (yay).
|
||||
- else
|
||||
- events.each do |event|
|
||||
- badge = 'danger'
|
||||
- if event.level != 'error'
|
||||
- badge = event.level
|
||||
.row
|
||||
.col-lg-10
|
||||
%strong
|
||||
= event.title
|
||||
The
|
||||
%strong
|
||||
alpha
|
||||
channel was last rebuilt on:
|
||||
%code
|
||||
= jenkins.rebuiltAlpha
|
||||
%p
|
||||
The
|
||||
%strong
|
||||
general availability
|
||||
channel was last rebuilt on:
|
||||
%code
|
||||
= jenkins.rebuiltGa
|
||||
|
||||
.mb-2.text-muted
|
||||
%span.badge{:class => "badge-#{badge}"}
|
||||
= event.count
|
||||
= event.culprit
|
||||
.row
|
||||
.col-md-12
|
||||
%h3
|
||||
Recent issues
|
||||
.container
|
||||
- projects.auto_paginate do |project|
|
||||
%h4= project.name
|
||||
%p
|
||||
- events = SentryApi.project_issues(project.slug)
|
||||
- unless events.size > 0
|
||||
No recent events (yay).
|
||||
- else
|
||||
- events.each do |event|
|
||||
- badge = 'danger'
|
||||
- if event.level != 'error'
|
||||
- badge = event.level
|
||||
.row
|
||||
.col-lg-10
|
||||
%strong
|
||||
= event.title
|
||||
|
||||
%p
|
||||
%a{:href => "issue/#{event.id}"}
|
||||
View
|
||||
·
|
||||
%a{:href => event.permalink, :target => '_blank'}
|
||||
View in Sentry
|
||||
.mb-2.text-muted
|
||||
%span.badge{:class => "badge-#{badge}"}
|
||||
= event.count
|
||||
= event.culprit
|
||||
|
||||
%p
|
||||
%a{:href => "issue/#{event.id}"}
|
||||
View
|
||||
·
|
||||
%a{:href => event.permalink, :target => '_blank'}
|
||||
View in Sentry
|
||||
%hr/
|
||||
|
|
Loading…
Reference in New Issue