diff options
Diffstat (limited to 'bridge/gitlab/export.go')
-rw-r--r-- | bridge/gitlab/export.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/bridge/gitlab/export.go b/bridge/gitlab/export.go index 373cf637..d42ef1cd 100644 --- a/bridge/gitlab/export.go +++ b/bridge/gitlab/export.go @@ -62,7 +62,11 @@ func (ge *gitlabExporter) cacheAllClient(repo repository.RepoConfig) error { for _, cred := range creds { if _, ok := ge.identityClient[cred.UserId()]; !ok { - client := buildClient(creds[0].(*auth.Token)) + client, err := buildClient(ge.conf[keyGitlabBaseUrl], creds[0].(*auth.Token)) + if err != nil { + return err + } + ge.identityClient[cred.UserId()] = client } } @@ -133,6 +137,7 @@ func (ge *gitlabExporter) exportBug(ctx context.Context, b *cache.BugCache, sinc var err error var bugGitlabID int var bugGitlabIDString string + var GitlabBaseUrl string var bugCreationId string // Special case: @@ -153,6 +158,12 @@ func (ge *gitlabExporter) exportBug(ctx context.Context, b *cache.BugCache, sinc // get gitlab bug ID gitlabID, ok := snapshot.GetCreateMetadata(metaKeyGitlabId) if ok { + gitlabBaseUrl, ok := snapshot.GetCreateMetadata(metaKeyGitlabBaseUrl) + if ok && gitlabBaseUrl != ge.conf[gitlabBaseUrl] { + out <- core.NewExportNothing(b.Id(), "skipping issue imported from another Gitlab instance") + return + } + projectID, ok := snapshot.GetCreateMetadata(metaKeyGitlabProject) if !ok { err := fmt.Errorf("expected to find gitlab project id") @@ -199,6 +210,7 @@ func (ge *gitlabExporter) exportBug(ctx context.Context, b *cache.BugCache, sinc metaKeyGitlabId: idString, metaKeyGitlabUrl: url, metaKeyGitlabProject: ge.repositoryID, + metaKeyGitlabBaseUrl: GitlabBaseUrl, }, ) if err != nil { |