| 27 | } |
| 28 | |
| 29 | func (gi *gitlabImporter) Init(_ context.Context, repo *cache.RepoCache, conf core.Configuration) error { |
| 30 | gi.conf = conf |
| 31 | |
| 32 | creds, err := auth.List(repo, |
| 33 | auth.WithTarget(target), |
| 34 | auth.WithKind(auth.KindToken), |
| 35 | auth.WithMeta(auth.MetaKeyBaseURL, conf[confKeyGitlabBaseUrl]), |
| 36 | auth.WithMeta(auth.MetaKeyLogin, conf[confKeyDefaultLogin]), |
| 37 | ) |
| 38 | if err != nil { |
| 39 | return err |
| 40 | } |
| 41 | |
| 42 | if len(creds) == 0 { |
| 43 | return ErrMissingIdentityToken |
| 44 | } |
| 45 | |
| 46 | gi.client, err = buildClient(conf[confKeyGitlabBaseUrl], creds[0].(*auth.Token)) |
| 47 | if err != nil { |
| 48 | return err |
| 49 | } |
| 50 | |
| 51 | return nil |
| 52 | } |
| 53 | |
| 54 | // ImportAll iterate over all the configured repository issues (notes) and ensure the creation |
| 55 | // of the missing issues / comments / label events / title changes ... |