Remove private key requirement for tmpfs-mode

This commit is contained in:
Mustafa Gezen 2021-04-08 18:36:30 +02:00
parent 1a7b44d9f3
commit 4b798ecec8
2 changed files with 27 additions and 23 deletions

View File

@ -111,11 +111,17 @@ func mn(_ *cobra.Command, _ []string) {
} }
lastKeyLocation = filepath.Join(usr.HomeDir, ".ssh/id_rsa") lastKeyLocation = filepath.Join(usr.HomeDir, ".ssh/id_rsa")
} }
var authenticator *ssh.PublicKeys
if tmpFsMode == "" {
var err error
// create ssh key authenticator // create ssh key authenticator
authenticator, err := ssh.NewPublicKeysFromFile(sshUser, lastKeyLocation, "") authenticator, err = ssh.NewPublicKeysFromFile(sshUser, lastKeyLocation, "")
if err != nil { if err != nil {
log.Fatalf("could not get git authenticator: %v", err) log.Fatalf("could not get git authenticator: %v", err)
} }
}
fsCreator := func(branch string) billy.Filesystem { fsCreator := func(branch string) billy.Filesystem {
return memfs.New() return memfs.New()

View File

@ -119,7 +119,6 @@ func (g *GitMode) RetrieveSource(pd *data.ProcessData) *data.ModeData {
} }
_ = tagIter.ForEach(tagAdd) _ = tagIter.ForEach(tagAdd)
if len(latestTags) == 0 {
list, err := remote.List(&git.ListOptions{}) list, err := remote.List(&git.ListOptions{})
if err != nil { if err != nil {
log.Fatalf("could not list upstream: %v", err) log.Fatalf("could not list upstream: %v", err)
@ -140,7 +139,6 @@ func (g *GitMode) RetrieveSource(pd *data.ProcessData) *data.ModeData {
Tagger: commit.Committer, Tagger: commit.Committer,
}) })
} }
}
for _, branch := range latestTags { for _, branch := range latestTags {
log.Printf("tag: %s", strings.TrimPrefix(branch.remote, "refs/tags/")) log.Printf("tag: %s", strings.TrimPrefix(branch.remote, "refs/tags/"))