aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/gitlab
diff options
context:
space:
mode:
authorAmine Hilaly <hilalyamine@gmail.com>2019-07-19 19:39:15 +0200
committerAmine Hilaly <hilalyamine@gmail.com>2019-07-23 17:18:04 +0200
commitb18507836cd1716ba842e82eb8d42c82b8d62d71 (patch)
tree742c19a6da77e296e22f323708bb2c587709dda7 /bridge/gitlab
parent5e2eb5000bea9ef1268c3ff0dd24c8126f850d85 (diff)
downloadgit-bug-b18507836cd1716ba842e82eb8d42c82b8d62d71.tar.gz
bridge/gitlab: add gitlab client default timeout
bridge/gitlab: fix import bug
Diffstat (limited to 'bridge/gitlab')
-rw-r--r--bridge/gitlab/gitlab.go14
-rw-r--r--bridge/gitlab/import.go2
2 files changed, 7 insertions, 9 deletions
diff --git a/bridge/gitlab/gitlab.go b/bridge/gitlab/gitlab.go
index d0faf1ef..743ab172 100644
--- a/bridge/gitlab/gitlab.go
+++ b/bridge/gitlab/gitlab.go
@@ -1,6 +1,7 @@
package gitlab
import (
+ "net/http"
"time"
"github.com/xanzy/go-gitlab"
@@ -9,9 +10,7 @@ import (
)
const (
- target = "gitlab"
- gitlabV4Url = "https://gitlab.com/api/v4"
-
+ target = "gitlab"
keyProjectID = "project-id"
keyGitlabId = "gitlab-id"
keyGitlabUrl = "gitlab-url"
@@ -42,10 +41,9 @@ func (*Gitlab) NewExporter() core.Exporter {
}
func buildClient(token string) *gitlab.Client {
- return gitlab.NewClient(nil, token)
-}
-
-func buildClientFromUsernameAndPassword(username, password string) (*gitlab.Client, error) {
- return gitlab.NewBasicAuthClient(nil, "https://gitlab.com", username, password)
+ client := &http.Client{
+ Timeout: defaultTimeout,
+ }
+ return gitlab.NewClient(client, token)
}
diff --git a/bridge/gitlab/import.go b/bridge/gitlab/import.go
index 6227767b..6869a103 100644
--- a/bridge/gitlab/import.go
+++ b/bridge/gitlab/import.go
@@ -120,7 +120,7 @@ func (gi *gitlabImporter) ensureIssue(repo *cache.RepoCache, issue *gitlab.Issue
return b, nil
}
- return nil, nil
+ return b, nil
}
func (gi *gitlabImporter) ensureNote(repo *cache.RepoCache, b *cache.BugCache, note *gitlab.Note) error {