From 2d21d2af9ef907ed3407b07d6a0191c39a29ee54 Mon Sep 17 00:00:00 2001 From: zeripath Date: Sat, 19 Mar 2022 14:16:38 +0000 Subject: Make migrations SKIP_TLS_VERIFY apply to git too (#19132) Make SKIP_TLS_VERIFY apply to git data migrations too through adding the `-c http.sslVerify=false` option to the git clone command. Fix #18998 Signed-off-by: Andrew Thornton --- modules/git/repo.go | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'modules/git') diff --git a/modules/git/repo.go b/modules/git/repo.go index 8217521b06..5ba39ac7e3 100644 --- a/modules/git/repo.go +++ b/modules/git/repo.go @@ -98,15 +98,16 @@ func (repo *Repository) IsEmpty() (bool, error) { // CloneRepoOptions options when clone a repository type CloneRepoOptions struct { - Timeout time.Duration - Mirror bool - Bare bool - Quiet bool - Branch string - Shared bool - NoCheckout bool - Depth int - Filter string + Timeout time.Duration + Mirror bool + Bare bool + Quiet bool + Branch string + Shared bool + NoCheckout bool + Depth int + Filter string + SkipTLSVerify bool } // Clone clones original repository to target path. @@ -124,6 +125,9 @@ func CloneWithArgs(ctx context.Context, from, to string, args []string, opts Clo } cmd := NewCommandContextNoGlobals(ctx, args...).AddArguments("clone") + if opts.SkipTLSVerify { + cmd.AddArguments("-c", "http.sslVerify=false") + } if opts.Mirror { cmd.AddArguments("--mirror") } -- cgit v1.2.3