Skip to content

Commit

Permalink
Merge pull request #1449 from fluxcd/update-go-git
Browse files Browse the repository at this point in the history
Update go-git to v5.4.1
  • Loading branch information
hiddeco authored May 26, 2021
2 parents 92ef39e + 465ea5c commit bf69dbd
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 39 deletions.
16 changes: 1 addition & 15 deletions cmd/flux/bootstrap_git.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
"github.com/go-git/go-git/v5/plumbing/transport/ssh"
"github.com/manifoldco/promptui"
"github.com/spf13/cobra"
cryptossh "golang.org/x/crypto/ssh"
corev1 "k8s.io/api/core/v1"

"github.com/fluxcd/flux2/internal/bootstrap"
Expand Down Expand Up @@ -233,20 +232,7 @@ func transportForURL(u *url.URL) (transport.AuthMethod, error) {
}, nil
case "ssh":
if bootstrapArgs.privateKeyFile != "" {
// TODO(hidde): replace custom logic with https://github.com/go-git/go-git/pull/298
// once made available in go-git release.
bytes, err := ioutil.ReadFile(bootstrapArgs.privateKeyFile)
if err != nil {
return nil, err
}
signer, err := cryptossh.ParsePrivateKey(bytes)
if _, ok := err.(*cryptossh.PassphraseMissingError); ok {
signer, err = cryptossh.ParsePrivateKeyWithPassphrase(bytes, []byte(gitArgs.password))
}
if err != nil {
return nil, err
}
return &ssh.PublicKeys{Signer: signer, User: u.User.Username()}, nil
return ssh.NewPublicKeysFromFile(u.User.Username(), bootstrapArgs.privateKeyFile, gitArgs.password)
}
return nil, nil
default:
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ require (
github.com/fluxcd/pkg/untar v0.0.5
github.com/fluxcd/pkg/version v0.0.1
github.com/fluxcd/source-controller/api v0.12.2
github.com/go-git/go-git/v5 v5.1.0
github.com/go-git/go-git/v5 v5.4.1
github.com/google/go-containerregistry v0.2.0
github.com/manifoldco/promptui v0.7.0
github.com/olekukonko/tablewriter v0.0.4
github.com/spf13/cobra v1.1.1
github.com/spf13/pflag v1.0.5
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b
k8s.io/api v0.20.4
k8s.io/apiextensions-apiserver v0.20.4
k8s.io/apimachinery v0.20.4
Expand Down
Loading

0 comments on commit bf69dbd

Please sign in to comment.