dependabot-common 0.112.37 → 0.113.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/clients/codecommit.rb +198 -0
- data/lib/dependabot/file_fetchers/base.rb +31 -1
- data/lib/dependabot/pull_request_creator.rb +18 -0
- data/lib/dependabot/pull_request_creator/codecommit.rb +144 -0
- data/lib/dependabot/pull_request_creator/message_builder.rb +2 -1
- data/lib/dependabot/pull_request_creator/pr_name_prefixer.rb +32 -0
- data/lib/dependabot/source.rb +7 -1
- data/lib/dependabot/version.rb +1 -1
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7eb561f6b9db3dd211d0bc3460c1c96d278e186bd25faf76e57c98c22cff608c
|
4
|
+
data.tar.gz: 8373d8b75739267c3192095c2192a9ec331a7d72cce22d75c49b6ff868400c64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 797bc0341528f81dd672acf0610ba66e8322469d533648c7542158a9a9a0691180730a2198abc26a9bb94c4c6b45e1f5bb0dd36d5c3cda1f42df678efae2fdae
|
7
|
+
data.tar.gz: f958d9ba00f410b9354d7ca4f69df0ca4bd8e184e691e2082e77e1a265d14b4709e154c6c761a4a9cd0f0090f9632a93ee701b48dabcf6e8431725310eb715bf
|
@@ -0,0 +1,198 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dependabot/shared_helpers"
|
4
|
+
|
5
|
+
module Dependabot
|
6
|
+
module Clients
|
7
|
+
class CodeCommit
|
8
|
+
class NotFound < StandardError; end
|
9
|
+
|
10
|
+
#######################
|
11
|
+
# Constructor methods #
|
12
|
+
#######################
|
13
|
+
|
14
|
+
def self.for_source(source:, credentials:)
|
15
|
+
credential =
|
16
|
+
credentials.
|
17
|
+
select { |cred| cred["type"] == "git_source" }.
|
18
|
+
find { |cred| cred["region"] == source.hostname }
|
19
|
+
|
20
|
+
new(source, credential)
|
21
|
+
end
|
22
|
+
|
23
|
+
##########
|
24
|
+
# Client #
|
25
|
+
##########
|
26
|
+
|
27
|
+
def initialize(source, credentials)
|
28
|
+
@source = source
|
29
|
+
@cc_client = Aws::CodeCommit::Client.new(
|
30
|
+
access_key_id: credentials&.fetch("username"),
|
31
|
+
secret_access_key: credentials&.fetch("password"),
|
32
|
+
region: credentials&.fetch("region")
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
def fetch_commit(repo, branch)
|
37
|
+
cc_client.get_branch(
|
38
|
+
branch_name: branch,
|
39
|
+
repository_name: repo
|
40
|
+
).branch.commit_id
|
41
|
+
end
|
42
|
+
|
43
|
+
def fetch_default_branch(repo)
|
44
|
+
cc_client.get_repository(
|
45
|
+
repository_name: repo
|
46
|
+
).repository_metadata.default_branch
|
47
|
+
end
|
48
|
+
|
49
|
+
def fetch_repo_contents(repo, commit = nil, path = nil)
|
50
|
+
actual_path = path
|
51
|
+
actual_path = "/" if path.to_s.empty?
|
52
|
+
|
53
|
+
cc_client.get_folder(
|
54
|
+
repository_name: repo,
|
55
|
+
commit_specifier: commit,
|
56
|
+
folder_path: actual_path
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
def fetch_file_contents(repo, commit, path)
|
61
|
+
cc_client.get_file(
|
62
|
+
repository_name: repo,
|
63
|
+
commit_specifier: commit,
|
64
|
+
file_path: path
|
65
|
+
).file_content
|
66
|
+
rescue Aws::CodeCommit::Errors::FileDoesNotExistException
|
67
|
+
raise NotFound
|
68
|
+
end
|
69
|
+
|
70
|
+
def branch(branch_name)
|
71
|
+
cc_client.get_branch(
|
72
|
+
repository_name: source.unscoped_repo,
|
73
|
+
branch_name: branch_name
|
74
|
+
)
|
75
|
+
end
|
76
|
+
|
77
|
+
# work around b/c codecommit doesn't have a 'get all commits' api..
|
78
|
+
def fetch_commits(repo, branch_name, result_count)
|
79
|
+
top_commit = fetch_commit(repo, branch_name)
|
80
|
+
retrieved_commits = []
|
81
|
+
pending_commits = []
|
82
|
+
|
83
|
+
# get the parent commit ids from the latest commit on the default branch
|
84
|
+
latest_commit = @cc_client.get_commit(
|
85
|
+
repository_name: repo,
|
86
|
+
commit_id: top_commit
|
87
|
+
)
|
88
|
+
|
89
|
+
# add the parent commit ids to the pending_commits array
|
90
|
+
pending_commits.push(*latest_commit.commit.parents)
|
91
|
+
|
92
|
+
# iterate over the array of pending commits and
|
93
|
+
# get each of the corresponding parent commits
|
94
|
+
until pending_commits.empty? || retrieved_commits.count > result_count
|
95
|
+
commit_id = pending_commits[0]
|
96
|
+
|
97
|
+
# get any parent commits from the provided commit
|
98
|
+
parent_commits = @cc_client.get_commit(
|
99
|
+
repository_name: repo,
|
100
|
+
commit_id: commit_id
|
101
|
+
)
|
102
|
+
|
103
|
+
# remove the previously retrieved_commits
|
104
|
+
# form the pending_commits array
|
105
|
+
pending_commits.delete(commit_id)
|
106
|
+
# add the commit id to the retrieved_commits array
|
107
|
+
retrieved_commits << commit_id
|
108
|
+
# add the retrieved parent commits to the pending_commits array
|
109
|
+
pending_commits.push(*parent_commits.commit.parents)
|
110
|
+
end
|
111
|
+
|
112
|
+
retrieved_commits << top_commit
|
113
|
+
result = retrieved_commits | pending_commits
|
114
|
+
result
|
115
|
+
end
|
116
|
+
|
117
|
+
def commits(repo, branch_name = source.branch)
|
118
|
+
retrieved_commits = fetch_commits(repo, branch_name, 5)
|
119
|
+
|
120
|
+
result = @cc_client.batch_get_commits(
|
121
|
+
commit_ids: retrieved_commits,
|
122
|
+
repository_name: repo
|
123
|
+
)
|
124
|
+
|
125
|
+
# sort the results by date
|
126
|
+
result.commits.sort! { |a, b| b.author.date <=> a.author.date }
|
127
|
+
result
|
128
|
+
end
|
129
|
+
|
130
|
+
def pull_requests(repo, state, branch)
|
131
|
+
pull_request_ids = @cc_client.list_pull_requests(
|
132
|
+
repository_name: repo,
|
133
|
+
pull_request_status: state
|
134
|
+
).pull_request_ids
|
135
|
+
|
136
|
+
result = []
|
137
|
+
# list_pull_requests only gets us the pull request id
|
138
|
+
# get_pull_request has all the info we need
|
139
|
+
pull_request_ids.each do |id|
|
140
|
+
pr_hash = @cc_client.get_pull_request(
|
141
|
+
pull_request_id: id
|
142
|
+
)
|
143
|
+
# only include PRs from the referenced branch
|
144
|
+
if pr_hash.pull_request.pull_request_targets[0].
|
145
|
+
source_reference.include? branch
|
146
|
+
result << pr_hash
|
147
|
+
end
|
148
|
+
end
|
149
|
+
result
|
150
|
+
end
|
151
|
+
|
152
|
+
def create_branch(repo, branch_name, commit_id)
|
153
|
+
cc_client.create_branch(
|
154
|
+
repository_name: repo,
|
155
|
+
branch_name: branch_name,
|
156
|
+
commit_id: commit_id
|
157
|
+
)
|
158
|
+
end
|
159
|
+
|
160
|
+
def create_commit(branch_name, author_name, base_commit, commit_message,
|
161
|
+
files)
|
162
|
+
cc_client.create_commit(
|
163
|
+
repository_name: source.unscoped_repo,
|
164
|
+
branch_name: branch_name,
|
165
|
+
parent_commit_id: base_commit,
|
166
|
+
author_name: author_name,
|
167
|
+
commit_message: commit_message,
|
168
|
+
put_files: files.map do |file|
|
169
|
+
{
|
170
|
+
file_path: file.path,
|
171
|
+
file_mode: "NORMAL",
|
172
|
+
file_content: file.content
|
173
|
+
}
|
174
|
+
end
|
175
|
+
)
|
176
|
+
end
|
177
|
+
|
178
|
+
def create_pull_request(pr_name, target_branch, source_branch,
|
179
|
+
pr_description)
|
180
|
+
cc_client.create_pull_request(
|
181
|
+
title: pr_name,
|
182
|
+
description: pr_description,
|
183
|
+
targets: [
|
184
|
+
repository_name: source.unscoped_repo,
|
185
|
+
source_reference: target_branch,
|
186
|
+
destination_reference: source_branch
|
187
|
+
]
|
188
|
+
)
|
189
|
+
end
|
190
|
+
|
191
|
+
private
|
192
|
+
|
193
|
+
attr_reader :credentials
|
194
|
+
attr_reader :source
|
195
|
+
attr_reader :cc_client
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
@@ -4,6 +4,7 @@ require "dependabot/dependency_file"
|
|
4
4
|
require "dependabot/source"
|
5
5
|
require "dependabot/errors"
|
6
6
|
require "dependabot/clients/azure"
|
7
|
+
require "dependabot/clients/codecommit"
|
7
8
|
require "dependabot/clients/github_with_retries"
|
8
9
|
require "dependabot/clients/bitbucket_with_retries"
|
9
10
|
require "dependabot/clients/gitlab_with_retries"
|
@@ -19,7 +20,8 @@ module Dependabot
|
|
19
20
|
Octokit::NotFound,
|
20
21
|
Gitlab::Error::NotFound,
|
21
22
|
Dependabot::Clients::Azure::NotFound,
|
22
|
-
Dependabot::Clients::Bitbucket::NotFound
|
23
|
+
Dependabot::Clients::Bitbucket::NotFound,
|
24
|
+
Dependabot::Clients::CodeCommit::NotFound
|
23
25
|
].freeze
|
24
26
|
|
25
27
|
def self.required_files_in?(_filename_array)
|
@@ -153,6 +155,8 @@ module Dependabot
|
|
153
155
|
_azure_repo_contents(path, commit)
|
154
156
|
when "bitbucket"
|
155
157
|
_bitbucket_repo_contents(repo, path, commit)
|
158
|
+
when "codecommit"
|
159
|
+
_codecommit_repo_contents(repo, path, commit)
|
156
160
|
else raise "Unsupported provider '#{provider}'."
|
157
161
|
end
|
158
162
|
end
|
@@ -263,6 +267,23 @@ module Dependabot
|
|
263
267
|
end
|
264
268
|
end
|
265
269
|
|
270
|
+
def _codecommit_repo_contents(repo, path, commit)
|
271
|
+
response = codecommit_client.fetch_repo_contents(
|
272
|
+
repo,
|
273
|
+
commit,
|
274
|
+
path
|
275
|
+
)
|
276
|
+
|
277
|
+
response.files.map do |file|
|
278
|
+
OpenStruct.new(
|
279
|
+
name: file.absolute_path,
|
280
|
+
path: file.absolute_path,
|
281
|
+
type: "file",
|
282
|
+
size: 0 # file size would require new api call per file..
|
283
|
+
)
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
266
287
|
def _full_specification_for(path, fetch_submodules:)
|
267
288
|
if fetch_submodules && _linked_dir_for(path)
|
268
289
|
linked_dir_details = @linked_paths[_linked_dir_for(path)]
|
@@ -319,6 +340,8 @@ module Dependabot
|
|
319
340
|
azure_client.fetch_file_contents(commit, path)
|
320
341
|
when "bitbucket"
|
321
342
|
bitbucket_client.fetch_file_contents(repo, commit, path)
|
343
|
+
when "codecommit"
|
344
|
+
codecommit_client.fetch_file_contents(repo, commit, path)
|
322
345
|
else raise "Unsupported provider '#{source.provider}'."
|
323
346
|
end
|
324
347
|
end
|
@@ -400,6 +423,7 @@ module Dependabot
|
|
400
423
|
when "gitlab" then gitlab_client
|
401
424
|
when "azure" then azure_client
|
402
425
|
when "bitbucket" then bitbucket_client
|
426
|
+
when "codecommit" then codecommit_client
|
403
427
|
else raise "Unsupported provider '#{source.provider}'."
|
404
428
|
end
|
405
429
|
end
|
@@ -433,6 +457,12 @@ module Dependabot
|
|
433
457
|
Dependabot::Clients::BitbucketWithRetries.
|
434
458
|
for_bitbucket_dot_org(credentials: credentials)
|
435
459
|
end
|
460
|
+
|
461
|
+
def codecommit_client
|
462
|
+
@codecommit_client ||=
|
463
|
+
Dependabot::Clients::CodeCommit.
|
464
|
+
for_source(source: source, credentials: credentials)
|
465
|
+
end
|
436
466
|
end
|
437
467
|
end
|
438
468
|
end
|
@@ -5,6 +5,7 @@ require "dependabot/metadata_finders"
|
|
5
5
|
module Dependabot
|
6
6
|
class PullRequestCreator
|
7
7
|
require "dependabot/pull_request_creator/azure"
|
8
|
+
require "dependabot/pull_request_creator/codecommit"
|
8
9
|
require "dependabot/pull_request_creator/github"
|
9
10
|
require "dependabot/pull_request_creator/gitlab"
|
10
11
|
require "dependabot/pull_request_creator/message_builder"
|
@@ -71,6 +72,7 @@ module Dependabot
|
|
71
72
|
when "github" then github_creator.create
|
72
73
|
when "gitlab" then gitlab_creator.create
|
73
74
|
when "azure" then azure_creator.create
|
75
|
+
when "codecommit" then codecommit_creator.create
|
74
76
|
else raise "Unsupported provider #{source.provider}"
|
75
77
|
end
|
76
78
|
end
|
@@ -143,6 +145,22 @@ module Dependabot
|
|
143
145
|
)
|
144
146
|
end
|
145
147
|
|
148
|
+
def codecommit_creator
|
149
|
+
Codecommit.new(
|
150
|
+
source: source,
|
151
|
+
branch_name: branch_namer.new_branch_name,
|
152
|
+
base_commit: base_commit,
|
153
|
+
credentials: credentials,
|
154
|
+
files: files,
|
155
|
+
commit_message: message_builder.commit_message,
|
156
|
+
pr_description: message_builder.pr_message,
|
157
|
+
pr_name: message_builder.pr_name,
|
158
|
+
author_details: author_details,
|
159
|
+
labeler: labeler,
|
160
|
+
require_up_to_date_base: require_up_to_date_base?
|
161
|
+
)
|
162
|
+
end
|
163
|
+
|
146
164
|
def message_builder
|
147
165
|
@message_builder ||
|
148
166
|
MessageBuilder.new(
|
@@ -0,0 +1,144 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dependabot/clients/codecommit"
|
4
|
+
require "dependabot/pull_request_creator"
|
5
|
+
|
6
|
+
module Dependabot
|
7
|
+
class PullRequestCreator
|
8
|
+
class Codecommit
|
9
|
+
attr_reader :source, :branch_name, :base_commit, :credentials,
|
10
|
+
:files, :commit_message, :pr_description, :pr_name,
|
11
|
+
:author_details, :labeler
|
12
|
+
|
13
|
+
def initialize(source:, branch_name:, base_commit:, credentials:,
|
14
|
+
files:, commit_message:, pr_description:, pr_name:,
|
15
|
+
author_details:, labeler:, require_up_to_date_base:)
|
16
|
+
@source = source
|
17
|
+
@branch_name = branch_name
|
18
|
+
@base_commit = base_commit
|
19
|
+
@credentials = credentials
|
20
|
+
@files = files
|
21
|
+
@commit_message = commit_message
|
22
|
+
@pr_description = pr_description
|
23
|
+
@pr_name = pr_name
|
24
|
+
@author_details = author_details
|
25
|
+
@labeler = labeler
|
26
|
+
@require_up_to_date_base = require_up_to_date_base
|
27
|
+
end
|
28
|
+
|
29
|
+
def create
|
30
|
+
return if branch_exists?(branch_name) && unmerged_pull_request_exists?
|
31
|
+
return if require_up_to_date_base? && !base_commit_is_up_to_date?
|
32
|
+
|
33
|
+
create_pull_request
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def require_up_to_date_base?
|
39
|
+
@require_up_to_date_base
|
40
|
+
end
|
41
|
+
|
42
|
+
def base_commit_is_up_to_date?
|
43
|
+
codecommit_client_for_source.fetch_commit(
|
44
|
+
source.repo,
|
45
|
+
branch_name
|
46
|
+
) == base_commit
|
47
|
+
end
|
48
|
+
|
49
|
+
def create_pull_request
|
50
|
+
branch = create_or_get_branch(base_commit)
|
51
|
+
return unless branch
|
52
|
+
|
53
|
+
pull_request = codecommit_client_for_source.create_pull_request(
|
54
|
+
pr_name,
|
55
|
+
branch_name,
|
56
|
+
source.branch || default_branch,
|
57
|
+
pr_description
|
58
|
+
# codecommit doesn't support PR lables
|
59
|
+
)
|
60
|
+
return unless pull_request
|
61
|
+
|
62
|
+
pull_request
|
63
|
+
end
|
64
|
+
|
65
|
+
def create_or_get_branch(commit)
|
66
|
+
# returns the branch name
|
67
|
+
if branch_exists?(branch_name)
|
68
|
+
branch_name
|
69
|
+
else
|
70
|
+
create_branch(commit)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def create_branch(commit)
|
75
|
+
# codecommit returns an empty response on create branch success
|
76
|
+
codecommit_client_for_source.create_branch(source.repo, branch_name,
|
77
|
+
commit)
|
78
|
+
@branch_name = branch_name
|
79
|
+
branch_name
|
80
|
+
end
|
81
|
+
|
82
|
+
def codecommit_client_for_source
|
83
|
+
@codecommit_client_for_source ||=
|
84
|
+
Dependabot::Clients::CodeCommit.for_source(
|
85
|
+
source: source,
|
86
|
+
credentials: credentials
|
87
|
+
)
|
88
|
+
end
|
89
|
+
|
90
|
+
def branch_exists?(branch_name)
|
91
|
+
@branch_ref ||= codecommit_client_for_source.branch(branch_name)
|
92
|
+
rescue Aws::CodeCommit::Errors::BranchDoesNotExistException
|
93
|
+
false
|
94
|
+
end
|
95
|
+
|
96
|
+
def unmerged_pull_request_exists?
|
97
|
+
unmerged_prs = []
|
98
|
+
pull_requests_for_branch.each do |pr|
|
99
|
+
unless pr.pull_request.
|
100
|
+
pull_request_targets[0].merge_metadata.is_merged
|
101
|
+
unmerged_prs << pr
|
102
|
+
end
|
103
|
+
end
|
104
|
+
unmerged_prs.any?
|
105
|
+
end
|
106
|
+
|
107
|
+
def pull_requests_for_branch
|
108
|
+
@pull_requests_for_branch ||=
|
109
|
+
begin
|
110
|
+
open_prs = codecommit_client_for_source.pull_requests(
|
111
|
+
source.repo,
|
112
|
+
"open",
|
113
|
+
source.branch || default_branch
|
114
|
+
)
|
115
|
+
closed_prs = codecommit_client_for_source.pull_requests(
|
116
|
+
source.repo,
|
117
|
+
"closed",
|
118
|
+
source.branch || default_branch
|
119
|
+
)
|
120
|
+
|
121
|
+
[*open_prs, *closed_prs]
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def create_commit
|
126
|
+
author = author_details&.slice(:name, :email, :date)
|
127
|
+
author = nil unless author&.any?
|
128
|
+
|
129
|
+
codecommit_client_for_source.create_commit(
|
130
|
+
branch_name,
|
131
|
+
author,
|
132
|
+
base_commit,
|
133
|
+
commit_message,
|
134
|
+
files
|
135
|
+
)
|
136
|
+
end
|
137
|
+
|
138
|
+
def default_branch
|
139
|
+
@default_branch ||=
|
140
|
+
codecommit_client_for_source.fetch_default_branch(source.repo)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
@@ -424,7 +424,8 @@ module Dependabot
|
|
424
424
|
|
425
425
|
def build_details_tag(summary:, body:)
|
426
426
|
# Azure DevOps does not support <details> tag (https://developercommunity.visualstudio.com/content/problem/608769/add-support-for-in-markdown.html)
|
427
|
-
|
427
|
+
# CodeCommit does not support the <details> tag (no url available)
|
428
|
+
if source.provider == ("azure" || "codecommit")
|
428
429
|
"\n\##{summary}\n\n#{body}"
|
429
430
|
else
|
430
431
|
msg = "\n<details>\n<summary>#{summary}</summary>\n\n"
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "dependabot/clients/azure"
|
4
|
+
require "dependabot/clients/codecommit"
|
4
5
|
require "dependabot/clients/github_with_retries"
|
5
6
|
require "dependabot/clients/gitlab_with_retries"
|
6
7
|
require "dependabot/pull_request_creator"
|
@@ -279,6 +280,7 @@ module Dependabot
|
|
279
280
|
when "github" then recent_github_commit_messages
|
280
281
|
when "gitlab" then recent_gitlab_commit_messages
|
281
282
|
when "azure" then recent_azure_commit_messages
|
283
|
+
when "codecommit" then recent_codecommit_commit_messages
|
282
284
|
else raise "Unsupported provider: #{source.provider}"
|
283
285
|
end
|
284
286
|
end
|
@@ -321,12 +323,24 @@ module Dependabot
|
|
321
323
|
map(&:strip)
|
322
324
|
end
|
323
325
|
|
326
|
+
def recent_codecommit_commit_messages
|
327
|
+
@recent_codecommit_commit_messages ||=
|
328
|
+
codecommit_client_for_source.commits
|
329
|
+
@recent_codecommit_commit_messages.commits.
|
330
|
+
reject { |c| c.author.email == dependabot_email }.
|
331
|
+
reject { |c| c.message&.start_with?("Merge") }.
|
332
|
+
map(&:message).
|
333
|
+
compact.
|
334
|
+
map(&:strip)
|
335
|
+
end
|
336
|
+
|
324
337
|
def last_dependabot_commit_message
|
325
338
|
@last_dependabot_commit_message ||=
|
326
339
|
case source.provider
|
327
340
|
when "github" then last_github_dependabot_commit_message
|
328
341
|
when "gitlab" then last_gitlab_dependabot_commit_message
|
329
342
|
when "azure" then last_azure_dependabot_commit_message
|
343
|
+
when "codecommit" then last_codecommit_dependabot_commit_message
|
330
344
|
else raise "Unsupported provider: #{source.provider}"
|
331
345
|
end
|
332
346
|
end
|
@@ -367,6 +381,16 @@ module Dependabot
|
|
367
381
|
strip
|
368
382
|
end
|
369
383
|
|
384
|
+
def last_codecommit_dependabot_commit_message
|
385
|
+
@recent_codecommit_commit_messages ||=
|
386
|
+
codecommit_client_for_source.commits(source.repo)
|
387
|
+
|
388
|
+
@recent_codecommit_commit_messages.commits.
|
389
|
+
find { |c| c.author.email == dependabot_email }&.
|
390
|
+
message&.
|
391
|
+
strip
|
392
|
+
end
|
393
|
+
|
370
394
|
def github_client_for_source
|
371
395
|
@github_client_for_source ||=
|
372
396
|
Dependabot::Clients::GithubWithRetries.for_source(
|
@@ -391,6 +415,14 @@ module Dependabot
|
|
391
415
|
)
|
392
416
|
end
|
393
417
|
|
418
|
+
def codecommit_client_for_source
|
419
|
+
@codecommit_client_for_source ||=
|
420
|
+
Dependabot::Clients::CodeCommit.for_source(
|
421
|
+
source: source,
|
422
|
+
credentials: credentials
|
423
|
+
)
|
424
|
+
end
|
425
|
+
|
394
426
|
def package_manager
|
395
427
|
@package_manager ||= dependencies.first.package_manager
|
396
428
|
end
|
data/lib/dependabot/source.rb
CHANGED
@@ -54,7 +54,7 @@ module Dependabot
|
|
54
54
|
|
55
55
|
def initialize(provider:, repo:, directory: nil, branch: nil, hostname: nil,
|
56
56
|
api_endpoint: nil)
|
57
|
-
if hostname.nil? ^ api_endpoint.nil?
|
57
|
+
if (hostname.nil? ^ api_endpoint.nil?) && (provider != "codecommit")
|
58
58
|
msg = "Both hostname and api_endpoint must be specified if either "\
|
59
59
|
"are. Alternatively, both may be left blank to use the "\
|
60
60
|
"provider's defaults."
|
@@ -73,6 +73,7 @@ module Dependabot
|
|
73
73
|
"https://" + hostname + "/" + repo
|
74
74
|
end
|
75
75
|
|
76
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
76
77
|
def url_with_directory
|
77
78
|
return url if [nil, ".", "/"].include?(directory)
|
78
79
|
|
@@ -87,9 +88,12 @@ module Dependabot
|
|
87
88
|
url + "/" + path
|
88
89
|
when "azure"
|
89
90
|
url + "?path=#{directory}"
|
91
|
+
when "codecommit"
|
92
|
+
raise "The codecommit provider does not utilize URLs"
|
90
93
|
else raise "Unexpected repo provider '#{provider}'"
|
91
94
|
end
|
92
95
|
end
|
96
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
93
97
|
|
94
98
|
def organization
|
95
99
|
repo.split("/").first
|
@@ -116,6 +120,7 @@ module Dependabot
|
|
116
120
|
when "bitbucket" then "bitbucket.org"
|
117
121
|
when "gitlab" then "gitlab.com"
|
118
122
|
when "azure" then "dev.azure.com"
|
123
|
+
when "codecommit" then "us-east-1"
|
119
124
|
else raise "Unexpected provider '#{provider}'"
|
120
125
|
end
|
121
126
|
end
|
@@ -126,6 +131,7 @@ module Dependabot
|
|
126
131
|
when "bitbucket" then "https://api.bitbucket.org/2.0/"
|
127
132
|
when "gitlab" then "https://gitlab.com/api/v4"
|
128
133
|
when "azure" then "https://dev.azure.com/"
|
134
|
+
when "codecommit" then nil
|
129
135
|
else raise "Unexpected provider '#{provider}'"
|
130
136
|
end
|
131
137
|
end
|
data/lib/dependabot/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dependabot-common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.113.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dependabot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: aws-sdk-codecommit
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.28'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.28'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: aws-sdk-ecr
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -320,6 +334,7 @@ files:
|
|
320
334
|
- lib/dependabot/clients/azure.rb
|
321
335
|
- lib/dependabot/clients/bitbucket.rb
|
322
336
|
- lib/dependabot/clients/bitbucket_with_retries.rb
|
337
|
+
- lib/dependabot/clients/codecommit.rb
|
323
338
|
- lib/dependabot/clients/github_with_retries.rb
|
324
339
|
- lib/dependabot/clients/gitlab_with_retries.rb
|
325
340
|
- lib/dependabot/dependency.rb
|
@@ -347,6 +362,7 @@ files:
|
|
347
362
|
- lib/dependabot/pull_request_creator.rb
|
348
363
|
- lib/dependabot/pull_request_creator/azure.rb
|
349
364
|
- lib/dependabot/pull_request_creator/branch_namer.rb
|
365
|
+
- lib/dependabot/pull_request_creator/codecommit.rb
|
350
366
|
- lib/dependabot/pull_request_creator/commit_signer.rb
|
351
367
|
- lib/dependabot/pull_request_creator/github.rb
|
352
368
|
- lib/dependabot/pull_request_creator/gitlab.rb
|