dependabot-common 0.313.0 → 0.314.0
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 +4 -4
- data/lib/dependabot/git_commit_checker.rb +6 -1
- data/lib/dependabot/git_metadata_fetcher.rb +81 -0
- data/lib/dependabot/git_tag_with_detail.rb +45 -0
- data/lib/dependabot.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75665e6e5f16e2e104b7415ff2f557508d03f394e8f9de6a5f841f4352e1484e
|
4
|
+
data.tar.gz: 61f9095c642362351d1381f1f9d3f5a26c13d3b24fb1841046b3682c6a85aaa6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd09436156631884d91cd670497ca6d033ee4cb2927db598d0348f78af77f4d7bc1626ccd6ea36e051f900ad9b5ad4299f4c49e5cb4308a6203e99861c7cd458
|
7
|
+
data.tar.gz: f2a87eed835ec64c46769dadae2ec093fc8d6b9c8a004c40d3c65ed55a824ebdd2a402165d640d83dad757a0d34473f3b92d92d8ffd1aa99a2af0d734af9fdff
|
@@ -2,8 +2,8 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require "excon"
|
5
|
-
require "gitlab"
|
6
5
|
require "sorbet-runtime"
|
6
|
+
require "gitlab"
|
7
7
|
require "dependabot/clients/github_with_retries"
|
8
8
|
require "dependabot/clients/gitlab_with_retries"
|
9
9
|
require "dependabot/clients/bitbucket_with_retries"
|
@@ -220,6 +220,11 @@ module Dependabot
|
|
220
220
|
@dependency_source_details || dependency.source_details(allowed_types: ["git"])
|
221
221
|
end
|
222
222
|
|
223
|
+
sig { returns(T::Array[Dependabot::GitTagWithDetail]) }
|
224
|
+
def refs_for_tag_with_detail
|
225
|
+
local_repo_git_metadata_fetcher.refs_for_tag_with_detail
|
226
|
+
end
|
227
|
+
|
223
228
|
sig { params(commit_sha: T.nilable(String)).returns(T.nilable(String)) }
|
224
229
|
def most_specific_version_tag_for_sha(commit_sha)
|
225
230
|
tags = local_tags.select { |t| t.commit_sha == commit_sha && version_class.correct?(t.name) }
|
@@ -7,6 +7,7 @@ require "sorbet-runtime"
|
|
7
7
|
|
8
8
|
require "dependabot/errors"
|
9
9
|
require "dependabot/git_ref"
|
10
|
+
require "dependabot/git_tag_with_detail"
|
10
11
|
require "dependabot/credential"
|
11
12
|
|
12
13
|
module Dependabot
|
@@ -93,6 +94,29 @@ module Dependabot
|
|
93
94
|
&.commit_sha
|
94
95
|
end
|
95
96
|
|
97
|
+
sig { returns(T::Array[GitTagWithDetail]) }
|
98
|
+
def refs_for_tag_with_detail
|
99
|
+
@refs_for_tag_with_detail ||= T.let(parse_refs_for_tag_with_detail,
|
100
|
+
T.nilable(T::Array[GitTagWithDetail]))
|
101
|
+
end
|
102
|
+
|
103
|
+
sig { returns(T::Array[GitTagWithDetail]) }
|
104
|
+
def parse_refs_for_tag_with_detail
|
105
|
+
result_lines = []
|
106
|
+
return result_lines if upload_tag_with_detail.nil?
|
107
|
+
|
108
|
+
T.must(upload_tag_with_detail).lines.each do |line|
|
109
|
+
tag, detail = line.split(/\s+/, 2)
|
110
|
+
next unless tag && detail
|
111
|
+
|
112
|
+
result_lines << GitTagWithDetail.new(
|
113
|
+
tag: tag.strip,
|
114
|
+
release_date: detail.strip
|
115
|
+
)
|
116
|
+
end
|
117
|
+
result_lines
|
118
|
+
end
|
119
|
+
|
96
120
|
private
|
97
121
|
|
98
122
|
sig { returns(String) }
|
@@ -260,5 +284,62 @@ module Dependabot
|
|
260
284
|
# Some git hosts are slow when returning a large number of tags
|
261
285
|
SharedHelpers.excon_defaults(read_timeout: 20)
|
262
286
|
end
|
287
|
+
|
288
|
+
sig { returns(T.nilable(String)) }
|
289
|
+
def upload_tag_with_detail
|
290
|
+
@upload_tag_detail ||= T.let(fetch_tags_with_detail(url), T.nilable(String))
|
291
|
+
rescue Octokit::ClientError
|
292
|
+
raise Dependabot::GitDependenciesNotReachable, [url]
|
293
|
+
end
|
294
|
+
|
295
|
+
sig { params(uri: String).returns(String) }
|
296
|
+
def fetch_tags_with_detail(uri)
|
297
|
+
response = fetch_raw_upload_pack_for(uri)
|
298
|
+
return response.body if response.status == 200
|
299
|
+
|
300
|
+
response_with_git = fetch_tags_with_detail_from_git_for(uri)
|
301
|
+
return response_with_git.body if response_with_git.status == 200
|
302
|
+
|
303
|
+
raise Dependabot::GitDependenciesNotReachable, [uri] unless uri.match?(KNOWN_HOSTS)
|
304
|
+
|
305
|
+
raise "Unexpected response: #{response.status} - #{response.body}" if response.status < 400
|
306
|
+
|
307
|
+
if uri.match?(/github\.com/i)
|
308
|
+
response = response.data
|
309
|
+
response[:response_headers] = response[:headers]
|
310
|
+
raise Octokit::Error.from_response(response)
|
311
|
+
end
|
312
|
+
|
313
|
+
raise "Server error at #{uri}: #{response.body}" if response.status >= 500
|
314
|
+
|
315
|
+
raise Dependabot::GitDependenciesNotReachable, [uri]
|
316
|
+
rescue Excon::Error::Socket, Excon::Error::Timeout
|
317
|
+
raise if uri.match?(KNOWN_HOSTS)
|
318
|
+
|
319
|
+
raise Dependabot::GitDependenciesNotReachable, [uri]
|
320
|
+
end
|
321
|
+
|
322
|
+
sig { params(uri: String).returns(T.untyped) }
|
323
|
+
def fetch_tags_with_detail_from_git_for(uri)
|
324
|
+
complete_uri = uri
|
325
|
+
complete_uri += ".git" unless complete_uri.end_with?(".git") || skip_git_suffix(uri)
|
326
|
+
|
327
|
+
env = { "PATH" => ENV.fetch("PATH", nil), "GIT_TERMINAL_PROMPT" => "0" }
|
328
|
+
command = "git for-each-ref --format=\"%(refname:short) %(creatordate:short)\" refs/tags #{complete_uri}"
|
329
|
+
command = SharedHelpers.escape_command(command)
|
330
|
+
|
331
|
+
begin
|
332
|
+
stdout, stderr, process = Open3.capture3(env, command)
|
333
|
+
# package the command response like a HTTP response so error handling remains unchanged
|
334
|
+
rescue Errno::ENOENT => e # thrown when `git` isn't installed...
|
335
|
+
OpenStruct.new(body: e.message, status: 500)
|
336
|
+
else
|
337
|
+
if process.success?
|
338
|
+
OpenStruct.new(body: stdout, status: 200)
|
339
|
+
else
|
340
|
+
OpenStruct.new(body: stderr, status: 500)
|
341
|
+
end
|
342
|
+
end
|
343
|
+
end
|
263
344
|
end
|
264
345
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# typed: strong
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "sorbet-runtime"
|
5
|
+
|
6
|
+
module Dependabot
|
7
|
+
class GitTagWithDetail
|
8
|
+
extend T::Sig
|
9
|
+
|
10
|
+
sig { returns(String) }
|
11
|
+
attr_accessor :tag
|
12
|
+
|
13
|
+
sig { returns(String) }
|
14
|
+
attr_accessor :release_date
|
15
|
+
|
16
|
+
sig do
|
17
|
+
params(
|
18
|
+
tag: String,
|
19
|
+
release_date: String
|
20
|
+
).void
|
21
|
+
end
|
22
|
+
def initialize(tag:, release_date:)
|
23
|
+
@tag = tag
|
24
|
+
@release_date = release_date
|
25
|
+
end
|
26
|
+
|
27
|
+
sig { params(other: BasicObject).returns(T::Boolean) }
|
28
|
+
def ==(other)
|
29
|
+
case other
|
30
|
+
when GitTagWithDetail
|
31
|
+
to_h == other.to_h
|
32
|
+
else
|
33
|
+
false
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
sig { returns(T::Hash[Symbol, T.nilable(String)]) }
|
38
|
+
def to_h
|
39
|
+
{
|
40
|
+
tag: tag,
|
41
|
+
release_date: release_date
|
42
|
+
}.compact
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/lib/dependabot.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dependabot-common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.314.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dependabot
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-05-
|
10
|
+
date: 2025-05-22 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: aws-sdk-codecommit
|
@@ -548,6 +548,7 @@ files:
|
|
548
548
|
- lib/dependabot/git_commit_checker.rb
|
549
549
|
- lib/dependabot/git_metadata_fetcher.rb
|
550
550
|
- lib/dependabot/git_ref.rb
|
551
|
+
- lib/dependabot/git_tag_with_detail.rb
|
551
552
|
- lib/dependabot/logger.rb
|
552
553
|
- lib/dependabot/metadata_finders.rb
|
553
554
|
- lib/dependabot/metadata_finders/README.md
|
@@ -609,7 +610,7 @@ licenses:
|
|
609
610
|
- MIT
|
610
611
|
metadata:
|
611
612
|
bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
|
612
|
-
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.
|
613
|
+
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.314.0
|
613
614
|
rdoc_options: []
|
614
615
|
require_paths:
|
615
616
|
- lib
|