From 88568bfe224fac9758958c902d1da0bfb3b7a01a Mon Sep 17 00:00:00 2001 From: Jan Rose Date: Fri, 10 Jul 2026 09:36:37 +0200 Subject: [PATCH 1/6] Recognize ssh:// template URLs in bundle init gitUrlPrefixes was incomplete relative to the git URL spec (https://git-scm.com/docs/git-clone#_git_urls). Add ssh:// so that `databricks bundle init` clones from SSH-transport URLs. Also rename IsRepoUrl to IsGitRepoUrl and simplify it to return directly on match. Fixes #5881 Co-authored-by: Isaac --- NEXT_CHANGELOG.md | 1 + libs/template/resolver.go | 14 ++++++++------ libs/template/resolver_test.go | 21 +++++++++++++++------ 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/NEXT_CHANGELOG.md b/NEXT_CHANGELOG.md index 0f71834ff56..f6588289dac 100644 --- a/NEXT_CHANGELOG.md +++ b/NEXT_CHANGELOG.md @@ -5,6 +5,7 @@ ### Notable Changes ### CLI +* Recognize `ssh://` template URLs in `databricks bundle init` ([#5881](https://github.com/databricks/cli/issues/5881)). ### Bundles diff --git a/libs/template/resolver.go b/libs/template/resolver.go index b5a2fa8d881..f7ca1f9c829 100644 --- a/libs/template/resolver.go +++ b/libs/template/resolver.go @@ -8,20 +8,22 @@ import ( "github.com/databricks/cli/libs/git" ) +// See https://git-scm.com/docs/git-clone#_git_urls for the set of supported +// Git URL forms. We deliberately exclude deprecated/insecure protocols (git, http, ftp[s]). var gitUrlPrefixes = []string{ "https://", + "ssh://", + // recognize git@ without ssh:// protocol because this is very common "git@", } -func IsRepoUrl(url string) bool { - result := false +func IsGitRepoUrl(url string) bool { for _, prefix := range gitUrlPrefixes { if strings.HasPrefix(url, prefix) { - result = true - break + return true } } - return result + return false } // ResolveReader resolves a template path/URL to a Reader (built-in, git or local) @@ -30,7 +32,7 @@ func ResolveReader(templatePathOrUrl, templateDir, ref string) (Reader, bool) { return tmpl.Reader, false } - if IsRepoUrl(templatePathOrUrl) { + if IsGitRepoUrl(templatePathOrUrl) { return NewGitReader(templatePathOrUrl, ref, templateDir, git.Clone), true } diff --git a/libs/template/resolver_test.go b/libs/template/resolver_test.go index 2174fe1afe9..c72079b267b 100644 --- a/libs/template/resolver_test.go +++ b/libs/template/resolver_test.go @@ -100,12 +100,21 @@ func TestTemplateResolverForCustomPath(t *testing.T) { assert.Equal(t, "/config/file", tmpl.Writer.(*defaultWriter).configPath) } -func TestBundleInitIsRepoUrl(t *testing.T) { - assert.True(t, IsRepoUrl("git@github.com:databricks/cli.git")) - assert.True(t, IsRepoUrl("https://github.com/databricks/cli.git")) - - assert.False(t, IsRepoUrl("./local")) - assert.False(t, IsRepoUrl("foo")) +func TestBundleInitIsGitRepoUrl(t *testing.T) { + // Supported + assert.True(t, IsGitRepoUrl("git@github.com:databricks/cli.git")) + assert.True(t, IsGitRepoUrl("https://github.com/databricks/cli.git")) + assert.True(t, IsGitRepoUrl("ssh://git@github.com/databricks/cli.git")) + + // Unsupported + assert.False(t, IsGitRepoUrl("git://github.com/databricks/cli.git")) + assert.False(t, IsGitRepoUrl("http://github.com/databricks/cli.git")) + assert.False(t, IsGitRepoUrl("ftp://github.com/databricks/cli.git")) + assert.False(t, IsGitRepoUrl("ftps://github.com/databricks/cli.git")) + + // Not git repos + assert.False(t, IsGitRepoUrl("./local")) + assert.False(t, IsGitRepoUrl("foo")) } func TestResolveReader(t *testing.T) { From 885abe9fa88853b5ea79a22750538b59ae98f482 Mon Sep 17 00:00:00 2001 From: Jan Rose Date: Fri, 10 Jul 2026 09:37:30 +0200 Subject: [PATCH 2/6] Reference PR instead of issue in changelog entry Co-authored-by: Isaac --- NEXT_CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEXT_CHANGELOG.md b/NEXT_CHANGELOG.md index f6588289dac..bd2aee56c46 100644 --- a/NEXT_CHANGELOG.md +++ b/NEXT_CHANGELOG.md @@ -5,7 +5,7 @@ ### Notable Changes ### CLI -* Recognize `ssh://` template URLs in `databricks bundle init` ([#5881](https://github.com/databricks/cli/issues/5881)). +* Recognize `ssh://` template URLs in `databricks bundle init` ([#5891](https://github.com/databricks/cli/pull/5891)). ### Bundles From da6bdb9535543b3b62150989b4aaaa25c0a61d40 Mon Sep 17 00:00:00 2001 From: Jan Rose Date: Fri, 10 Jul 2026 09:42:49 +0200 Subject: [PATCH 3/6] Add test case for bare host path without scheme Co-authored-by: Isaac --- libs/template/resolver_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/template/resolver_test.go b/libs/template/resolver_test.go index c72079b267b..df3e3768525 100644 --- a/libs/template/resolver_test.go +++ b/libs/template/resolver_test.go @@ -115,6 +115,7 @@ func TestBundleInitIsGitRepoUrl(t *testing.T) { // Not git repos assert.False(t, IsGitRepoUrl("./local")) assert.False(t, IsGitRepoUrl("foo")) + assert.False(t, IsGitRepoUrl("github.com/databricks/cli.git")) } func TestResolveReader(t *testing.T) { From a09fed73e2c38897bd9e5d6cd2aecfe7ff3b4fa1 Mon Sep 17 00:00:00 2001 From: Jan Rose Date: Fri, 10 Jul 2026 09:46:13 +0200 Subject: [PATCH 4/6] Use test case that's not git@ prefixed SSH URL --- libs/template/resolver_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/template/resolver_test.go b/libs/template/resolver_test.go index df3e3768525..12de32ab963 100644 --- a/libs/template/resolver_test.go +++ b/libs/template/resolver_test.go @@ -104,7 +104,7 @@ func TestBundleInitIsGitRepoUrl(t *testing.T) { // Supported assert.True(t, IsGitRepoUrl("git@github.com:databricks/cli.git")) assert.True(t, IsGitRepoUrl("https://github.com/databricks/cli.git")) - assert.True(t, IsGitRepoUrl("ssh://git@github.com/databricks/cli.git")) + assert.True(t, IsGitRepoUrl("ssh://user@company.ghe.com/databricks/cli.git")) // Unsupported assert.False(t, IsGitRepoUrl("git://github.com/databricks/cli.git")) From 75318a7bfd78d6a20399196de1f311388de86373 Mon Sep 17 00:00:00 2001 From: Jan Rose Date: Sun, 12 Jul 2026 20:36:58 +0200 Subject: [PATCH 5/6] Update changelog entry --- .nextchanges/bundle-init-git-clone-url.md | 1 + NEXT_CHANGELOG.md | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 .nextchanges/bundle-init-git-clone-url.md diff --git a/.nextchanges/bundle-init-git-clone-url.md b/.nextchanges/bundle-init-git-clone-url.md new file mode 100644 index 00000000000..a234b42c1f7 --- /dev/null +++ b/.nextchanges/bundle-init-git-clone-url.md @@ -0,0 +1 @@ +Recognize `ssh://` template URLs in `databricks bundle init` ([#5891](https://github.com/databricks/cli/pull/5891)). diff --git a/NEXT_CHANGELOG.md b/NEXT_CHANGELOG.md index 9762fc2e8d2..ea05bf2b811 100644 --- a/NEXT_CHANGELOG.md +++ b/NEXT_CHANGELOG.md @@ -5,7 +5,6 @@ ### Notable Changes ### CLI -* Recognize `ssh://` template URLs in `databricks bundle init` ([#5891](https://github.com/databricks/cli/pull/5891)). * experimental `ssh connect`: bare `python`/`pip` in an interactive session now resolve to the environment interpreter (`$DATABRICKS_VIRTUAL_ENV`) instead of the system or cluster-libraries interpreter, so packages installed in the environment are importable without extra setup. The interactive shell is now non-login (`bash -i`) and the server seeds a `~/.bashrc` snippet that re-prepends the environment's bin directory to `PATH` ([#5888](https://github.com/databricks/cli/pull/5888)). From c75c2e25c7dac7e7d50c682b61618832db8cdb5e Mon Sep 17 00:00:00 2001 From: Jan Rose Date: Sun, 12 Jul 2026 20:42:29 +0200 Subject: [PATCH 6/6] Move changelog entry --- .nextchanges/{ => bundles}/bundle-init-git-clone-url.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .nextchanges/{ => bundles}/bundle-init-git-clone-url.md (100%) diff --git a/.nextchanges/bundle-init-git-clone-url.md b/.nextchanges/bundles/bundle-init-git-clone-url.md similarity index 100% rename from .nextchanges/bundle-init-git-clone-url.md rename to .nextchanges/bundles/bundle-init-git-clone-url.md