From 4d46f9a479e5f607968f083addb6cc0a2031d8a6 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sat, 9 Jan 2021 16:03:37 +0100 Subject: pkg/vcs: allow sso protocol for git repos --- pkg/vcs/vcs.go | 4 ++-- pkg/vcs/vcs_test.go | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'pkg') diff --git a/pkg/vcs/vcs.go b/pkg/vcs/vcs.go index 8e12bbca9..55273f4aa 100644 --- a/pkg/vcs/vcs.go +++ b/pkg/vcs/vcs.go @@ -261,9 +261,9 @@ var ( // nolint: lll gitLocalRepoRe = regexp.MustCompile(`^file:///[a-zA-Z0-9-_./~]+(/)?$`) // nolint: lll - gitRemoteRepoRe = regexp.MustCompile(`^(git|ssh|http|https|ftp|ftps)://[a-zA-Z0-9-_]+(\.[a-zA-Z0-9-_]+)+(:[0-9]+)?(/[a-zA-Z0-9-_./~]+)?(/)?$`) + gitRemoteRepoRe = regexp.MustCompile(`^(git|ssh|http|https|ftp|ftps|sso)://[a-zA-Z0-9-_.]+(:[0-9]+)?(/[a-zA-Z0-9-_./~]+)?(/)?$`) // nolint: lll - gitSSHRepoRe = regexp.MustCompile(`^(git|ssh|http|https|ftp|ftps)@[a-zA-Z0-9-_]+(\.[a-zA-Z0-9-_]+)+(:[a-zA-Z0-9-_]+)?(/[a-zA-Z0-9-_./~]+)?(/)?$`) + gitSSHRepoRe = regexp.MustCompile(`^(git|ssh|http|https|ftp|ftps|sso)@[a-zA-Z0-9-_.]+(:[a-zA-Z0-9-_]+)?(/[a-zA-Z0-9-_./~]+)?(/)?$`) gitBranchRe = regexp.MustCompile("^[a-zA-Z0-9-_/.]{2,200}$") gitHashRe = regexp.MustCompile("^[a-f0-9]{8,40}$") releaseTagRe = regexp.MustCompile(`^v([0-9]+).([0-9]+)(?:-rc([0-9]+))?(?:\.([0-9]+))?$`) diff --git a/pkg/vcs/vcs_test.go b/pkg/vcs/vcs_test.go index 23cfa1766..de5fbbef2 100644 --- a/pkg/vcs/vcs_test.go +++ b/pkg/vcs/vcs_test.go @@ -39,14 +39,15 @@ func TestCheckRepoAddress(t *testing.T) { "https://fuchsia.googlesource.com": true, "git@my-github.com:my/fd.git": true, "file:///repo/linux.git": true, + "git://kernel/ubuntu.git": true, + "git@my-github/fd.git": true, + "sso://server/repo": true, "git@my-github.com:/fd.git": false, "gitgit@my-github:/fd.git": false, - "git@my-github/fd.git": false, "": false, "foobar": false, "linux-next": false, "foo://kernel.ubuntu.com/ubuntu/ubuntu-zesty.git": false, - "git://kernel/ubuntu.git": false, "gitgit://kernel.ubuntu.com/ubuntu/ubuntu-zesty.git": false, }) } -- cgit mrf-deployment