Skip to content

Commit

Permalink
Use gitlab netrc
Browse files Browse the repository at this point in the history
  • Loading branch information
kzaitsev committed Jul 26, 2015
1 parent a400fc6 commit ebdc204
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions pkg/remote/builtin/gitlab/gitlab.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"
"strconv"
"strings"

Expand Down Expand Up @@ -147,9 +148,16 @@ func (r *Gitlab) Status(u *common.User, repo *common.Repo, b *common.Build) erro

// Netrc returns a .netrc file that can be used to clone
// private repositories from a remote system.
// NOTE gitlab does not support this, so now we skip this.
func (r *Gitlab) Netrc(u *common.User) (*common.Netrc, error) {
return nil, nil
url_, err := url.Parse(r.URL)
if err != nil {
return nil, err
}
netrc := &common.Netrc{}
netrc.Login = "oauth2"
netrc.Password = u.Token
netrc.Machine = url_.Host
return netrc, nil
}

// Activate activates a repository by adding a Post-commit hook and
Expand Down Expand Up @@ -239,10 +247,6 @@ func (r *Gitlab) Hook(req *http.Request) (*common.Hook, error) {

var cloneUrl = parsed.Repository.GitHttpUrl

if parsed.Repository.VisibilityLevel < 20 {
cloneUrl = parsed.Repository.GitSshUrl
}

var hook = new(common.Hook)
hook.Repo = &common.Repo{}
hook.Repo.Owner = req.FormValue("owner")
Expand Down

0 comments on commit ebdc204

Please sign in to comment.