Skip to content

Commit

Permalink
Remove user agent check for docker notifications
Browse files Browse the repository at this point in the history
Fixes goharbor#5729

Signed-off-by: Jan-Otto Kröpke <[email protected]>
Signed-off-by: Wenkai Yin <[email protected]>
  • Loading branch information
jkroepke authored and ywk253100 committed Feb 15, 2019
1 parent 5509d8e commit 8e32ac7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/core/service/notifications/registry/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,11 @@ func filterEvents(notification *models.Notification) ([]*models.Event, error) {
}

func checkEvent(event *models.Event) bool {
// pull and push manifest by docker-client or vic or jib
if (strings.HasPrefix(event.Request.UserAgent, "docker") || strings.HasPrefix(event.Request.UserAgent, vicPrefix) || strings.HasPrefix(event.Request.UserAgent, "jib")) &&
(event.Action == "pull" || event.Action == "push") {
// pull and push manifest
if strings.ToLower(strings.TrimSpace(event.Request.UserAgent)) != "harbor-registry-client" && (event.Action == "pull" || event.Action == "push") {
return true
}
// push manifest by docker-client or job-service
// push manifest by job-service
if strings.ToLower(strings.TrimSpace(event.Request.UserAgent)) == "harbor-registry-client" && event.Action == "push" {
return true
}
Expand Down

0 comments on commit 8e32ac7

Please sign in to comment.