Skip to content

Commit

Permalink
Use source api endpoint in gitlab client for using self host gitlab
Browse files Browse the repository at this point in the history
  • Loading branch information
codisart committed Jun 27, 2018
1 parent 7c9aae0 commit f24c3d9
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions lib/dependabot/file_fetchers/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def directory
source.directory || "/"
end


def files
@files ||= fetch_files
end
Expand Down Expand Up @@ -209,12 +210,12 @@ def gitlab_client
access_token =
credentials.
select { |cred| cred["type"] == "git_source" }.
find { |cred| cred["host"] == "gitlab.com" }&.
find { |cred| cred["host"] == source.hostname }&.
fetch("password")

@gitlab_client ||=
Gitlab.client(
endpoint: "https://gitlab.com/api/v4",
endpoint: source.api_endpoint,
private_token: access_token || ""
)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/dependabot/metadata_finders/base/changelog_finder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ def gitlab_client

@gitlab_client ||=
Gitlab.client(
endpoint: "https://gitlab.com/api/v4",
endpoint: source.api_endpoint,
private_token: access_token || ""
)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/dependabot/metadata_finders/base/commits_finder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def gitlab_client

@gitlab_client ||=
Gitlab.client(
endpoint: "https://gitlab.com/api/v4",
endpoint: source.api_endpoint,
private_token: access_token || ""
)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/dependabot/metadata_finders/base/release_finder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def gitlab_client

@gitlab_client ||=
Gitlab.client(
endpoint: "https://gitlab.com/api/v4",
endpoint: source.api_endpoint,
private_token: access_token || ""
)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/dependabot/pull_request_creator/gitlab.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def gitlab_client_for_source

@gitlab_client_for_source ||=
::Gitlab.client(
endpoint: "https://gitlab.com/api/v4",
endpoint: source.api_endpoint,
private_token: access_token || ""
)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/dependabot/pull_request_creator/message_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ def gitlab_client_for_source

@gitlab_client_for_source ||=
::Gitlab.client(
endpoint: "https://gitlab.com/api/v4",
endpoint: source.api_endpoint,
private_token: access_token || ""
)
end
Expand Down

0 comments on commit f24c3d9

Please sign in to comment.