Skip to content
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

Convert SSH clone urls to HTTPS #358

Merged
merged 18 commits into from
Jun 12, 2023
Merged

Conversation

EyalDelarea
Copy link
Contributor

@EyalDelarea EyalDelarea commented Jun 11, 2023

  • All tests passed. If this feature is not already covered by the tests, I added new tests.
  • This pull request is on the dev branch.
  • I used gofmt for formatting the code before submitting the pull request.

Certain Git repos remote urls are defined as SSH.
Frogbot uses JF_GIT_ACCESS token with sufficient permissions so we don't need to add other auth method, just to replace the remote urls from SSH to HTTPS.

@EyalDelarea EyalDelarea added the improvement Automatically generated release notes label Jun 11, 2023
@EyalDelarea EyalDelarea added the safe to test Approve running integration tests on a pull request label Jun 11, 2023
@EyalDelarea EyalDelarea requested a review from eyalbe4 June 11, 2023 14:03
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Jun 11, 2023
@EyalDelarea EyalDelarea added the safe to test Approve running integration tests on a pull request label Jun 11, 2023
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Jun 11, 2023
@EyalDelarea EyalDelarea added the safe to test Approve running integration tests on a pull request label Jun 11, 2023
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Jun 11, 2023
@EyalDelarea EyalDelarea added the safe to test Approve running integration tests on a pull request label Jun 12, 2023
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Jun 12, 2023
@github-actions
Copy link
Contributor

What is Frogbot?

// Endpoint should empty for default values or start with https scheme.
func verifyValidApiEndpoint(endpoint *string) error {
if *endpoint != "" && !strings.HasPrefix(*endpoint, "https://") {
return errors.New("missing api endpoint scheme")
Copy link
Member

Choose a reason for hiding this comment

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

You need to utilize ErrMissingEnv here. Returning a regular error will fail the process. Note that we don't want to fail on an empty ApiEndpoint because, in such cases, froggit-go automatically inserts the default API endpoint for each git provider.

commands/utils/params.go Outdated Show resolved Hide resolved
Comment on lines 360 to 374
func (gm *GitManager) generateHTTPSCloneUrl() (url string, err error) {
switch gm.git.GitProvider {
case vcsutils.GitHub:
return fmt.Sprintf(githubHttpsFormat, gm.git.RepoOwner, gm.git.RepoName), nil
case vcsutils.GitLab:
return fmt.Sprintf(gitLabHttpsFormat, gm.git.GitProject, gm.git.RepoName), nil
case vcsutils.BitbucketServer:
return fmt.Sprintf(bitbucketServerHttpsFormat, gm.git.ApiEndpoint, gm.git.RepoOwner, gm.git.RepoName), nil
case vcsutils.AzureRepos:
return fmt.Sprintf(azureDevopsHttpsFormat, gm.git.RepoOwner, gm.git.RepoOwner, gm.git.GitProject, gm.git.RepoName), nil
default:
return "", fmt.Errorf("unsupported version control provider: %s", gm.git.GitProvider.String())
}
}

Copy link
Member

Choose a reason for hiding this comment

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

This would not work for on-premises. We need to support such cases based on the given ApiEndpoint. We can fallback to the cloud format if the ApiEndpoint is empty.

@EyalDelarea EyalDelarea requested a review from omerzi June 12, 2023 13:12
@EyalDelarea EyalDelarea added the safe to test Approve running integration tests on a pull request label Jun 12, 2023
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Jun 12, 2023
commands/utils/params.go Outdated Show resolved Hide resolved
commands/utils/params.go Outdated Show resolved Hide resolved
@EyalDelarea EyalDelarea added the safe to test Approve running integration tests on a pull request label Jun 12, 2023
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Jun 12, 2023
@EyalDelarea EyalDelarea temporarily deployed to frogbot June 12, 2023 13:30 — with GitHub Actions Inactive
@EyalDelarea EyalDelarea added the safe to test Approve running integration tests on a pull request label Jun 12, 2023
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Jun 12, 2023
@github-actions
Copy link
Contributor

What is Frogbot?

1 similar comment
@github-actions
Copy link
Contributor

What is Frogbot?

@EyalDelarea EyalDelarea merged commit 59f25e1 into jfrog:dev Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Automatically generated release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants