mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 20:01:02 +00:00
Use gitlab netrc
This commit is contained in:
parent
a400fc6957
commit
ebdc2043ca
1 changed files with 10 additions and 6 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
|
@ -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
|
||||
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue