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

fix(cdsctl): workflow init #6728

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions cli/cdsctl/workflow_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,14 @@ func interactiveChooseVCSServer(proj *sdk.Project, gitRepo repo.Repo) (string, e
if !strings.HasPrefix(fetchURL, "https://") && !strings.HasPrefix(fetchURL, "ssh://") {
return "", cli.NewError("Unable to parse remote URL %v", fetchURL)
}
originHost := strings.TrimSpace(strings.SplitN(fetchURL, ":", 2)[0])

// example: ssh://[email protected]:7999/foo/bar.git
// originHost is foo.bar.net
fetchURLParsed, err := url.Parse(fetchURL)
if err != nil {
return "", cli.NewError("Unable to parse remote URL %v", fetchURL)
}
originHost := fetchURLParsed.Hostname()

vcsConf, err := client.VCSConfiguration()
if err != nil {
Expand All @@ -123,7 +130,7 @@ func interactiveChooseVCSServer(proj *sdk.Project, gitRepo repo.Repo) (string, e
if err != nil {
return "", cli.WrapError(err, "Unable to get VCS Configuration")
}
rmHost := strings.TrimSpace(strings.SplitN(rmURL.Host, ":", 2)[0])
rmHost := rmURL.Hostname()
if originHost == rmHost {
fmt.Printf(" * using repositories manager %s (%s)", cli.Magenta(rmName), cli.Magenta(rmURL.String()))
fmt.Println()
Expand Down