Merge pull request #132 from jacksontj/ssh_flags

Add flags/env-vars for additional SSH options
This commit is contained in:
Kubernetes Prow Robot 2019-01-22 13:54:23 -08:00 committed by GitHub
commit 08282abe9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -69,8 +69,12 @@ var flPassword = flag.String("password", envString("GIT_SYNC_PASSWORD", ""),
var flSSH = flag.Bool("ssh", envBool("GIT_SYNC_SSH", false), var flSSH = flag.Bool("ssh", envBool("GIT_SYNC_SSH", false),
"use SSH for git operations") "use SSH for git operations")
var flSSHKeyFile = flag.String("ssh-key-file", envString("GIT_SSH_KEY_FILE", "/etc/git-secret/ssh"),
"the ssh key to use")
var flSSHKnownHosts = flag.Bool("ssh-known-hosts", envBool("GIT_KNOWN_HOSTS", true), var flSSHKnownHosts = flag.Bool("ssh-known-hosts", envBool("GIT_KNOWN_HOSTS", true),
"enable SSH known_hosts verification") "enable SSH known_hosts verification")
var flSSHKnownHostsFile = flag.String("ssh-known-hosts-file", envString("GIT_SSH_KNOWN_HOSTS_FILE", "/etc/git-secret/known_hosts"),
"the known hosts file to use")
var flCookieFile = flag.Bool("cookie-file", envBool("GIT_COOKIE_FILE", false), var flCookieFile = flag.Bool("cookie-file", envBool("GIT_COOKIE_FILE", false),
"use git cookiefile") "use git cookiefile")
@ -513,8 +517,8 @@ func setupGitAuth(username, password, gitURL string) error {
func setupGitSSH(setupKnownHosts bool) error { func setupGitSSH(setupKnownHosts bool) error {
log.V(1).Infof("setting up git SSH credentials") log.V(1).Infof("setting up git SSH credentials")
var pathToSSHSecret = "/etc/git-secret/ssh" var pathToSSHSecret = *flSSHKeyFile
var pathToSSHKnownHosts = "/etc/git-secret/known_hosts" var pathToSSHKnownHosts = *flSSHKnownHostsFile
fileInfo, err := os.Stat(pathToSSHSecret) fileInfo, err := os.Stat(pathToSSHSecret)
if err != nil { if err != nil {