mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-29 21:54:13 +01:00
Merge pull request #2389 from ywk253100/170526_bug_fix
Checking whether the repo contains any tags when syncing repo between db and registry
This commit is contained in:
commit
1e0f48b8c5
@ -388,6 +388,29 @@ func diffRepos(reposInRegistry []string, reposInDB []string,
|
||||
if !exist {
|
||||
continue
|
||||
}
|
||||
|
||||
endpoint, err := config.RegistryURL()
|
||||
if err != nil {
|
||||
log.Errorf("failed to get registry URL: %v", err)
|
||||
continue
|
||||
}
|
||||
client, err := NewRepositoryClient(endpoint, true,
|
||||
"admin", repoInR, "repository", repoInR, "pull")
|
||||
if err != nil {
|
||||
log.Errorf("failed to create repository client: %v", err)
|
||||
continue
|
||||
}
|
||||
|
||||
exist, err = repositoryExist(repoInR, client)
|
||||
if err != nil {
|
||||
log.Errorf("failed to check the existence of repository %s: %v", repoInR, err)
|
||||
continue
|
||||
}
|
||||
|
||||
if !exist {
|
||||
continue
|
||||
}
|
||||
|
||||
needsAdd = append(needsAdd, repoInR)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user