kennel 1.64.0 → 1.65.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/lib/kennel/api.rb +3 -3
- data/lib/kennel/github_reporter.rb +5 -5
- data/lib/kennel/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f80b8b4232aa41c2b405d35ebb4377a6292e6278ab9261fb2ee36a13e9577e2
|
4
|
+
data.tar.gz: 9e677dee555faaab7b3be0cc58d341f5b36a4cf078a30dc79bf7f5210d9f01b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a99873dc872ff3c0af64d4ef4bfa04b3822e75a25dc1b4a08c62b4382476f5b68d5d8a80e621e301d7f8ca470c9d899afb68ebb37d28043bc4820b298d9d8cb1
|
7
|
+
data.tar.gz: 3b1ae467dd9845b826a0c0b5bd03f2352e07c80108404c5d7ff818cf6e207de60a1378627b222f5c93e6d585d3eb44c51f56fb7ab21e92c44f4394c94e60bbdb
|
data/lib/kennel/api.rb
CHANGED
@@ -43,12 +43,12 @@ module Kennel
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def delete(api_resource, id)
|
46
|
-
request :delete, "/api/v1/#{api_resource}/#{id}"
|
46
|
+
request :delete, "/api/v1/#{api_resource}/#{id}", ignore_404: true
|
47
47
|
end
|
48
48
|
|
49
49
|
private
|
50
50
|
|
51
|
-
def request(method, path, body: nil, params: {})
|
51
|
+
def request(method, path, body: nil, params: {}, ignore_404: false)
|
52
52
|
params = params.merge(application_key: @app_key, api_key: @api_key)
|
53
53
|
query = Faraday::FlatParamsEncoder.encode(params)
|
54
54
|
response = nil
|
@@ -66,7 +66,7 @@ module Kennel
|
|
66
66
|
Kennel.err.puts "Retrying on server error #{response.status} for #{path}"
|
67
67
|
end
|
68
68
|
|
69
|
-
|
69
|
+
if !response.success? && (response.status != 404 || !ignore_404)
|
70
70
|
message = +"Error #{response.status} during #{method.upcase} #{path}\n"
|
71
71
|
message << "request:\n#{JSON.pretty_generate(body)}\nresponse:\n" if body
|
72
72
|
message << response.body
|
@@ -7,13 +7,13 @@ module Kennel
|
|
7
7
|
class << self
|
8
8
|
def report(token, &block)
|
9
9
|
return yield unless token
|
10
|
-
new(token).report(&block)
|
10
|
+
new(token, Utils.capture_sh("git rev-parse HEAD").strip).report(&block)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
def initialize(token)
|
14
|
+
def initialize(token, git_sha)
|
15
15
|
@token = token
|
16
|
-
@git_sha =
|
16
|
+
@git_sha = git_sha
|
17
17
|
origin = ENV["PROJECT_REPOSITORY"] || Utils.capture_sh("git remote -v").split("\n").first
|
18
18
|
@repo_part = origin[%r{github\.com[:/](.+?)(\.git|$)}, 1] || raise("no origin found")
|
19
19
|
end
|
@@ -27,8 +27,6 @@ module Kennel
|
|
27
27
|
comment "```\n#{output || "Error"}\n```"
|
28
28
|
end
|
29
29
|
|
30
|
-
private
|
31
|
-
|
32
30
|
# https://developer.github.com/v3/repos/comments/#create-a-commit-comment
|
33
31
|
def comment(body)
|
34
32
|
# truncate to maximum allowed comment size for github to avoid 422
|
@@ -39,6 +37,8 @@ module Kennel
|
|
39
37
|
post "commits/#{@git_sha}/comments", body: body
|
40
38
|
end
|
41
39
|
|
40
|
+
private
|
41
|
+
|
42
42
|
def post(path, data)
|
43
43
|
url = "https://api.github.com/repos/#{@repo_part}/#{path}"
|
44
44
|
response = Faraday.post(url, data.to_json, authorization: "token #{@token}")
|
data/lib/kennel/version.rb
CHANGED