dependabot-common 0.196.3 → 0.196.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dependabot/registry_client.rb +55 -0
- data/lib/dependabot/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65a6aadb52a1ffeb970ec8aa0dc678042b7f8f3e9f17c9ee07903eddfc4e60ae
|
4
|
+
data.tar.gz: 6e0f03d4901b4cd3eac9938a223360be570e7074c1950ec4cfabfa7a227aefd3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bcd9a9fb225471bbbd316b3c1ab8f22be8a248cbba9bef03fca6dacc06ec99bad05f4b1fefa8b229abb91a8b72e8f264b1774f2698d432429fbd92d66e7d71b
|
7
|
+
data.tar.gz: 9a9aab3311523a0d164c27e04a5b6449046da108baa78a3908f0a3bd453c04c8704e2032d80fcf4dfa37574589510127ee165dede202f8f35fbf3d5f8ee1f0bf
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dependabot/shared_helpers"
|
4
|
+
|
5
|
+
# This class provides a thin wrapper around our normal usage of Excon as a simple HTTP client in order to
|
6
|
+
# provide some minor caching functionality.
|
7
|
+
#
|
8
|
+
# This is not used to support full response caching currently, we just use it to ensure we detect unreachable
|
9
|
+
# hosts and fast-fail on any subsequent requests to them to avoid excessive use of retries and connect- or
|
10
|
+
# read-timeouts as some jobs tend to be sensitive to exceeding our overall 45 minute timeout.
|
11
|
+
module Dependabot
|
12
|
+
class RegistryClient
|
13
|
+
@cached_errors = {}
|
14
|
+
|
15
|
+
def self.get(url:, headers: {}, options: {})
|
16
|
+
raise cached_error_for(url) if cached_error_for(url)
|
17
|
+
|
18
|
+
Excon.get(
|
19
|
+
url,
|
20
|
+
idempotent: true,
|
21
|
+
**SharedHelpers.excon_defaults({ headers: headers }.merge(options))
|
22
|
+
)
|
23
|
+
rescue Excon::Error::Timeout => e
|
24
|
+
cache_error(url, e)
|
25
|
+
raise e
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.head(url:, headers: {}, options: {})
|
29
|
+
raise cached_error_for(url) if cached_error_for(url)
|
30
|
+
|
31
|
+
Excon.head(
|
32
|
+
url,
|
33
|
+
idempotent: true,
|
34
|
+
**SharedHelpers.excon_defaults({ headers: headers }.merge(options))
|
35
|
+
)
|
36
|
+
rescue Excon::Error::Timeout => e
|
37
|
+
cache_error(url, e)
|
38
|
+
raise e
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.clear_cache!
|
42
|
+
@cached_errors = {}
|
43
|
+
end
|
44
|
+
|
45
|
+
private_class_method def self.cache_error(url, error)
|
46
|
+
host = URI(url).host
|
47
|
+
@cached_errors[host] = error
|
48
|
+
end
|
49
|
+
|
50
|
+
private_class_method def self.cached_error_for(url)
|
51
|
+
host = URI(url).host
|
52
|
+
@cached_errors.fetch(host, nil)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/dependabot/version.rb
CHANGED
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.196.
|
4
|
+
version: 0.196.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dependabot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-07-
|
11
|
+
date: 2022-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -482,6 +482,7 @@ files:
|
|
482
482
|
- lib/dependabot/pull_request_updater/azure.rb
|
483
483
|
- lib/dependabot/pull_request_updater/github.rb
|
484
484
|
- lib/dependabot/pull_request_updater/gitlab.rb
|
485
|
+
- lib/dependabot/registry_client.rb
|
485
486
|
- lib/dependabot/security_advisory.rb
|
486
487
|
- lib/dependabot/shared_helpers.rb
|
487
488
|
- lib/dependabot/source.rb
|