danger-warnings_next_generation 0.0.2 → 0.1.0

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: 61e6e3d8631cd2d6f0486218ead208fb1ffc95742c6ab4a7db4e6fca376a0dd3
4
- data.tar.gz: 3a2549476d33256091ebaf460bdb442821ccfb531dfb2575859c9052bf8dab5a
3
+ metadata.gz: b52ea983c720acd63ecb4db0b2c3b2d401eaaf72402c4cb6382572bb36e5343c
4
+ data.tar.gz: 8c7a354b7a3144c6120e160af5ba3fba1b56d3fcb71bc04e2fd0df03b9c5c273
5
5
  SHA512:
6
- metadata.gz: a9cbda9537a0408d69ff6de2ce133b44081e254bc414c6fa12a66722e0a2fb85b1a2affd450ece1a89482b80f0721bae0c4cd5d2041bd69eb44dcbf3b301a57b
7
- data.tar.gz: f85a1ad82731b9863f97b9d703996b22e47527710f9dd0548d5e70d9d19af9dba4a62581326ec9db2063cb39e5751d2787cc0e91531e55bec27f285e1db4c393
6
+ metadata.gz: 4d752d89c6d88b8d3b0005b799cb7d5d08cc3e3f108dd5a3825d8e489a526d1d2a92ee61bbdba8777217d6481ab3fecdffed8fda6d172f68ebc408007fcd85be
7
+ data.tar.gz: 6ac93eaa6e2dd50b1a31c311581eea2238e71657d5b54047af8e44a2cc4222d74fd881805bf9768487c545826dfe9b5947072c244f5c3c291731ab416dae44e2
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.1.0] - 2019-5-17
8
+ ### Added
9
+ - Add option to pass basic authentication
10
+
11
+ ### Changed
12
+ - Disable ssl verification
13
+
7
14
  ## [0.0.2] - 2019-5-17
8
15
  ### Fixed
9
16
  - Fixed OpenUri usage
data/README.md CHANGED
@@ -163,3 +163,26 @@ warnings_next_generation.tools_report(
163
163
  )
164
164
  </pre>
165
165
  </blockquote>
166
+
167
+ ## Authentication
168
+
169
+ If you run a jenkins server with required authentication you can pass them to `danger-warnings_next_generation`.
170
+ Create an API token with your CI user and do not pass normal password credentials.
171
+
172
+ <blockquote>Run all with authentication
173
+ <pre>
174
+ warnings_next_generation.report(
175
+ auth_user: "jenkins",
176
+ auth_token: "MY_TOKEN"
177
+ )
178
+ </pre>
179
+ </blockquote>
180
+
181
+ <blockquote>Run overview with authentication
182
+ <pre>
183
+ warnings_next_generation.overview_report(
184
+ auth_user: "jenkins",
185
+ auth_token: "MY_TOKEN"
186
+ )
187
+ </pre>
188
+ </blockquote>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WarningsNextGeneration
4
- VERSION = "0.0.2"
4
+ VERSION = "0.1.0"
5
5
  end
@@ -37,6 +37,7 @@ module Danger
37
37
 
38
38
  def initialize(dangerfile)
39
39
  @target_files = []
40
+ @auth = nil
40
41
  super(dangerfile)
41
42
  end
42
43
 
@@ -59,6 +60,7 @@ module Danger
59
60
  overview_table = WarningsNextGeneration::MarkdownTable.new
60
61
  overview_table.overview_header(TABLE_HEADER_TOOL, EMOJI_BEETLE, EMOJI_X, EMOJI_CHECK_MARK)
61
62
  options = args.first
63
+ check_auth(options)
62
64
  tool_ids = include(options)
63
65
  entry_count = 0
64
66
 
@@ -88,6 +90,7 @@ module Danger
88
90
  # @return [void]
89
91
  def tools_report(*args)
90
92
  options = args.first
93
+ check_auth(options)
91
94
  tool_ids = include(options)
92
95
 
93
96
  tools = tool_entries
@@ -125,6 +128,25 @@ module Danger
125
128
  base
126
129
  end
127
130
 
131
+ def auth_user(options)
132
+ options && !options[:auth_user].nil? ? options[:auth_user] : nil
133
+ end
134
+
135
+ def auth_token(options)
136
+ options && !options[:auth_token].nil? ? options[:auth_token] : nil
137
+ end
138
+
139
+ def check_auth(options)
140
+ user = auth_user(options)
141
+ token = auth_token(options)
142
+ if user && token
143
+ @auth = {
144
+ user: user,
145
+ token: token,
146
+ }
147
+ end
148
+ end
149
+
128
150
  def check_baseline(options)
129
151
  raise "Please set 'baseline' for correct inline comments." unless baseline(options)
130
152
 
@@ -197,17 +219,29 @@ module Danger
197
219
  end
198
220
 
199
221
  def details_result(url)
200
- content = OpenURI.open_uri("#{url}/all/api/json").read
222
+ options = { ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE }
223
+ if @auth
224
+ options[:http_basic_authentication] = [@auth[:user], @auth[:token]]
225
+ end
226
+ content = OpenURI.open_uri("#{url}/all/api/json", options).read
201
227
  JSON.parse(content)
202
228
  end
203
229
 
204
230
  def overview_result(url)
205
- content = OpenURI.open_uri("#{url}/api/json").read
231
+ options = { ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE }
232
+ if @auth
233
+ options[:http_basic_authentication] = [@auth[:user], @auth[:token]]
234
+ end
235
+ content = OpenURI.open_uri("#{url}/api/json", options).read
206
236
  JSON.parse(content)
207
237
  end
208
238
 
209
239
  def aggregation_result
210
- content = OpenURI.open_uri("#{ENV['BUILD_URL']}/warnings-ng/api/json").read
240
+ options = { ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE }
241
+ if @auth
242
+ options[:http_basic_authentication] = [@auth[:user], @auth[:token]]
243
+ end
244
+ content = OpenURI.open_uri("#{ENV['BUILD_URL']}/warnings-ng/api/json", options).read
211
245
  JSON.parse(content)
212
246
  end
213
247
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-warnings_next_generation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Schwamberger