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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f3417e3f9c4f8b950c89047ed25c5f44a0da8e8c7f28667f33b549b2d6fadc3
4
- data.tar.gz: 9fec0221be92d34d7ade923a9f92bee18e9f602d719c041e21fc274fb6d10c9f
3
+ metadata.gz: 25dc1229c8a5638ae303b4abc140bd5b1d3c734416161e1b431dbff9ba40b980
4
+ data.tar.gz: 4e87ad53e75fd11e258cf82a36c95bcde7e0ff0aa90918fc282a1177d8e48839
5
5
  SHA512:
6
- metadata.gz: b31a95230656072e45d260aa549010ad5add9313af68f2490ac3d3c2220b9fe525ee6af144a3ca988103503af7f4a15cdbeb52601e1ff0427a5809714807be73
7
- data.tar.gz: 6754253f9cc10a00b663947860527a596308856e3beca48538eef1f19f9e02aa11c98ce981b5f7f7815bb177f4b329e971decf0dd8326ccc6a767d163c2970de
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, Utils.capture_sh("git rev-parse HEAD").strip).report(&block)
11
+ new(token).report(&block)
12
12
  end
13
13
  end
14
14
 
15
- def initialize(token, git_sha)
15
+ def initialize(token, ref: "HEAD")
16
16
  @token = token
17
- @git_sha = git_sha
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
- post "commits/#{@git_sha}/comments", body: body
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/repos/#{@repo_part}/#{path}"
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
@@ -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] && request[:formulas] != [{ formula: "query1" }]
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]
@@ -46,7 +46,6 @@ module Kennel
46
46
  font_size: "14"
47
47
  },
48
48
  "query_value" => {
49
- autoscale: true,
50
49
  time: {},
51
50
  title_align: "left",
52
51
  title_size: "16"
data/lib/kennel/syncer.rb CHANGED
@@ -24,7 +24,14 @@ module Kennel
24
24
  end
25
25
 
26
26
  def confirm
27
- ENV["CI"] || !STDIN.tty? || Utils.ask("Execute Plan ?") unless noop?
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
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Kennel
3
- VERSION = "1.91.1"
3
+ VERSION = "1.92.1"
4
4
  end
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.91.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-07-13 00:00:00.000000000 Z
11
+ date: 2021-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday