nailed 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/README.rdoc +2 -0
- data/bin/nailed +0 -1
- data/config/config.yml +88 -10
- data/lib/nailed.rb +8 -132
- data/lib/nailed/bugzilla.rb +76 -0
- data/lib/nailed/github.rb +64 -0
- data/lib/nailed/version.rb +3 -0
- data/log/nailed.log +3676 -0
- data/nailed.gemspec +3 -1
- data/views/index.haml +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c558f13601ace2b9d76d18bea2f96e2cb8f731cd
|
4
|
+
data.tar.gz: e7f14b357926f916503a6b92f2f688dfcd8cf694
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cf648116e6b619c9824142f484da4c640e07508063d0a19f79c586fd922a3e9297ea855afc2f3c6a008b875f62a6646445dfc5f8cefbb41f6b040d8d05b3862
|
7
|
+
data.tar.gz: 90f90c6cfaa4728a023870586b0d043ecf401993aa1ece8debba37a4f8ffb0f980956cf74a9ef1164fc3fcd430f07d8a6ef364f6d7e4a1cf74015205917df7b0
|
data/README.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
[![Code Climate](https://codeclimate.com/github/MaximilianMeister/nailed/badges/gpa.svg)](https://codeclimate.com/github/MaximilianMeister/nailed)
|
1
2
|
## What is nailed?
|
2
3
|
|
3
4
|
`nailed` consists of a back-end CLI for data collection and a sinatra based web front-end for visualization of relevant development data of Products that have their bugtracker on Bugzilla and (optionally) their codebase on GitHub.
|
@@ -53,6 +54,7 @@ All configuration is read from `config/config.yml`
|
|
53
54
|
|
54
55
|
``` yaml
|
55
56
|
---
|
57
|
+
debug: # true for debugging
|
56
58
|
title: # Give me a name, or (default) call me Dashboard
|
57
59
|
port: # Specify a port where you can reach the webinterface, or (default) 4567
|
58
60
|
bugzilla:
|
data/README.rdoc
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
{<img src="https://codeclimate.com/github/MaximilianMeister/nailed/badges/gpa.svg" />}[https://codeclimate.com/github/MaximilianMeister/nailed]
|
1
2
|
= nailed
|
2
3
|
== What is nailed?
|
3
4
|
|
@@ -47,6 +48,7 @@ You can use nailed directly from a git checkout as well. Make sure to fetch the
|
|
47
48
|
All configuration is read from +config/products.yml+
|
48
49
|
|
49
50
|
---
|
51
|
+
debug: # true for debugging
|
50
52
|
title: # Give me a name, or (default) call me Dashboard
|
51
53
|
port: # Specify a port where you can reach the webinterface, or (default) 4567
|
52
54
|
bugzilla:
|
data/bin/nailed
CHANGED
data/config/config.yml
CHANGED
@@ -1,15 +1,93 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
|
2
|
+
debug: true
|
3
|
+
title: SUSE Cloud Team
|
4
|
+
port: 8080
|
4
5
|
bugzilla:
|
5
|
-
url:
|
6
|
+
url: https://bugzilla.novell.com
|
6
7
|
products:
|
7
|
-
|
8
|
+
cloud:
|
8
9
|
versions:
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
- SUSE Cloud 3
|
11
|
+
- SUSE Cloud 4
|
12
|
+
- SUSE Cloud 5
|
13
|
+
- SUSE OpenStack Cloud 6
|
14
|
+
organization: crowbar
|
12
15
|
repos:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
+
- crowbar
|
17
|
+
- barclamp-crowbar
|
18
|
+
- barclamp-deployer
|
19
|
+
- barclamp-dns
|
20
|
+
- barclamp-ganglia
|
21
|
+
- barclamp-ipmi
|
22
|
+
- barclamp-logging
|
23
|
+
- barclamp-nagios
|
24
|
+
- barclamp-network
|
25
|
+
- barclamp-ntp
|
26
|
+
- barclamp-provisioner
|
27
|
+
- barclamp-redhat-install
|
28
|
+
- barclamp-test
|
29
|
+
- barclamp-ubuntu-install
|
30
|
+
- barclamp-glance
|
31
|
+
- barclamp-nova
|
32
|
+
- barclamp-swift
|
33
|
+
- barclamp-keystone
|
34
|
+
- barclamp-mysql
|
35
|
+
- barclamp-kong
|
36
|
+
- barclamp-nova_dashboard
|
37
|
+
- barclamp-openstack
|
38
|
+
- barclamp-hadoop
|
39
|
+
- barclamp-hive
|
40
|
+
- barclamp-pig
|
41
|
+
- barclamp-zookeeper
|
42
|
+
- barclamp-sqoop
|
43
|
+
- barclamp-quantum
|
44
|
+
- barclamp-clouderamanager
|
45
|
+
- barclamp-ApacheHadoop
|
46
|
+
- barclamp-postgresql
|
47
|
+
- barclamp-tempest
|
48
|
+
- barclamp-database
|
49
|
+
- barclamp-git
|
50
|
+
- barclamp-cinder
|
51
|
+
- barclamp-dell_bios
|
52
|
+
- barclamp-dell_raid
|
53
|
+
- barclamp-chef
|
54
|
+
- crowbar.github.com
|
55
|
+
- crowbar-utils
|
56
|
+
- ci-tracking
|
57
|
+
- barclamp-example
|
58
|
+
- travis-ci-crowbar
|
59
|
+
- barclamp-loadbalancer
|
60
|
+
- barclamp-ceilometer
|
61
|
+
- barclamp-rabbitmq
|
62
|
+
- raw.crowbar.github.com
|
63
|
+
- barclamp-inteltxt
|
64
|
+
- barclamp-cisco-ucs
|
65
|
+
- barclamp-heat
|
66
|
+
- barclamp-openstack-titanium-block-storage
|
67
|
+
- barclamp-openstack-titanium-compute
|
68
|
+
- barclamp-openstack-titanium-identity
|
69
|
+
- barclamp-openstack-titanium-object-storage
|
70
|
+
- barclamp-openstack-titanium-dashboard
|
71
|
+
- barclamp-openstack-titanium-image
|
72
|
+
- barclamp-openstack-titanium-network
|
73
|
+
- barclamp-openstack-titanium-database
|
74
|
+
- barclamp-openstack-titanium-messaging
|
75
|
+
- barclamp-openstack-titanium-loadbalancer
|
76
|
+
- barclamp-openstack-titanium-base
|
77
|
+
- barclamp-neutron
|
78
|
+
- barclamp-hadoop_infrastructure
|
79
|
+
- barclamp-ceph
|
80
|
+
- barclamp-pacemaker
|
81
|
+
- barclamp-trove
|
82
|
+
- barclamp-messaging
|
83
|
+
- barclamp-hyperv-compute
|
84
|
+
- barclamp-updater
|
85
|
+
- barclamp-suse-manager-client
|
86
|
+
- barclamp-nfs_client
|
87
|
+
- barclamp-raid
|
88
|
+
- barclamp-bios
|
89
|
+
- wsman
|
90
|
+
cloud-tools:
|
91
|
+
organization: SUSE-Cloud
|
92
|
+
repos:
|
93
|
+
- automation
|
data/lib/nailed.rb
CHANGED
@@ -2,143 +2,19 @@ require 'logger'
|
|
2
2
|
require 'yaml'
|
3
3
|
require "octokit"
|
4
4
|
require "bicho"
|
5
|
+
require_relative "nailed/bugzilla"
|
6
|
+
require_relative "nailed/github"
|
7
|
+
require_relative "nailed/version"
|
5
8
|
require File.join(File.expand_path("..", File.dirname(__FILE__)),"db","database")
|
6
9
|
|
7
10
|
module Nailed
|
8
11
|
LOGGER = Logger.new(File.join(File.expand_path("..", File.dirname(__FILE__)),"log","nailed.log"))
|
9
12
|
|
10
|
-
class Bugzilla
|
11
|
-
def initialize
|
12
|
-
Bicho.client = Bicho::Client.new(Nailed.get_config["bugzilla"]["url"])
|
13
|
-
end
|
14
|
-
|
15
|
-
def get_bugs
|
16
|
-
Nailed.get_config["products"].each do |product,values|
|
17
|
-
values["versions"].each do |version|
|
18
|
-
begin
|
19
|
-
Bicho::Bug.where(:product => version).each do |bug|
|
20
|
-
attributes = {
|
21
|
-
:bug_id => bug.id,
|
22
|
-
:summary => bug.summary,
|
23
|
-
:status => bug.status,
|
24
|
-
:is_open => bug.is_open,
|
25
|
-
:product_name => bug.product,
|
26
|
-
:component => bug.component,
|
27
|
-
:severity => bug.severity,
|
28
|
-
:priority => bug.priority,
|
29
|
-
:whiteboard => bug.whiteboard,
|
30
|
-
:assigned_to => bug.assigned_to,
|
31
|
-
:creation_time => "#{bug.creation_time.to_date}T#{bug.creation_time.hour}:#{bug.creation_time.min}:#{bug.creation_time.sec}+00:00",
|
32
|
-
:last_change_time => "#{bug.last_change_time.to_date}T#{bug.last_change_time.hour}:#{bug.last_change_time.min}:#{bug.last_change_time.sec}+00:00",
|
33
|
-
:url => bug.url.gsub(/novell.com\//,'suse.com/show_bug.cgi?id=')
|
34
|
-
}
|
35
|
-
|
36
|
-
db_handler = (Bugreport.get(bug.id) || Bugreport.new).update(attributes)
|
37
|
-
end
|
38
|
-
rescue
|
39
|
-
Nailed.log("error","Could not fetch Bugs for #{version}.")
|
40
|
-
end
|
41
|
-
end unless values["versions"].nil?
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def write_bug_trends
|
46
|
-
Nailed.get_config["products"].each do |product,values|
|
47
|
-
values["versions"].each do |version|
|
48
|
-
open = Bugreport.count(:is_open => true, :product_name => version)
|
49
|
-
fixed = Bugreport.count(:status => "VERIFIED", :product_name => version) + \
|
50
|
-
Bugreport.count(:status => "RESOLVED", :product_name => version)
|
51
|
-
db_handler = Bugtrend.first_or_create(
|
52
|
-
:time => Time.new.strftime("%Y-%m-%d %H:%M:%S"),
|
53
|
-
:open => open,
|
54
|
-
:fixed => fixed,
|
55
|
-
:product_name => version
|
56
|
-
)
|
57
|
-
|
58
|
-
Nailed.save_state(db_handler)
|
59
|
-
end unless values["versions"].nil?
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def write_l3_trends
|
64
|
-
open = 0
|
65
|
-
Nailed.get_config["products"].each do |product,values|
|
66
|
-
values["versions"].each do |version|
|
67
|
-
open += Bugreport.count(:product_name => version, :whiteboard.like => "%openL3%", :is_open => true)
|
68
|
-
end unless values["versions"].nil?
|
69
|
-
end
|
70
|
-
db_handler = L3Trend.first_or_create(
|
71
|
-
:time => Time.new.strftime("%Y-%m-%d %H:%M:%S"),
|
72
|
-
:open => open
|
73
|
-
)
|
74
|
-
|
75
|
-
Nailed.save_state(db_handler)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
class Github
|
80
|
-
attr_reader :client
|
81
|
-
|
82
|
-
def initialize
|
83
|
-
Octokit.auto_paginate = true
|
84
|
-
@client = Octokit::Client.new(:netrc => true)
|
85
|
-
end
|
86
|
-
|
87
|
-
def get_open_pulls
|
88
|
-
Nailed.get_config["products"].each do |product,values|
|
89
|
-
organization = values["organization"]
|
90
|
-
repos = values["repos"]
|
91
|
-
repos.each do |repo|
|
92
|
-
pulls = @client.pull_requests("#{organization}/#{repo}")
|
93
|
-
pulls.each do |pr|
|
94
|
-
db_handler = Pullrequest.first_or_create(
|
95
|
-
:pr_number => pr.number,
|
96
|
-
:title => pr.title,
|
97
|
-
:state => pr.state,
|
98
|
-
:url => pr.html_url,
|
99
|
-
:created_at => pr.created_at,
|
100
|
-
:repository_rname => repo
|
101
|
-
)
|
102
|
-
|
103
|
-
Nailed.save_state(db_handler)
|
104
|
-
end unless pulls.empty?
|
105
|
-
write_pull_trends(repo)
|
106
|
-
end unless repos.nil?
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
def update_pull_states
|
111
|
-
pulls = Pullrequest.all
|
112
|
-
pulls.each do |db_pull|
|
113
|
-
number = db_pull.pr_number
|
114
|
-
repo = db_pull.repository_rname
|
115
|
-
org = Repository.get(repo).organization_oname
|
116
|
-
github_pull = @client.pull_request("#{org}/#{repo}", number)
|
117
|
-
if github_pull.state == "closed"
|
118
|
-
db_pull.destroy
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
def write_pull_trends(repo)
|
124
|
-
open = Pullrequest.count(:repository_rname => repo)
|
125
|
-
db_handler = Pulltrend.first_or_create(
|
126
|
-
:time => Time.new.strftime("%Y-%m-%d %H:%M:%S"),
|
127
|
-
:open => open,
|
128
|
-
:repository_rname => repo
|
129
|
-
)
|
130
|
-
|
131
|
-
Nailed.save_state(db_handler)
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
13
|
extend self
|
136
|
-
# Generic methods
|
137
14
|
def log(level,msg)
|
138
|
-
if
|
139
|
-
LOGGER.error(msg)
|
140
|
-
|
141
|
-
LOGGER.info(msg)
|
15
|
+
if get_config["debug"]
|
16
|
+
LOGGER.error(msg) if level == "error"
|
17
|
+
LOGGER.info(msg) if level == "info"
|
142
18
|
end
|
143
19
|
end
|
144
20
|
|
@@ -181,8 +57,8 @@ module Nailed
|
|
181
57
|
|
182
58
|
def save_state(db_handler)
|
183
59
|
unless db_handler.save
|
184
|
-
puts("ERROR: see logfile")
|
185
|
-
log("error", db_handler.errors.inspect)
|
60
|
+
puts("ERROR: #{__method__}: see logfile")
|
61
|
+
log("error", "#{__method__}: #{db_handler.errors.inspect}")
|
186
62
|
end
|
187
63
|
end
|
188
64
|
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module Nailed
|
2
|
+
class Bugzilla
|
3
|
+
def initialize
|
4
|
+
Bicho.client = Bicho::Client.new(Nailed.get_config["bugzilla"]["url"])
|
5
|
+
end
|
6
|
+
|
7
|
+
def get_bugs
|
8
|
+
Nailed.get_config["products"].each do |product,values|
|
9
|
+
values["versions"].each do |version|
|
10
|
+
Nailed.log("info", "#{__method__}: Fetching bugs for #{version}")
|
11
|
+
begin
|
12
|
+
Bicho::Bug.where(:product => version).each do |bug|
|
13
|
+
attributes = {
|
14
|
+
:bug_id => bug.id,
|
15
|
+
:summary => bug.summary,
|
16
|
+
:status => bug.status,
|
17
|
+
:is_open => bug.is_open,
|
18
|
+
:product_name => bug.product,
|
19
|
+
:component => bug.component,
|
20
|
+
:severity => bug.severity,
|
21
|
+
:priority => bug.priority,
|
22
|
+
:whiteboard => bug.whiteboard,
|
23
|
+
:assigned_to => bug.assigned_to,
|
24
|
+
:creation_time => "#{bug.creation_time.to_date}T#{bug.creation_time.hour}:#{bug.creation_time.min}:#{bug.creation_time.sec}+00:00",
|
25
|
+
:last_change_time => "#{bug.last_change_time.to_date}T#{bug.last_change_time.hour}:#{bug.last_change_time.min}:#{bug.last_change_time.sec}+00:00",
|
26
|
+
:url => bug.url.gsub(/novell.com\//,'suse.com/show_bug.cgi?id=')
|
27
|
+
}
|
28
|
+
|
29
|
+
db_handler = (Bugreport.get(bug.id) || Bugreport.new).update(attributes)
|
30
|
+
Nailed.log("info", "#{__method__}: Saved #{attributes.inspect}")
|
31
|
+
end
|
32
|
+
rescue
|
33
|
+
Nailed.log("error","Could not fetch Bugs for #{version}.")
|
34
|
+
end
|
35
|
+
end unless values["versions"].nil?
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def write_bug_trends
|
40
|
+
Nailed.get_config["products"].each do |product,values|
|
41
|
+
values["versions"].each do |version|
|
42
|
+
Nailed.log("info", "#{__method__}: Writing bug trends for #{version}")
|
43
|
+
open = Bugreport.count(:is_open => true, :product_name => version)
|
44
|
+
fixed = Bugreport.count(:status => "VERIFIED", :product_name => version) + \
|
45
|
+
Bugreport.count(:status => "RESOLVED", :product_name => version)
|
46
|
+
attributes = {:time => Time.new.strftime("%Y-%m-%d %H:%M:%S"),
|
47
|
+
:open => open,
|
48
|
+
:fixed => fixed,
|
49
|
+
:product_name => version}
|
50
|
+
|
51
|
+
db_handler = Bugtrend.first_or_create(attributes)
|
52
|
+
|
53
|
+
Nailed.save_state(db_handler)
|
54
|
+
Nailed.log("info", "#{__method__}: Saved #{attributes.inspect}")
|
55
|
+
end unless values["versions"].nil?
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def write_l3_trends
|
60
|
+
open = 0
|
61
|
+
Nailed.get_config["products"].each do |product,values|
|
62
|
+
values["versions"].each do |version|
|
63
|
+
Nailed.log("info", "#{__method__}: Aggregating l3 trends for #{version}")
|
64
|
+
open += Bugreport.count(:product_name => version, :whiteboard.like => "%openL3%", :is_open => true)
|
65
|
+
end unless values["versions"].nil?
|
66
|
+
end
|
67
|
+
attributes = {:time => Time.new.strftime("%Y-%m-%d %H:%M:%S"),
|
68
|
+
:open => open}
|
69
|
+
|
70
|
+
db_handler = L3Trend.first_or_create(attributes)
|
71
|
+
|
72
|
+
Nailed.save_state(db_handler)
|
73
|
+
Nailed.log("info", "#{__method__}: Saved #{attributes.inspect}")
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module Nailed
|
2
|
+
class Github
|
3
|
+
attr_reader :client
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
Octokit.auto_paginate = true
|
7
|
+
@client = Octokit::Client.new(:netrc => true)
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_open_pulls
|
11
|
+
Nailed.get_config["products"].each do |product,values|
|
12
|
+
organization = values["organization"]
|
13
|
+
repos = values["repos"]
|
14
|
+
repos.each do |repo|
|
15
|
+
Nailed.log("info", "#{__method__}: Getting open pullrequests for #{organization}/#{repo}")
|
16
|
+
pulls = @client.pull_requests("#{organization}/#{repo}")
|
17
|
+
pulls.each do |pr|
|
18
|
+
attributes = {:pr_number => pr.number,
|
19
|
+
:title => pr.title,
|
20
|
+
:state => pr.state,
|
21
|
+
:url => pr.html_url,
|
22
|
+
:created_at => pr.created_at,
|
23
|
+
:repository_rname => repo}
|
24
|
+
|
25
|
+
# if pr exists dont create a new record
|
26
|
+
pull_to_update = Pullrequest.all(:pr_number => pr.number, :repository_rname => repo)
|
27
|
+
if pull_to_update
|
28
|
+
if pr.state == "closed"
|
29
|
+
# delete record if pr.state changed to "closed"
|
30
|
+
pull_to_update.destroy
|
31
|
+
Nailed.log("info", "#{__method__}: Destroyed closed pullrequest #{pr.repo} ##{pr.number}")
|
32
|
+
else
|
33
|
+
# update saves the state, so we dont need a db_handler
|
34
|
+
# TODO check return code for true if saved correctly
|
35
|
+
pull_to_update.update(attributes)
|
36
|
+
Nailed.log("info", "#{__method__}: Updated #{pr.repo} ##{pr.number} with #{attributes.inspect}")
|
37
|
+
end
|
38
|
+
else
|
39
|
+
db_handler = Pullrequest.first_or_create(attributes)
|
40
|
+
Nailed.log("info", "#{__method__}: Created new pullrequest #{pr.repo} ##{pr.number} with #{attributes.inspect}")
|
41
|
+
end
|
42
|
+
|
43
|
+
Nailed.save_state(db_handler) unless defined? db_handler
|
44
|
+
Nailed.log("info", "#{__method__}: Saved #{attributes.inspect}")
|
45
|
+
end unless pulls.empty?
|
46
|
+
write_pull_trends(repo)
|
47
|
+
end unless repos.nil?
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def write_pull_trends(repo)
|
52
|
+
Nailed.log("info", "#{__method__}: Writing pull trends for #{repo}")
|
53
|
+
open = Pullrequest.count(:repository_rname => repo)
|
54
|
+
attributes = {:time => Time.new.strftime("%Y-%m-%d %H:%M:%S"),
|
55
|
+
:open => open,
|
56
|
+
:repository_rname => repo}
|
57
|
+
|
58
|
+
db_handler = Pulltrend.first_or_create(attributes)
|
59
|
+
|
60
|
+
Nailed.save_state(db_handler)
|
61
|
+
Nailed.log("info", "#{__method__}: Saved #{attributes.inspect}")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|