1.fix issue: deleting repo action will fall in deadlock between two Harbor if they are configured to sync to each other 2. Filter notification request in nginx

This commit is contained in:
Wenkai Yin 2016-12-09 18:10:20 +08:00
parent 000a8539fe
commit d6d4711700
3 changed files with 14 additions and 6 deletions

View File

@ -70,6 +70,10 @@ http {
proxy_buffering off;
proxy_request_buffering off;
}
location /service/notifications {
return 404;
}
}
}

View File

@ -87,6 +87,10 @@ http {
proxy_buffering off;
proxy_request_buffering off;
}
location /service/notifications {
return 404;
}
}
server {

View File

@ -164,15 +164,15 @@ func (ra *RepositoryAPI) Delete() {
}
for _, t := range tags {
if err := rc.DeleteTag(t); err != nil {
if err = rc.DeleteTag(t); err != nil {
if regErr, ok := err.(*registry_error.Error); ok {
if regErr.StatusCode != http.StatusNotFound {
ra.CustomAbort(regErr.StatusCode, regErr.Detail)
if regErr.StatusCode == http.StatusNotFound {
continue
}
} else {
log.Errorf("error occurred while deleting tag %s:%s: %v", repoName, t, err)
ra.CustomAbort(http.StatusInternalServerError, "internal error")
ra.CustomAbort(regErr.StatusCode, regErr.Detail)
}
log.Errorf("error occurred while deleting tag %s:%s: %v", repoName, t, err)
ra.CustomAbort(http.StatusInternalServerError, "internal error")
}
log.Infof("delete tag: %s:%s", repoName, t)
go TriggerReplicationByRepository(repoName, []string{t}, models.RepOpDelete)