dependabot-common 0.95.69 → 0.95.70

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: af5d9e22d131cb3fc4a2496746bbafa4fbe7f60437e4130aaea5c501f15d581b
4
- data.tar.gz: 5b346f18a2299a2127d3b62cf4f5c248fe322b547f5104bdc90cc33e7cca2108
3
+ metadata.gz: c8f743e1cc3f36fc0fa38cdce5d04129d6d099578692222ec10b9cc35c3340f8
4
+ data.tar.gz: 683afa4dafd9dc4e5b35466ee0dcb8169c0acef36e252850aeb9a1db61162e77
5
5
  SHA512:
6
- metadata.gz: 73f497d07834ba7286a88c8fbb736eecfb06b56abc10f20be6a2d317bbf1f53ae6fb6866db32451d7afd09dca13eb9ce2eef2823d9a6860911e49b14f88fd33c
7
- data.tar.gz: '0858f85968e2febda80ffbcaa4a4c3c0801f7eb79eeac54776445872e602ffe0fb19ca28d6e4c825d99a03d1f5b9feb9e92f34a905c59a9ac0a3c7aa77744dfb'
6
+ metadata.gz: e49592051ae83590e9e8cf31ab9d4665c9f2a345e2839a721e0544c17f1981f22ba5f3676ca95911c7716b6be9f9fa3f39f08f069d0cac0ecaab7ab504a4bee5
7
+ data.tar.gz: a72551a284a7463c95022436eeb0d19e03d00d3a2abf55d1dd5418425193905b6a446c88cd7f8ae30f928960a90f53710df03ce2d5c0b1475cafd98e9ddab4f7
@@ -4,7 +4,11 @@ require "gitlab"
4
4
 
5
5
  module Dependabot
6
6
  module Clients
7
- class Gitlab
7
+ class GitlabWithRetries
8
+ RETRYABLE_ERRORS = [
9
+ Gitlab::Error::BadGateway
10
+ ].freeze
11
+
8
12
  #######################
9
13
  # Constructor methods #
10
14
  #######################
@@ -51,22 +55,36 @@ module Dependabot
51
55
  # Proxying #
52
56
  ############
53
57
 
54
- def initialize(**args)
58
+ def initialize(max_retries: 3, **args)
59
+ @max_retries = max_retries || 3
55
60
  @client = ::Gitlab::Client.new(args)
56
61
  end
57
62
 
58
63
  def method_missing(method_name, *args, &block)
59
- if @client.respond_to?(method_name)
60
- mutatable_args = args.map(&:dup)
61
- @client.public_send(method_name, *mutatable_args, &block)
62
- else
63
- super
64
+ retry_connection_failures do
65
+ if @client.respond_to?(method_name)
66
+ mutatable_args = args.map(&:dup)
67
+ @client.public_send(method_name, *mutatable_args, &block)
68
+ else
69
+ super
70
+ end
64
71
  end
65
72
  end
66
73
 
67
74
  def respond_to_missing?(method_name, include_private = false)
68
75
  @client.respond_to?(method_name) || super
69
76
  end
77
+
78
+ def retry_connection_failures
79
+ retry_attempt = 0
80
+
81
+ begin
82
+ yield
83
+ rescue *RETRYABLE_ERRORS
84
+ retry_attempt += 1
85
+ retry_attempt <= @max_retries ? retry : raise
86
+ end
87
+ end
70
88
  end
71
89
  end
72
90
  end
@@ -5,7 +5,7 @@ require "dependabot/source"
5
5
  require "dependabot/errors"
6
6
  require "dependabot/clients/github_with_retries"
7
7
  require "dependabot/clients/bitbucket"
8
- require "dependabot/clients/gitlab"
8
+ require "dependabot/clients/gitlab_with_retries"
9
9
  require "dependabot/shared_helpers"
10
10
 
11
11
  # rubocop:disable Metrics/ClassLength
@@ -371,7 +371,7 @@ module Dependabot
371
371
 
372
372
  def gitlab_client
373
373
  @gitlab_client ||=
374
- Dependabot::Clients::Gitlab.for_source(
374
+ Dependabot::Clients::GitlabWithRetries.for_source(
375
375
  source: source,
376
376
  credentials: credentials
377
377
  )
@@ -4,7 +4,7 @@ require "excon"
4
4
  require "pandoc-ruby"
5
5
 
6
6
  require "dependabot/clients/github_with_retries"
7
- require "dependabot/clients/gitlab"
7
+ require "dependabot/clients/gitlab_with_retries"
8
8
  require "dependabot/clients/bitbucket"
9
9
  require "dependabot/shared_helpers"
10
10
  require "dependabot/metadata_finders/base"
@@ -337,7 +337,7 @@ module Dependabot
337
337
  end
338
338
 
339
339
  def gitlab_client
340
- @gitlab_client ||= Dependabot::Clients::Gitlab.
340
+ @gitlab_client ||= Dependabot::Clients::GitlabWithRetries.
341
341
  for_gitlab_dot_com(credentials: credentials)
342
342
  end
343
343
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "dependabot/clients/github_with_retries"
4
- require "dependabot/clients/gitlab"
4
+ require "dependabot/clients/gitlab_with_retries"
5
5
  require "dependabot/clients/bitbucket"
6
6
  require "dependabot/shared_helpers"
7
7
  require "dependabot/git_metadata_fetcher"
@@ -249,7 +249,7 @@ module Dependabot
249
249
  end
250
250
 
251
251
  def gitlab_client
252
- @gitlab_client ||= Dependabot::Clients::Gitlab.
252
+ @gitlab_client ||= Dependabot::Clients::GitlabWithRetries.
253
253
  for_gitlab_dot_com(credentials: credentials)
254
254
  end
255
255
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "dependabot/clients/github_with_retries"
4
- require "dependabot/clients/gitlab"
4
+ require "dependabot/clients/gitlab_with_retries"
5
5
  require "dependabot/metadata_finders/base"
6
6
  require "dependabot/utils"
7
7
 
@@ -241,7 +241,7 @@ module Dependabot
241
241
  end
242
242
 
243
243
  def gitlab_client
244
- @gitlab_client ||= Dependabot::Clients::Gitlab.
244
+ @gitlab_client ||= Dependabot::Clients::GitlabWithRetries.
245
245
  for_gitlab_dot_com(credentials: credentials)
246
246
  end
247
247
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dependabot/clients/gitlab"
3
+ require "dependabot/clients/gitlab_with_retries"
4
4
  require "dependabot/pull_request_creator"
5
5
  require "gitlab"
6
6
 
@@ -53,10 +53,11 @@ module Dependabot
53
53
  private
54
54
 
55
55
  def gitlab_client_for_source
56
- @gitlab_client_for_source ||= Dependabot::Clients::Gitlab.for_source(
57
- source: source,
58
- credentials: credentials
59
- )
56
+ @gitlab_client_for_source ||=
57
+ Dependabot::Clients::GitlabWithRetries.for_source(
58
+ source: source,
59
+ credentials: credentials
60
+ )
60
61
  end
61
62
 
62
63
  def branch_exists?
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "pathname"
4
4
  require "dependabot/clients/github_with_retries"
5
- require "dependabot/clients/gitlab"
5
+ require "dependabot/clients/gitlab_with_retries"
6
6
  require "dependabot/metadata_finders"
7
7
  require "dependabot/pull_request_creator"
8
8
 
@@ -899,10 +899,11 @@ module Dependabot
899
899
  end
900
900
 
901
901
  def gitlab_client_for_source
902
- @gitlab_client_for_source ||= Dependabot::Clients::Gitlab.for_source(
903
- source: source,
904
- credentials: credentials
905
- )
902
+ @gitlab_client_for_source ||=
903
+ Dependabot::Clients::GitlabWithRetries.for_source(
904
+ source: source,
905
+ credentials: credentials
906
+ )
906
907
  end
907
908
 
908
909
  def package_manager
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dependabot
4
- VERSION = "0.95.69"
4
+ VERSION = "0.95.70"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.95.69
4
+ version: 0.95.70
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-25 00:00:00.000000000 Z
11
+ date: 2019-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-ecr
@@ -313,7 +313,7 @@ files:
313
313
  - lib/dependabot.rb
314
314
  - lib/dependabot/clients/bitbucket.rb
315
315
  - lib/dependabot/clients/github_with_retries.rb
316
- - lib/dependabot/clients/gitlab.rb
316
+ - lib/dependabot/clients/gitlab_with_retries.rb
317
317
  - lib/dependabot/dependency.rb
318
318
  - lib/dependabot/dependency_file.rb
319
319
  - lib/dependabot/errors.rb