mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-16 23:35:20 +01:00
fix(replication) gitlab replication task num not correct
Signed-off-by: Ziming Zhang <zziming@vmware.com>
This commit is contained in:
parent
dd3ffd4147
commit
8c2c758677
@ -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 {
|
if len(projects) == 0 {
|
||||||
projects, err = a.clientGitlabAPI.getProjects()
|
projects, err = a.clientGitlabAPI.getProjects()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -156,8 +156,9 @@ func (a *adapter) FetchArtifacts(filters []*model.Filter) ([]*model.Resource, er
|
|||||||
return resources, nil
|
return resources, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *adapter) searchByPattern(pattern string) []*Project {
|
func (a *adapter) getProjectsByPattern(pattern string) []*Project {
|
||||||
var projects []*Project
|
var projects []*Project
|
||||||
|
projectset := make(map[string]bool)
|
||||||
var err error
|
var err error
|
||||||
if len(pattern) > 0 {
|
if len(pattern) > 0 {
|
||||||
|
|
||||||
@ -168,6 +169,10 @@ func (a *adapter) searchByPattern(pattern string) []*Project {
|
|||||||
if len(substrings) < 2 {
|
if len(substrings) < 2 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if _, ok := projectset[substrings[1]]; ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
projectset[substrings[1]] = true
|
||||||
var projectsByName, err = a.clientGitlabAPI.getProjectsByName(substrings[1])
|
var projectsByName, err = a.clientGitlabAPI.getProjectsByName(substrings[1])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
@ -199,6 +204,7 @@ func (a *adapter) searchByPattern(pattern string) []*Project {
|
|||||||
}
|
}
|
||||||
return projects
|
return projects
|
||||||
}
|
}
|
||||||
|
|
||||||
func existPatterns(path string, patterns []string) bool {
|
func existPatterns(path string, patterns []string) bool {
|
||||||
correct := false
|
correct := false
|
||||||
if len(patterns) > 0 {
|
if len(patterns) > 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user