Skip to content

Commit

Permalink
feat: Connect to git with InsecureIgnoreHostKey. Closes argoproj#841
Browse files Browse the repository at this point in the history
  • Loading branch information
whynowy committed Aug 20, 2020
1 parent 7429a56 commit 68f31b7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
9 changes: 0 additions & 9 deletions examples/sensors/trigger-source-git.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,11 @@ spec:
name: argoproj
- mountPath: /git/argoproj1
name: argoproj1
- mountPath: /etc/ssh
name: known-hosts
volumes:
- name: argoproj
emptyDir: {}
- name: argoproj1
emptyDir: {}
# The name of the key in the secret must be "ssh_known_hosts"
# Make sure you have your git provider added in the known hosts
# e.g. create the secret by running, kubectl -n argo-events create secret generic git-known-hosts --from-file=ssh_known_hosts=.ssh/known_hosts
- name: known-hosts
secret:
secretName: git-known-hosts
serviceAccountName: argo-events-sa
dependencies:
- name: test-dep
Expand Down Expand Up @@ -63,6 +55,5 @@ spec:
sshKeySecret:
name: git-ssh
key: key
namespace: argo-events
filePath: "examples/hello-world.yaml"
branch: "master"
4 changes: 2 additions & 2 deletions store/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ func (g *GitArtifactReader) getRemote() string {
}

func getSSHKeyAuth(sshKeyFile string) (transport.AuthMethod, error) {
var auth transport.AuthMethod
sshKey, err := ioutil.ReadFile(sshKeyFile)
if err != nil {
return nil, fmt.Errorf("failed to read ssh key file. err: %+v", err)
Expand All @@ -73,7 +72,8 @@ func getSSHKeyAuth(sshKeyFile string) (transport.AuthMethod, error) {
if err != nil {
return nil, fmt.Errorf("failed to parse ssh key. err: %+v", err)
}
auth = &go_git_ssh.PublicKeys{User: "git", Signer: signer}
auth := &go_git_ssh.PublicKeys{User: "git", Signer: signer}
auth.HostKeyCallback = ssh.InsecureIgnoreHostKey()
return auth, nil
}

Expand Down

0 comments on commit 68f31b7

Please sign in to comment.