From 7ad6e5e0996119bff356d6d0f443774ebec2f477 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 11 Apr 2019 17:38:55 -0400 Subject: [PATCH] Fix host key check on git/hg clone --- worker/tasks.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/worker/tasks.go b/worker/tasks.go index a31a4ce..042f2b9 100644 --- a/worker/tasks.go +++ b/worker/tasks.go @@ -322,7 +322,9 @@ func (ctx *JobContext) CloneRepos() error { if scm == "git" { repo_name := path.Base(purl.Path) repo_name = strings.TrimSuffix(repo_name, ".git") - git := ctx.SSH("git", "clone", "--recursive", purl.String()) + git := ctx.SSH("GIT_SSH_COMMAND='ssh -o " + + "UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'", + "git", "clone", "--recursive", purl.String()) git.Stdout = ctx.LogFile git.Stderr = ctx.LogFile if err := git.Run(); err != nil { @@ -343,7 +345,9 @@ func (ctx *JobContext) CloneRepos() error { } } else if scm == "hg" { repo_name := path.Base(purl.Path) - hg := ctx.SSH("hg", "clone", purl.String()) + hg := ctx.SSH("hg", "clone", + "-e", "'ssh -o UserKnownHostsFile=/dev/null " + + "-o StrictHostKeyChecking=no'", purl.String()) hg.Stdout = ctx.LogFile hg.Stderr = ctx.LogFile if err := hg.Run(); err != nil { -- 2.38.5