fluxcd/flux2

flux bootstrap git won't accept scp-style URLs

judge-red opened this issue · 1 comments

Describe the bug

There are a number of ways in which SSH URLs can be formatted, one of them is in "scp-style": hostname:group/repo.git, sometimes also written as ssh://hostname:group/repo.git, although the latter isn't to spec.

Unfortunately, flux bootstrap git can handle neither of these.

$ flux bootstrap git --url="user@hostname:group/repo.git"
✗ parse "user@hostname:group/repo.git": first path segment in URL cannot contain colon
$ flux bootstrap git --url="ssh://user@hostname:group/repo.git"
✗ parse "ssh://user@hostname:group/repo.git": invalid port ":sck" after host

Meanwhile, git clone and (other) remote-modifying git commands work with both these urls. For reference, GitHub uses the former and GitLab the latter format, so they're both very established and all tools but Flux support them.

Steps to reproduce

  1. flux bootstrap git --url="<repo url in scp-style format>"

Expected behavior

Works like ssh urls in non-scp-style format

Screenshots and recordings

No response

OS / Distro

macos (arm)

Flux version

flux: v2.3.0

Flux check

► checking prerequisites
✔ Kubernetes 1.29.9 >=1.28.0-0
► checking version in cluster
✗ checking failed: customresourcedefinitions.apiextensions.k8s.io "gitrepositories.source.toolkit.fluxcd.io" not found
► checking controllers
✗ no controllers found in the 'flux-system' namespace with the label selector 'app.kubernetes.io/part-of=flux'
► checking crds
✗ no crds found with the label selector 'app.kubernetes.io/part-of=flux'
✗ check failed

Git provider

No response

Container Registry provider

No response

Additional context

From the git-clone manpage's git urls section:

An alternative scp-like syntax may also be used with the ssh protocol:
[<user>@]<host>:/<path-to-git-repo>

Code of Conduct

  • I agree to follow this project's Code of Conduct

I am running into this with Bitbucket Cloud. They also use the latter format.

Update: Just saw in their docs that Bitbucket Cloud also accepts the format ssh://git@bitbucket.org/<repo_owner>/<reponame>.git. Still it would be nice for flux bootstrap git or flux create secret git to allow the : as part of the url if it is non-numeric.