mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-28 03:27:41 +01:00
Merge pull request #13417 from bitsf/fix_gitlab_replication_task_num
fix(replication) gitlab replication task num not correct
This commit is contained in:
commit
af7000d277
@ -93,7 +93,7 @@ func (a *adapter) FetchArtifacts(filters []*model.Filter) ([]*model.Resource, er
|
||||
}
|
||||
}
|
||||
|
||||
projects = a.searchByPattern(nameFilter)
|
||||
projects = a.getProjectsByPattern(nameFilter)
|
||||
if len(projects) == 0 {
|
||||
projects, err = a.clientGitlabAPI.getProjects()
|
||||
if err != nil {
|
||||
@ -156,8 +156,9 @@ func (a *adapter) FetchArtifacts(filters []*model.Filter) ([]*model.Resource, er
|
||||
return resources, nil
|
||||
}
|
||||
|
||||
func (a *adapter) searchByPattern(pattern string) []*Project {
|
||||
func (a *adapter) getProjectsByPattern(pattern string) []*Project {
|
||||
var projects []*Project
|
||||
projectset := make(map[string]bool)
|
||||
var err error
|
||||
if len(pattern) > 0 {
|
||||
|
||||
@ -168,6 +169,10 @@ func (a *adapter) searchByPattern(pattern string) []*Project {
|
||||
if len(substrings) < 2 {
|
||||
continue
|
||||
}
|
||||
if _, ok := projectset[substrings[1]]; ok {
|
||||
continue
|
||||
}
|
||||
projectset[substrings[1]] = true
|
||||
var projectsByName, err = a.clientGitlabAPI.getProjectsByName(substrings[1])
|
||||
if err != nil {
|
||||
return nil
|
||||
@ -199,6 +204,7 @@ func (a *adapter) searchByPattern(pattern string) []*Project {
|
||||
}
|
||||
return projects
|
||||
}
|
||||
|
||||
func existPatterns(path string, patterns []string) bool {
|
||||
correct := false
|
||||
if len(patterns) > 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user