aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/gitlab
diff options
context:
space:
mode:
authorAlexander Scharinger <rng.dynamics@gmail.com>2021-04-09 15:41:27 +0200
committerAlexander Scharinger <rng.dynamics@gmail.com>2021-04-09 15:41:27 +0200
commitbe24cdfec43fe9adcd937ed4bdac28250e214ec6 (patch)
treee5cd4234ac6c34467094be9f70e581d4563a5273 /bridge/gitlab
parent10a80f188861157b5f58bb700fe7f1c84bb4da95 (diff)
downloadgit-bug-be24cdfec43fe9adcd937ed4bdac28250e214ec6.tar.gz
Revert "Bridges: move credential loading and client creation"
This reverts commit 3d14e2e67c4985c429471ea6643f013ade2c2692.
Diffstat (limited to 'bridge/gitlab')
-rw-r--r--bridge/gitlab/import.go25
1 files changed, 14 insertions, 11 deletions
diff --git a/bridge/gitlab/import.go b/bridge/gitlab/import.go
index 7dc99056..7939f4e4 100644
--- a/bridge/gitlab/import.go
+++ b/bridge/gitlab/import.go
@@ -33,29 +33,32 @@ type gitlabImporter struct {
func (gi *gitlabImporter) Init(_ context.Context, repo *cache.RepoCache, conf core.Configuration) error {
gi.conf = conf
- return nil
-}
-// ImportAll iterate over all the configured repository issues (notes) and ensure the creation
-// of the missing issues / comments / label events / title changes ...
-func (gi *gitlabImporter) ImportAll(ctx context.Context, repo *cache.RepoCache, since time.Time) (<-chan core.ImportResult, error) {
creds, err := auth.List(repo,
auth.WithTarget(target),
auth.WithKind(auth.KindToken),
- auth.WithMeta(auth.MetaKeyBaseURL, gi.conf[confKeyGitlabBaseUrl]),
- auth.WithMeta(auth.MetaKeyLogin, gi.conf[confKeyDefaultLogin]),
+ auth.WithMeta(auth.MetaKeyBaseURL, conf[confKeyGitlabBaseUrl]),
+ auth.WithMeta(auth.MetaKeyLogin, conf[confKeyDefaultLogin]),
)
if err != nil {
- return nil, err
+ return err
}
+
if len(creds) == 0 {
- return nil, ErrMissingIdentityToken
+ return ErrMissingIdentityToken
}
- gi.client, err = buildClient(gi.conf[confKeyGitlabBaseUrl], creds[0].(*auth.Token))
+
+ gi.client, err = buildClient(conf[confKeyGitlabBaseUrl], creds[0].(*auth.Token))
if err != nil {
- return nil, err
+ return err
}
+ return nil
+}
+
+// ImportAll iterate over all the configured repository issues (notes) and ensure the creation
+// of the missing issues / comments / label events / title changes ...
+func (gi *gitlabImporter) ImportAll(ctx context.Context, repo *cache.RepoCache, since time.Time) (<-chan core.ImportResult, error) {
gi.iterator = iterator.NewIterator(ctx, gi.client, 10, gi.conf[confKeyProjectID], since)
out := make(chan core.ImportResult)
gi.out = out