Skip to content

Convert git to https api endpoints #426

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Jan 21, 2022
Merged

Convert git to https api endpoints #426

merged 25 commits into from
Jan 21, 2022

Conversation

sarataha
Copy link
Member

Closes #401

@sarataha sarataha added the bug Something isn't working label Jan 13, 2022
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.1
// protoc-gen-go v1.26.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update buf and re-run cd cmd/clusters-service && make install to get the current versions of things!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌 Thank you 🙂

Copy link
Collaborator

@yiannistri yiannistri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor suggestions but overall this LGTM 🥇

@@ -159,6 +161,8 @@ message DeleteClustersPullRequestRequest {
string commit_message = 7;
// Credentials
Credential credentials = 8;
// The repo api url.
string repository_api_url = 9;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, why do we accept it in the request and also send it back in the response?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My mistake, I think we should receive it in request only and if supplied we should ignore creating scm client. Thank you very much for noticing 🙂

@@ -79,7 +83,12 @@ type CloneRepoToTempDirResponse struct {
// It returns the URL of the pull request.
func (s *GitProviderService) WriteFilesToBranchAndCreatePullRequest(ctx context.Context,
req WriteFilesToBranchAndCreatePullRequestRequest) (*WriteFilesToBranchAndCreatePullRequestResponse, error) {
repo, err := s.GetRepository(ctx, req.GitProvider, req.RepositoryURL)
apiEndpoint, err := getSCMClient(req.GitProvider, req.RepositoryURL)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you think about renaming apiEndpoint to something else since it's an object of *scm.Client?

Copy link
Member Author

@sarataha sarataha Jan 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me 👍

repo, err := s.GetRepository(ctx, req.GitProvider, req.RepositoryURL)
apiEndpoint, err := getSCMClient(req.GitProvider, req.RepositoryURL)
if err != nil {
return nil, fmt.Errorf("unable to get api endpoint: %w", err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly here, is it the endpoint or the client that we fail to retrieve?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right! It should be the client 👍

@sarataha sarataha requested a review from foot January 19, 2022 10:27
@@ -293,3 +301,22 @@ func getGitProviderClient(gpi GitProvider) (gitprovider.Client, error) {
}
return client, err
}

func getGitProviderUrl(giturl string) (string, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wicked! 🚀 , lets add a couple of tests w/ the diff variations

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure 👍

Sara El-Zayat added 2 commits January 19, 2022 20:38
Copy link
Collaborator

@foot foot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 ! Looks good to me!

@sarataha sarataha merged commit 150bdd5 into main Jan 21, 2022
@sarataha sarataha deleted the normalize-repo-url branch January 21, 2022 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

config.repoURL has to be https:// format
3 participants