buildkit icon indicating copy to clipboard operation
buildkit copied to clipboard

git: allow scp-style urls without username

Open jedevc opened this issue 1 year ago • 0 comments

According to the git docs:

Or you can use the shorter scp-like syntax for the SSH protocol:

git clone [user@]server:project.git

(note that in practice, the .git suffix is not generally necessary).

Previously, we were doing this potentially wrong - we were requiring the presence of a username for all scp-style URLs. This could result in disparity from the git CLI which successfully manages to parse github.com:moby/buildkit.git (though cloning will generally fail, with an ambiguous username).

However, we aim keep the behavior of git ref as before - this is because making changes to this can effect the parsing of dockerfiles: where before "foo:bar" would be detected as a local source, after, it would be detected as a git repo (despite the fact it correctly parses as one). To avoid this, we simply keep this behavior as before.

[!NOTE]

This isn't a regression thankfully - this was the behavior defined in the tests in https://github.com/moby/buildkit/pull/1901.

jedevc avatar Sep 02 '24 13:09 jedevc