Skip to content

Commit

Permalink
bugfix: fix repo username when image building (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
CMGS committed Jul 23, 2020
1 parent f52a97d commit 4af90c7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions source/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -53,16 +54,20 @@ func (g *GitScm) SourceCode(ctx context.Context, repository, path, revision stri
return signErr
}
splitRepo := strings.Split(repository, "@")
user, parseErr := url.Parse(splitRepo[0])
if parseErr != nil {
return parseErr
}
auth := &gitssh.PublicKeys{
User: splitRepo[0],
User: user.Host + user.Path,
Signer: signer,
HostKeyCallbackHelper: gitssh.HostKeyCallbackHelper{
HostKeyCallback: ssh.InsecureIgnoreHostKey(), // nolint
},
}
repo, err = gogit.PlainCloneContext(ctx, path, false, &gogit.CloneOptions{
URL: repository,
Progress: os.Stdout,
Progress: ioutil.Discard,
Auth: auth,
})
default:
Expand Down

0 comments on commit 4af90c7

Please sign in to comment.