weaveworks/weave-gitops-enterprise

flux bootstrap with ssh without scheme urls

enekofb opened this issue · 2 comments

Scenario: ssh url withthout scheme
Given a user bootstrap with ssh using URL without scheme like git@github.com/enekofb/cli-dev

Scenario: ssh url with colon
Given a user bootstrap with ssh with colon git@github.com:enekofb/cli-dev.git

Screenshot 2023-11-21 at 18 10 02

When i execute bootstrapping
Then i expect to have bootstrapped using ssh

However got the following errors (for example colon)

◎ flux repository configuration
please enter your flux git https or ssh repository url: git@github.com/enekofb/cli-dev
please enter your flux git repository branch (default: main): main
please enter your flux path for your cluster (default: clusters/my-cluster): clusters/my-cluster
Error: cannot execute bootstrap: cannot execute 'flux repository configuration': incorrect repository url git@github.com/enekofb/cli-dev.git:parse "git@github.com/enekofb/cli-dev.git": first path segment in URL cannot contain colon

The error is also consistent with flux bootstrap

➜  weave-gitops-enterprise git:(wge-3659-validation-ssh) ✗ flux bootstrap git -s --url=git@github.com:enekofb/cli-dev.git --private-key-file=abc --password="" --path=clusters/management
✗ parse "git@github.com:enekofb/cli-dev.git": first path segment in URL cannot contain colon

➜  weave-gitops-enterprise git:(wge-3659-validation-ssh) ✗ flux bootstrap git -s --url=git@github.com/enekofb/cli-dev.git --private-key-file=abc --password="" --path=clusters/management
✗ failed to create authentication options for git@github.com/enekofb/cli-dev.git: scheme "" is not supported

AC

This ticket to:

  • Understand whether we need to support this scenario in bootstrapping and transform the urls
  • Fix it in case yes,
  • Otherwise:
    • ensure that validation of the repo URL happens showing correct messages
    • update docs to reflect it

ensure that validation of the repo URL happens with a better message than now

added in the #3664

extending support for ssh urls cause part of

github: git@github.com:weaveworks/weave-gitops-private.git
gitlab: git@gitlab.com:gitlab-org/gitlab-foss.git
gitbook: https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols