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:
Yan 2017-06-14 20:05:43 +08:00 committed by GitHub
commit 1e0f48b8c5

View File

@ -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)
}