danger 8.4.0 → 8.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/danger/ci_source/buildkite.rb +1 -1
- data/lib/danger/helpers/emoji_mapper.rb +1 -1
- data/lib/danger/request_sources/bitbucket_server.rb +20 -15
- data/lib/danger/request_sources/bitbucket_server_api.rb +15 -6
- data/lib/danger/request_sources/gitlab.rb +4 -0
- data/lib/danger/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbecb15ac329fa5977840fe99a41c752b85ecec9669542d0f6002b8f3c374031
|
4
|
+
data.tar.gz: aa412e3e48efc2fbcac2302b3ce64c960f939c5dbc86a045c5be3d32dfb9df61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adfe653dfe86b47a1ee68b08a69f7b35f0e80979fe4f25725290091aa2fa5ede790331a8bce16f09efd4a1f9690c5df03d17e87516ff6ef6c19514a1d2e00044
|
7
|
+
data.tar.gz: 23b29baa8b821356398a8802f914019b3327fe2f68285cd1f8bebcef507d2beb0b2ee5259621337d247b4d3c110bc2cd1891dbaf2e9caa3da8e2737250d39499
|
@@ -45,7 +45,7 @@ module Danger
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def supported_request_sources
|
48
|
-
@supported_request_sources ||= [Danger::RequestSources::GitHub, Danger::RequestSources::GitLab]
|
48
|
+
@supported_request_sources ||= [Danger::RequestSources::GitHub, Danger::RequestSources::GitLab, Danger::RequestSources::BitbucketServer]
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -20,10 +20,12 @@ module Danger
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.optional_env_vars
|
23
|
-
[
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
[
|
24
|
+
"DANGER_BITBUCKETSERVER_CODE_INSIGHTS_REPORT_KEY",
|
25
|
+
"DANGER_BITBUCKETSERVER_CODE_INSIGHTS_REPORT_TITLE",
|
26
|
+
"DANGER_BITBUCKETSERVER_CODE_INSIGHTS_REPORT_DESCRIPTION",
|
27
|
+
"DANGER_BITBUCKETSERVER_CODE_INSIGHTS_REPORT_LOGO_URL",
|
28
|
+
"DANGER_BITBUCKETSERVER_VERIFY_SSL"
|
27
29
|
]
|
28
30
|
end
|
29
31
|
|
@@ -110,17 +112,20 @@ module Danger
|
|
110
112
|
markdowns = main_violations[:markdowns] || []
|
111
113
|
end
|
112
114
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
115
|
+
has_comments = (warnings.count > 0 || errors.count > 0 || messages.count > 0 || markdowns.count > 0)
|
116
|
+
if has_comments
|
117
|
+
comment = generate_description(warnings: warnings,
|
118
|
+
errors: errors)
|
119
|
+
comment += "\n\n"
|
120
|
+
comment += generate_comment(warnings: warnings,
|
121
|
+
errors: errors,
|
122
|
+
messages: messages,
|
123
|
+
markdowns: markdowns,
|
124
|
+
previous_violations: {},
|
125
|
+
danger_id: danger_id,
|
126
|
+
template: "bitbucket_server")
|
127
|
+
@api.post_comment(comment)
|
128
|
+
end
|
124
129
|
end
|
125
130
|
|
126
131
|
def delete_old_comments(danger_id: "danger")
|
@@ -1,16 +1,18 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
+
require "openssl"
|
3
4
|
require "danger/helpers/comments_helper"
|
4
5
|
|
5
6
|
module Danger
|
6
7
|
module RequestSources
|
7
8
|
class BitbucketServerAPI
|
8
|
-
attr_accessor :host, :pr_api_endpoint, :key, :project
|
9
|
+
attr_accessor :host, :verify_ssl, :pr_api_endpoint, :key, :project
|
9
10
|
|
10
11
|
def initialize(project, slug, pull_request_id, environment)
|
11
12
|
@username = environment["DANGER_BITBUCKETSERVER_USERNAME"]
|
12
13
|
@password = environment["DANGER_BITBUCKETSERVER_PASSWORD"]
|
13
14
|
self.host = environment["DANGER_BITBUCKETSERVER_HOST"]
|
15
|
+
self.verify_ssl = environment["DANGER_BITBUCKETSERVER_VERIFY_SSL"] == "false" ? false : true
|
14
16
|
if self.host && !(self.host.include? "http://") && !(self.host.include? "https://")
|
15
17
|
self.host = "https://" + self.host
|
16
18
|
end
|
@@ -57,7 +59,7 @@ module Danger
|
|
57
59
|
body = { text: text }.to_json
|
58
60
|
post(uri, body)
|
59
61
|
end
|
60
|
-
|
62
|
+
|
61
63
|
def update_pr_build_status(status, changeset, build_job_link, description)
|
62
64
|
uri = URI("#{self.host}/rest/build-status/1.0/commits/#{changeset}")
|
63
65
|
body = build_status_body(status, build_job_link, description)
|
@@ -73,7 +75,7 @@ module Danger
|
|
73
75
|
def fetch_json(uri)
|
74
76
|
req = Net::HTTP::Get.new(uri.request_uri, { "Content-Type" => "application/json" })
|
75
77
|
req.basic_auth @username, @password
|
76
|
-
res =
|
78
|
+
res = http(uri).start do |http|
|
77
79
|
http.request(req)
|
78
80
|
end
|
79
81
|
JSON.parse(res.body, symbolize_names: true)
|
@@ -84,7 +86,7 @@ module Danger
|
|
84
86
|
req.basic_auth @username, @password
|
85
87
|
req.body = body
|
86
88
|
|
87
|
-
res =
|
89
|
+
res = http(uri).start do |http|
|
88
90
|
http.request(req)
|
89
91
|
end
|
90
92
|
|
@@ -99,11 +101,18 @@ module Danger
|
|
99
101
|
def delete(uri)
|
100
102
|
req = Net::HTTP::Delete.new(uri.request_uri, { "Content-Type" => "application/json" })
|
101
103
|
req.basic_auth @username, @password
|
102
|
-
|
104
|
+
http(uri).start do |http|
|
103
105
|
http.request(req)
|
104
106
|
end
|
105
107
|
end
|
106
|
-
|
108
|
+
|
109
|
+
def http(uri)
|
110
|
+
http = Net::HTTP.new(uri.hostname, uri.port)
|
111
|
+
http.use_ssl = use_ssl
|
112
|
+
http.verify_mode = verify_ssl ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE
|
113
|
+
http
|
114
|
+
end
|
115
|
+
|
107
116
|
def build_status_body(status, build_job_link, description)
|
108
117
|
body = Hash.new
|
109
118
|
body["state"] = status
|
@@ -304,6 +304,10 @@ module Danger
|
|
304
304
|
end
|
305
305
|
end
|
306
306
|
|
307
|
+
def markdown_link_to_message(message, _)
|
308
|
+
"#{message.file}#L#{message.line}: "
|
309
|
+
end
|
310
|
+
|
307
311
|
# @return [String] The organisation name, is nil if it can't be detected
|
308
312
|
def organisation
|
309
313
|
nil # TODO: Implement this
|
data/lib/danger/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.4.
|
4
|
+
version: 8.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Orta Therox
|
8
8
|
- Juanito Fatas
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-10-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: claide
|
@@ -327,7 +327,7 @@ homepage: https://github.com/danger/danger
|
|
327
327
|
licenses:
|
328
328
|
- MIT
|
329
329
|
metadata: {}
|
330
|
-
post_install_message:
|
330
|
+
post_install_message:
|
331
331
|
rdoc_options: []
|
332
332
|
require_paths:
|
333
333
|
- lib
|
@@ -342,8 +342,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
342
342
|
- !ruby/object:Gem::Version
|
343
343
|
version: '0'
|
344
344
|
requirements: []
|
345
|
-
rubygems_version: 3.1.
|
346
|
-
signing_key:
|
345
|
+
rubygems_version: 3.1.2
|
346
|
+
signing_key:
|
347
347
|
specification_version: 4
|
348
348
|
summary: Like Unit Tests, but for your Team Culture.
|
349
349
|
test_files: []
|