kennel 1.91.1 → 1.92.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kennel/github_reporter.rb +8 -5
- data/lib/kennel/importer.rb +2 -1
- data/lib/kennel/models/dashboard.rb +0 -1
- data/lib/kennel/syncer.rb +8 -1
- data/lib/kennel/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25dc1229c8a5638ae303b4abc140bd5b1d3c734416161e1b431dbff9ba40b980
|
4
|
+
data.tar.gz: 4e87ad53e75fd11e258cf82a36c95bcde7e0ff0aa90918fc282a1177d8e48839
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17a8ec0d1697ba73d498d0f86f53e81e48a0ce92b0589f4a0a44f8e8735af98bd133e3270d4147d08d7e1a1d896093c4db0d3607441e7b911398de47a21b494b
|
7
|
+
data.tar.gz: aa1b95aab43b1fb0e7db8b50f3a6869bd620e815e7f7c3aaf10daad85cfd1309f926b713eec1a3ce33bf9a9f3e09b9df43f6ba280a1720bd1247dbac823db590
|
@@ -8,13 +8,15 @@ module Kennel
|
|
8
8
|
class << self
|
9
9
|
def report(token, &block)
|
10
10
|
return yield unless token
|
11
|
-
new(token
|
11
|
+
new(token).report(&block)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
def initialize(token,
|
15
|
+
def initialize(token, ref: "HEAD")
|
16
16
|
@token = token
|
17
|
-
|
17
|
+
commit = Utils.capture_sh("git show #{ref}")
|
18
|
+
@sha = commit[/^Merge: \S+ (\S+)/, 1] || commit[/\Acommit (\S+)/, 1] || raise("Unable to find commit")
|
19
|
+
@pr = commit[/^\s+.*\(#(\d+)\)/, 1] # from squash
|
18
20
|
@repo_part = ENV["GITHUB_REPOSITORY"] || begin
|
19
21
|
origin = ENV["PROJECT_REPOSITORY"] || Utils.capture_sh("git remote -v").split("\n").first
|
20
22
|
origin[%r{github\.com[:/](\S+?)(\.git|$)}, 1] || raise("no origin found in #{origin}")
|
@@ -37,13 +39,14 @@ module Kennel
|
|
37
39
|
body = body.byteslice(0, MAX_COMMENT_SIZE - TRUNCATED_MSG.bytesize) + TRUNCATED_MSG
|
38
40
|
end
|
39
41
|
|
40
|
-
|
42
|
+
path = (@pr ? "/repos/#{@repo_part}/issues/#{@pr}/comments" : "/repos/#{@repo_part}/commits/#{@sha}/comments")
|
43
|
+
post path, body: body
|
41
44
|
end
|
42
45
|
|
43
46
|
private
|
44
47
|
|
45
48
|
def post(path, data)
|
46
|
-
url = "https://api.github.com
|
49
|
+
url = "https://api.github.com#{path}"
|
47
50
|
response = Faraday.post(url, data.to_json, authorization: "token #{@token}")
|
48
51
|
raise "failed to POST to github:\n#{url} -> #{response.status}\n#{response.body}" unless response.status == 201
|
49
52
|
end
|
data/lib/kennel/importer.rb
CHANGED
@@ -106,10 +106,11 @@ module Kennel
|
|
106
106
|
end
|
107
107
|
|
108
108
|
# new api format is very verbose, so use old dry format when possible
|
109
|
+
# dd randomly chooses query0 or query1
|
109
110
|
def convert_widget_to_compact_format!(widget)
|
110
111
|
(widget.dig(:definition, :requests) || []).each do |request|
|
111
112
|
next unless request.is_a?(Hash)
|
112
|
-
next if request[:formulas] &&
|
113
|
+
next if request[:formulas] && ![[{ formula: "query1" }], [{ formula: "query0" }]].include?(request[:formulas])
|
113
114
|
next if request[:queries]&.size != 1
|
114
115
|
next if request[:queries].any? { |q| q[:data_source] != "metrics" }
|
115
116
|
next if widget.dig(:definition, :type) != request[:response_format]
|
data/lib/kennel/syncer.rb
CHANGED
@@ -24,7 +24,14 @@ module Kennel
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def confirm
|
27
|
-
|
27
|
+
return false if noop?
|
28
|
+
return true if ENV["CI"] || !STDIN.tty?
|
29
|
+
if @delete.any? && @project_filter
|
30
|
+
Kennel.out.puts(
|
31
|
+
Utils.color(:red, "WARNING: deleting resources that had `id: -> { ...` breaks master branch")
|
32
|
+
)
|
33
|
+
end
|
34
|
+
Utils.ask("Execute Plan ?")
|
28
35
|
end
|
29
36
|
|
30
37
|
def update
|
data/lib/kennel/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kennel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.92.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|