lazylead 0.5.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +49 -1
- data/.simplecov +1 -1
- data/Guardfile +1 -1
- data/Rakefile +4 -3
- data/bin/lazylead +9 -5
- data/lazylead.gemspec +20 -15
- data/lib/lazylead/cc.rb +21 -20
- data/lib/lazylead/cli/app.rb +13 -5
- data/lib/lazylead/confluence.rb +8 -1
- data/lib/lazylead/email.rb +0 -20
- data/lib/lazylead/exchange.rb +16 -28
- data/lib/lazylead/log.rb +2 -1
- data/lib/lazylead/model.rb +31 -16
- data/lib/lazylead/opts.rb +65 -2
- data/lib/lazylead/postman.rb +18 -16
- data/lib/lazylead/salt.rb +1 -0
- data/lib/lazylead/smtp.rb +3 -1
- data/lib/lazylead/system/jira.rb +31 -6
- data/lib/lazylead/task/accuracy/accuracy.rb +8 -10
- data/lib/lazylead/task/accuracy/attachment.rb +0 -4
- data/lib/lazylead/task/accuracy/logs.rb +8 -4
- data/lib/lazylead/task/accuracy/onlyll.rb +148 -0
- data/lib/lazylead/task/accuracy/records.rb +1 -1
- data/lib/lazylead/task/accuracy/servers.rb +16 -7
- data/lib/lazylead/task/accuracy/stacktrace.rb +50 -10
- data/lib/lazylead/task/accuracy/testcase.rb +23 -6
- data/lib/lazylead/task/assignment.rb +96 -0
- data/lib/lazylead/task/fix_version.rb +6 -0
- data/lib/lazylead/task/propagate_down.rb +1 -1
- data/lib/lazylead/task/svn/diff.rb +77 -0
- data/lib/lazylead/task/svn/grep.rb +139 -0
- data/lib/lazylead/task/svn/touch.rb +99 -0
- data/lib/lazylead/version.rb +1 -1
- data/lib/messages/illegal_assignee_change.erb +123 -0
- data/lib/messages/illegal_fixversion_change.erb +8 -0
- data/lib/messages/only_ll.erb +107 -0
- data/lib/messages/svn_diff.erb +110 -0
- data/lib/messages/{svn_log.erb → svn_diff_attachment.erb} +19 -9
- data/lib/messages/svn_grep.erb +114 -0
- data/test/lazylead/cc_test.rb +1 -0
- data/test/lazylead/model_test.rb +20 -0
- data/test/lazylead/opts_test.rb +47 -0
- data/test/lazylead/postman_test.rb +8 -5
- data/test/lazylead/smoke_test.rb +13 -0
- data/test/lazylead/system/jira_test.rb +6 -7
- data/test/lazylead/task/accuracy/logs_test.rb +62 -2
- data/test/lazylead/task/accuracy/onlyll_test.rb +138 -0
- data/test/lazylead/task/accuracy/servers_test.rb +2 -2
- data/test/lazylead/task/accuracy/stacktrace_test.rb +227 -0
- data/test/lazylead/task/accuracy/testcase_test.rb +49 -0
- data/test/lazylead/task/assignment_test.rb +53 -0
- data/test/lazylead/task/fix_version_test.rb +1 -0
- data/test/lazylead/task/propagate_down_test.rb +4 -3
- data/test/lazylead/task/savepoint_test.rb +7 -4
- data/test/lazylead/task/svn/diff_test.rb +97 -0
- data/test/lazylead/task/svn/grep_test.rb +103 -0
- data/test/lazylead/task/{touch_test.rb → svn/touch_test.rb} +7 -34
- data/test/test.rb +7 -6
- data/upgrades/sqlite/999.testdata.sql +3 -1
- metadata +120 -34
- data/lib/lazylead/task/touch.rb +0 -119
@@ -0,0 +1,99 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The MIT License
|
4
|
+
#
|
5
|
+
# Copyright (c) 2019-2020 Yurii Dubinka
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"),
|
9
|
+
# to deal in the Software without restriction, including without limitation
|
10
|
+
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
11
|
+
# and/or sell copies of the Software, and to permit persons to whom
|
12
|
+
# the Software is furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included
|
15
|
+
# in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
22
|
+
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
23
|
+
# OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
|
25
|
+
require "tmpdir"
|
26
|
+
require "nokogiri"
|
27
|
+
require "active_support/core_ext/hash/conversions"
|
28
|
+
require_relative "../../salt"
|
29
|
+
require_relative "../../opts"
|
30
|
+
|
31
|
+
module Lazylead
|
32
|
+
module Task
|
33
|
+
module Svn
|
34
|
+
#
|
35
|
+
# Send notification about modification of critical files in svn repo.
|
36
|
+
#
|
37
|
+
class Touch
|
38
|
+
def initialize(log = Log.new)
|
39
|
+
@log = log
|
40
|
+
end
|
41
|
+
|
42
|
+
def run(_, postman, opts)
|
43
|
+
files = opts.slice("files", ",")
|
44
|
+
commits = touch(files, opts)
|
45
|
+
postman.send(opts.merge(entries: commits)) unless commits.empty?
|
46
|
+
end
|
47
|
+
|
48
|
+
# Return all svn commits for a particular date range, which are touching
|
49
|
+
# somehow the critical files within the svn repo.
|
50
|
+
def touch(files, opts)
|
51
|
+
xpath = files.map { |f| "contains(text(),\"#{f}\")" }.join(" or ")
|
52
|
+
svn_log(opts).xpath("//logentry[paths/path[#{xpath}]]")
|
53
|
+
.map(&method(:to_entry))
|
54
|
+
.each do |e|
|
55
|
+
e.paths.path.delete_if { |p| files.none? { |f| p.include? f } } if e.paths.path.respond_to? :delete_if
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# Return all svn commits for particular date range in repo
|
60
|
+
def svn_log(opts)
|
61
|
+
now = if opts.key? "now"
|
62
|
+
DateTime.parse(opts["now"])
|
63
|
+
else
|
64
|
+
DateTime.now
|
65
|
+
end
|
66
|
+
start = (now.to_time - opts["period"].to_i).to_datetime
|
67
|
+
cmd = [
|
68
|
+
"svn log --no-auth-cache",
|
69
|
+
"--username #{opts.decrypt('svn_user', 'svn_salt')}",
|
70
|
+
"--password #{opts.decrypt('svn_password', 'svn_salt')}",
|
71
|
+
"--xml -v -r {#{start}}:{#{now}} #{opts['svn_url']}"
|
72
|
+
]
|
73
|
+
raw = `#{cmd.join(" ")}`
|
74
|
+
Nokogiri.XML(raw, nil, "UTF-8")
|
75
|
+
end
|
76
|
+
|
77
|
+
# Convert single revision(XML text) to entry object.
|
78
|
+
# Entry object is a simple ruby struct object.
|
79
|
+
def to_entry(xml)
|
80
|
+
e = to_struct(Hash.from_xml(xml.to_s.strip)).logentry
|
81
|
+
if e.paths.path.respond_to? :each
|
82
|
+
e.paths.path.each(&:strip!)
|
83
|
+
else
|
84
|
+
e.paths.path.strip!
|
85
|
+
end
|
86
|
+
e
|
87
|
+
end
|
88
|
+
|
89
|
+
# Make a simple ruby struct object from hash hierarchically,
|
90
|
+
# considering nested hash(es) (if applicable)
|
91
|
+
def to_struct(hsh)
|
92
|
+
OpenStruct.new(
|
93
|
+
hsh.transform_values { |v| v.is_a?(Hash) ? to_struct(v) : v }
|
94
|
+
)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
data/lib/lazylead/version.rb
CHANGED
@@ -0,0 +1,123 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<style>
|
5
|
+
/* CSS styles taken from https://github.com/yegor256/tacit */
|
6
|
+
th {
|
7
|
+
font-weight: 600
|
8
|
+
}
|
9
|
+
|
10
|
+
table tr {
|
11
|
+
border-bottom-width: 2.16px
|
12
|
+
}
|
13
|
+
|
14
|
+
table tr th {
|
15
|
+
border-bottom-width: 2.16px
|
16
|
+
}
|
17
|
+
|
18
|
+
table tr td, table tr th {
|
19
|
+
overflow: hidden;
|
20
|
+
padding: 5.4px 3.6px
|
21
|
+
}
|
22
|
+
|
23
|
+
a {
|
24
|
+
color: #275a90;
|
25
|
+
text-decoration: none
|
26
|
+
}
|
27
|
+
|
28
|
+
a:hover {
|
29
|
+
text-decoration: underline
|
30
|
+
}
|
31
|
+
|
32
|
+
pre, code, kbd, samp, var, output {
|
33
|
+
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
|
34
|
+
font-size: 13px
|
35
|
+
}
|
36
|
+
|
37
|
+
pre code {
|
38
|
+
background: none;
|
39
|
+
border: 0;
|
40
|
+
line-height: 29.7px;
|
41
|
+
padding: 0
|
42
|
+
}
|
43
|
+
|
44
|
+
code, kbd {
|
45
|
+
background: #daf1e0;
|
46
|
+
border-radius: 3.6px;
|
47
|
+
color: #2a6f3b;
|
48
|
+
display: inline-block;
|
49
|
+
line-height: 18px;
|
50
|
+
padding: 3.6px 6.3px 2.7px
|
51
|
+
}
|
52
|
+
|
53
|
+
* {
|
54
|
+
border: 0;
|
55
|
+
border-collapse: separate;
|
56
|
+
border-spacing: 0;
|
57
|
+
box-sizing: border-box;
|
58
|
+
margin: 0;
|
59
|
+
max-width: 100%;
|
60
|
+
padding: 0;
|
61
|
+
vertical-align: baseline;
|
62
|
+
font-family: system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif;
|
63
|
+
font-size: 13px;
|
64
|
+
font-stretch: normal;
|
65
|
+
font-style: normal;
|
66
|
+
font-weight: 400;
|
67
|
+
line-height: 29.7px
|
68
|
+
}
|
69
|
+
|
70
|
+
html, body {
|
71
|
+
width: 100%
|
72
|
+
}
|
73
|
+
|
74
|
+
html {
|
75
|
+
height: 100%
|
76
|
+
}
|
77
|
+
|
78
|
+
body {
|
79
|
+
background: #fff;
|
80
|
+
color: #1a1919;
|
81
|
+
padding: 36px
|
82
|
+
}
|
83
|
+
</style>
|
84
|
+
<title>Not authorized "Assignee" change</title>
|
85
|
+
</head>
|
86
|
+
<body>
|
87
|
+
<p>Hi,</p>
|
88
|
+
|
89
|
+
<p>The <span style='font-weight:bold'>'Assignee'</span> for the following
|
90
|
+
ticket(s) changed by not authorized person(s):</p>
|
91
|
+
<table summary="ticket(s) where assignee changed">
|
92
|
+
<tr>
|
93
|
+
<th id="key">Key</th>
|
94
|
+
<th id="priority">Priority</th>
|
95
|
+
<th id="when">When</th>
|
96
|
+
<th id="who">Who</th>
|
97
|
+
<th id="to">To</th>
|
98
|
+
<th id="summary">Summary</th>
|
99
|
+
<th id="reporter">Reporter</th>
|
100
|
+
</tr>
|
101
|
+
<% assignees.each do |a| %>
|
102
|
+
<tr>
|
103
|
+
<td><a href='<%= a.issue.url %>'><%= a.issue.key %></a></td>
|
104
|
+
<td><%= a.issue.priority %></td>
|
105
|
+
<td><%= DateTime.parse(a.last["created"])
|
106
|
+
.strftime('%d-%b-%Y %I:%M:%S %p') %></td>
|
107
|
+
<td><span style='color: red'><%= a.last["author"]["displayName"] %></span>
|
108
|
+
(<%= a.last["author"]["name"] %>)
|
109
|
+
</td>
|
110
|
+
<td><%= a.to %></td>
|
111
|
+
<td><%= a.issue.summary %></td>
|
112
|
+
<td><%= a.issue.reporter.name %></td>
|
113
|
+
</tr>
|
114
|
+
<% end %>
|
115
|
+
</table>
|
116
|
+
|
117
|
+
<p>Authorized person(s) are: <code><%= allowed %></code>.</p>
|
118
|
+
|
119
|
+
<p>Posted by
|
120
|
+
<a href="https://github.com/dgroup/lazylead">lazylead v<%= version %></a>.
|
121
|
+
</p>
|
122
|
+
</body>
|
123
|
+
</html>
|
@@ -92,6 +92,8 @@
|
|
92
92
|
<tr>
|
93
93
|
<th id="key">Key</th>
|
94
94
|
<th id="priority">Priority</th>
|
95
|
+
<th id="from">From</th>
|
96
|
+
<th id="to">To</th>
|
95
97
|
<th id="when">When</th>
|
96
98
|
<th id="who">Who</th>
|
97
99
|
<th id="reporter">Reporter</th>
|
@@ -101,6 +103,12 @@
|
|
101
103
|
<tr>
|
102
104
|
<td><a href='<%= v.issue.url %>'><%= v.issue.key %></a></td>
|
103
105
|
<td><%= v.issue.priority %></td>
|
106
|
+
<td><%= v.last["items"]
|
107
|
+
.select { |h| h["field"] == "Fix Version" }
|
108
|
+
.map { |h| h["fromString"] }
|
109
|
+
.reject(&:blank?)
|
110
|
+
.join(",") %></td>
|
111
|
+
<td><%= v.to %></td>
|
104
112
|
<td><%= DateTime.parse(v.last["created"])
|
105
113
|
.strftime('%d-%b-%Y %I:%M:%S %p') %></td>
|
106
114
|
<td><span style='color: red'><%= v.last["author"]["displayName"] %></span>
|
@@ -0,0 +1,107 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<style> /* CSS styles taken from https://github.com/yegor256/tacit */
|
5
|
+
th {
|
6
|
+
font-weight: 600
|
7
|
+
}
|
8
|
+
|
9
|
+
table tr {
|
10
|
+
border-bottom-width: 2.16px
|
11
|
+
}
|
12
|
+
|
13
|
+
table tr th {
|
14
|
+
border-bottom-width: 2.16px
|
15
|
+
}
|
16
|
+
|
17
|
+
table tr td, table tr th {
|
18
|
+
overflow: hidden;
|
19
|
+
padding: 5.4px 3.6px;
|
20
|
+
line-height: 14px;
|
21
|
+
}
|
22
|
+
|
23
|
+
#summary {
|
24
|
+
text-align: left;
|
25
|
+
}
|
26
|
+
|
27
|
+
.auto {
|
28
|
+
min-width: auto;
|
29
|
+
white-space: nowrap;
|
30
|
+
}
|
31
|
+
|
32
|
+
a {
|
33
|
+
color: #275a90;
|
34
|
+
text-decoration: none
|
35
|
+
}
|
36
|
+
|
37
|
+
a:hover {
|
38
|
+
text-decoration: underline
|
39
|
+
}
|
40
|
+
|
41
|
+
* {
|
42
|
+
border: 0;
|
43
|
+
border-collapse: separate;
|
44
|
+
border-spacing: 0;
|
45
|
+
box-sizing: border-box;
|
46
|
+
margin: 0;
|
47
|
+
max-width: 100%;
|
48
|
+
padding: 0;
|
49
|
+
vertical-align: baseline;
|
50
|
+
font-family: system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif;
|
51
|
+
font-size: 13px;
|
52
|
+
font-stretch: normal;
|
53
|
+
font-style: normal;
|
54
|
+
font-weight: 400;
|
55
|
+
line-height: 29.7px
|
56
|
+
}
|
57
|
+
|
58
|
+
html, body {
|
59
|
+
width: 100%
|
60
|
+
}
|
61
|
+
|
62
|
+
html {
|
63
|
+
height: 100%
|
64
|
+
}
|
65
|
+
|
66
|
+
body {
|
67
|
+
background: #fff;
|
68
|
+
color: #1a1919;
|
69
|
+
padding: 36px
|
70
|
+
}
|
71
|
+
</style>
|
72
|
+
<title>Only LL</title>
|
73
|
+
</head>
|
74
|
+
<body>
|
75
|
+
<p>Hi,</p>
|
76
|
+
<p>The LL accuracy labels are cleaned from the following tickets:</p>
|
77
|
+
<table summary="table with tickets triage score">
|
78
|
+
<tr>
|
79
|
+
<th id="key">Key</th>
|
80
|
+
<th id="priority">Priority</th>
|
81
|
+
<th id="reporter">Reporter</th>
|
82
|
+
<th id="violators">Violators</th>
|
83
|
+
<th id="summary">Summary</th>
|
84
|
+
<th id="labels">Labels</th>
|
85
|
+
</tr>
|
86
|
+
<% tickets.each do |t| %>
|
87
|
+
<tr>
|
88
|
+
<td>
|
89
|
+
<div class="auto">
|
90
|
+
<a href="<%= t.issue.url %>"><%= t.issue.key %></a>
|
91
|
+
</div>
|
92
|
+
</td>
|
93
|
+
<td><%= t.issue.priority %></td>
|
94
|
+
<td>
|
95
|
+
<div class="auto"><%= t.issue.reporter.name %></div>
|
96
|
+
</td>
|
97
|
+
<td><%= t.violators.join(', ') %></td>
|
98
|
+
<td><%= t.issue.summary %></td>
|
99
|
+
<td><%= t.issue.labels.join(', ') %></td>
|
100
|
+
</tr>
|
101
|
+
<% end %>
|
102
|
+
</table>
|
103
|
+
<p>Posted by
|
104
|
+
<a href="https://github.com/dgroup/lazylead">lazylead v<%= version %></a>.
|
105
|
+
</p>
|
106
|
+
</body>
|
107
|
+
</html>
|
@@ -0,0 +1,110 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<style>
|
5
|
+
/* CSS styles taken from https://github.com/yegor256/tacit */
|
6
|
+
pre, code, kbd, samp, var, output {
|
7
|
+
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
|
8
|
+
font-size: 14.4px
|
9
|
+
}
|
10
|
+
|
11
|
+
pre code {
|
12
|
+
background: none;
|
13
|
+
border: 0;
|
14
|
+
line-height: 29.7px;
|
15
|
+
padding: 0
|
16
|
+
}
|
17
|
+
|
18
|
+
code, kbd {
|
19
|
+
background: #daf1e0;
|
20
|
+
border-radius: 3.6px;
|
21
|
+
color: #2a6f3b;
|
22
|
+
display: inline-block;
|
23
|
+
line-height: 18px;
|
24
|
+
padding: 3.6px 6.3px 2.7px
|
25
|
+
}
|
26
|
+
|
27
|
+
a {
|
28
|
+
color: #275a90;
|
29
|
+
text-decoration: none
|
30
|
+
}
|
31
|
+
|
32
|
+
a:hover {
|
33
|
+
text-decoration: underline
|
34
|
+
}
|
35
|
+
|
36
|
+
* {
|
37
|
+
border: 0;
|
38
|
+
border-collapse: separate;
|
39
|
+
border-spacing: 0;
|
40
|
+
box-sizing: border-box;
|
41
|
+
margin: 0;
|
42
|
+
max-width: 100%;
|
43
|
+
padding: 0;
|
44
|
+
vertical-align: baseline;
|
45
|
+
font-family: system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif;
|
46
|
+
font-size: 13px;
|
47
|
+
font-stretch: normal;
|
48
|
+
font-style: normal;
|
49
|
+
font-weight: 400;
|
50
|
+
line-height: 29.7px
|
51
|
+
}
|
52
|
+
|
53
|
+
html, body {
|
54
|
+
width: 100%
|
55
|
+
}
|
56
|
+
|
57
|
+
html {
|
58
|
+
height: 100%
|
59
|
+
}
|
60
|
+
|
61
|
+
body {
|
62
|
+
background: #fff;
|
63
|
+
color: #1a1919;
|
64
|
+
padding: 36px
|
65
|
+
}
|
66
|
+
|
67
|
+
.commit {
|
68
|
+
min-width: 100%;
|
69
|
+
border-radius: 3.5px;
|
70
|
+
overflow: hidden;
|
71
|
+
display: inline-block;
|
72
|
+
line-height: 15px;
|
73
|
+
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
|
74
|
+
border: 1px solid #BCC6CC;
|
75
|
+
}
|
76
|
+
|
77
|
+
.commit * {
|
78
|
+
padding-left: 4px;
|
79
|
+
font-size: 8px;
|
80
|
+
line-height: 12px;
|
81
|
+
}
|
82
|
+
</style>
|
83
|
+
<title>SVN log</title>
|
84
|
+
</head>
|
85
|
+
<body>
|
86
|
+
<p>Hi,</p>
|
87
|
+
<p>The following file(s) changed since <code><%= since_rev %></code> rev in
|
88
|
+
<a href="<%= svn_url %>"><%= svn_url %></a>:</p>
|
89
|
+
<% stdout.split("------------------------------------------------------------------------").reject(&:blank?).reverse.each do |commit| %>
|
90
|
+
<div class="commit">
|
91
|
+
<% commit.split("\n").reject(&:blank?).each_with_index do |line, index| %>
|
92
|
+
<p style="background: gainsboro;">
|
93
|
+
<% if index.zero? %>
|
94
|
+
<% details = line.split("|").map(&:strip).reject(&:blank?) %>
|
95
|
+
<a href="<%= commit_url %><%= details[0][1..-1] %>"><%= details[0] %></a>
|
96
|
+
by <a href="<%= user %><%= details[1] %>"><%= details[1] %></a>
|
97
|
+
at <span style="color: #275a90;"><%= details[2] %></span>
|
98
|
+
<% end %>
|
99
|
+
<% if index == 1 %>
|
100
|
+
<span style="padding-left: 4px"><%= line %></span>
|
101
|
+
<% end %>
|
102
|
+
</p>
|
103
|
+
<% end %>
|
104
|
+
</div>
|
105
|
+
<% end %>
|
106
|
+
<p>Posted by
|
107
|
+
<a href="https://github.com/dgroup/lazylead">lazylead v<%= version %></a>.
|
108
|
+
</p>
|
109
|
+
</body>
|
110
|
+
</html>
|