未验证 提交 d62a3fc8 编写于 作者: 徐超越 提交者: GitHub

Merge branch 'go-atomci:master' into issue-61

......@@ -28,6 +28,7 @@ import (
"github.com/go-atomci/atomci/utils"
"github.com/drone/go-scm/scm"
"github.com/drone/go-scm/scm/driver/gitee"
"github.com/drone/go-scm/scm/driver/github"
"github.com/drone/go-scm/scm/driver/gitlab"
"github.com/drone/go-scm/scm/transport"
......@@ -55,19 +56,19 @@ func NewScmProvider(vcsType, vcsPath, user, token string) (*scm.Client, error) {
},
}
case "github":
if strings.HasSuffix(vcsPath, ".git") {
vcsPath = strings.Replace(vcsPath, ".git", "", -1)
client = github.NewDefault()
client.Client = &http.Client{
Transport: &transport.BearerToken{
Token: token,
},
}
// TODO: verify vcsPath, only support http, do not support git@github.com:/dddd.git
projectPathSplit := strings.Split(strings.Split(vcsPath, "://")[1], "/")
projectName := strings.Join(projectPathSplit[1:], "/")
log.Log.Debug("git projectpathsplit: %s,\tprojectName: %s", projectPathSplit, projectName)
// TODO: github does not work
schema := strings.Split(vcsPath, "://")[0]
client, err = github.New(schema + "://" + projectPathSplit[0])
case "gitee":
client = gitee.NewDefault()
client.Client = &http.Client{
Transport: &transport.PrivateToken{
Transport: &transport.BearerToken{
Token: token,
},
}
......
......@@ -54,8 +54,8 @@ func (manager *AppManager) AppBranches(appID int64, filter *query.FilterQuery) (
func (manager *AppManager) GetRepos(projectID int64) ([]*RepoServerRsp, error) {
repos := []*models.RepoServer{}
// TODO: support code repository defined,
// defaultRepos := []string{"gitlab", "github"}
defaultRepos := []string{"gitlab"}
defaultRepos := []string{"gitlab", "github", "gitee"}
// defaultRepos := []string{"gitlab"}
for _, item := range defaultRepos {
_, err := manager.gitAppModel.GetRepoBycIDAndType(projectID, item)
if err != nil {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册