dependabot-common 0.98.30 → 0.98.31

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39968e992344afb730de7e02eb312982ceabcded5671e79bd2590a1a2d2d9b0d
4
- data.tar.gz: 6c81f19124a04a0d5300733cef52982d559a30908b424c06234a4c34a1dcf280
3
+ metadata.gz: acad640cd551e4c5ee343d17311bac5cdfc4ad10807aa90f980b26299e87e9e1
4
+ data.tar.gz: 70f12e0ac10bc80c53a319e5222cfc94a554e8b344d654414fbbf886bf259cec
5
5
  SHA512:
6
- metadata.gz: 72af31b12994256992abef74b2a99202950b1483dbda91938ce0f52cb3e20ceacb3134dcfecdbd3963d71d5611f2bc18eafcddb092ab829203962208876589dc
7
- data.tar.gz: 3c5a42ef089476b28cb0acbaf8c8c0168825fa08f458205521caae0a26b11ad517711e1c956ae23f7922076485d243a0149086fae46094b7d2cada12959911c5
6
+ metadata.gz: f7ac6b7e472065c2513514a5544681cad0392d7a54b64b6168d11cfdf9189cb52974d6bcc9c3197c4df25aaa39fdb891589f6ebe13e237ec9d19e75fc0806097
7
+ data.tar.gz: 33701004d42ae340edb275da8bdb6780a271f99f74ba34af35705fb9996f7e161c17e242a507457bf33c6c9972ff977c7753313b76c98f5fe5fa6ef9cf9c4f20
@@ -3,6 +3,8 @@
3
3
  require "excon"
4
4
  require "gitlab"
5
5
  require "dependabot/clients/github_with_retries"
6
+ require "dependabot/clients/gitlab_with_retries"
7
+ require "dependabot/clients/bitbucket"
6
8
  require "dependabot/metadata_finders"
7
9
  require "dependabot/errors"
8
10
  require "dependabot/utils"
@@ -10,7 +12,6 @@ require "dependabot/source"
10
12
  require "dependabot/dependency"
11
13
  require "dependabot/git_metadata_fetcher"
12
14
 
13
- # rubocop:disable Metrics/ClassLength
14
15
  module Dependabot
15
16
  class GitCommitChecker
16
17
  VERSION_REGEX = /(?<version>[0-9]+\.[0-9]+(?:\.[a-zA-Z0-9\-]+)*)$/.freeze
@@ -166,6 +167,7 @@ module Dependabot
166
167
 
167
168
  allow_identical && status == "identical"
168
169
  rescue Octokit::NotFound, Gitlab::Error::NotFound,
170
+ Clients::Bitbucket::NotFound,
169
171
  Octokit::InternalServerError
170
172
  false
171
173
  end
@@ -178,13 +180,8 @@ module Dependabot
178
180
  end
179
181
 
180
182
  def gitlab_commit_comparison_status(ref1, ref2)
181
- access_token = credentials.
182
- select { |cred| cred["type"] == "git_source" }.
183
- find { |cred| cred["host"] == "gitlab.com" }&.
184
- fetch("token")
185
-
186
- client = Gitlab.client(endpoint: "https://gitlab.com/api/v4",
187
- private_token: access_token.to_s)
183
+ client = Clients::GitlabWithRetries.
184
+ for_gitlab_dot_com(credentials: credentials)
188
185
 
189
186
  comparison = client.compare(listing_source_repo, ref1, ref2)
190
187
 
@@ -199,10 +196,10 @@ module Dependabot
199
196
  "#{listing_source_repo}/commits/?"\
200
197
  "include=#{ref2}&exclude=#{ref1}"
201
198
 
202
- response = Excon.get(url,
203
- headers: bitbucket_auth_header,
204
- idempotent: true,
205
- **SharedHelpers.excon_defaults)
199
+ client = Clients::Bitbucket.
200
+ for_bitbucket_dot_org(credentials: credentials)
201
+
202
+ response = client.get(url)
206
203
 
207
204
  # Conservatively assume that ref2 is ahead in the equality case, of
208
205
  # if we get an unexpected format (e.g., due to a 404)
@@ -211,24 +208,6 @@ module Dependabot
211
208
  end
212
209
  end
213
210
 
214
- def bitbucket_auth_header
215
- token = credentials.
216
- select { |cred| cred["type"] == "git_source" }.
217
- find { |cred| cred["host"] == "bitbucket.org" }&.
218
- fetch("token")
219
-
220
- if token.nil? then {}
221
- elsif token.include?(":")
222
- encoded_token = Base64.encode64(token).delete("\n")
223
- { "Authorization" => "Basic #{encoded_token}" }
224
- elsif Base64.decode64(token).ascii_only? &&
225
- Base64.decode64(token).include?(":")
226
- { "Authorization" => "Basic #{token.delete("\n")}" }
227
- else
228
- { "Authorization" => "Bearer #{token}" }
229
- end
230
- end
231
-
232
211
  def dependency_source_details
233
212
  sources =
234
213
  dependency.requirements.map { |r| r.fetch(:source) }.uniq.compact
@@ -361,4 +340,3 @@ module Dependabot
361
340
  end
362
341
  end
363
342
  end
364
- # rubocop:enable Metrics/ClassLength
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dependabot
4
- VERSION = "0.98.30"
4
+ VERSION = "0.98.31"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.98.30
4
+ version: 0.98.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot