mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-26 20:26:13 +01:00
add debug log for notificaions
This commit is contained in:
parent
a3b4b1b525
commit
41b155dd12
@ -94,6 +94,9 @@ func filterEvents(notification *models.Notification) ([]*models.Event, error) {
|
||||
events := []*models.Event{}
|
||||
|
||||
for _, event := range notification.Events {
|
||||
log.Debugf("receive an event: ID-%s, target-%s:%s, digest-%s, action-%s", event.ID, event.Target.Repository, event.Target.Tag,
|
||||
event.Target.Digest, event.Action)
|
||||
|
||||
isManifest, err := regexp.MatchString(manifestPattern, event.Target.MediaType)
|
||||
if err != nil {
|
||||
log.Errorf("failed to match the media type against pattern: %v", err)
|
||||
@ -107,12 +110,14 @@ func filterEvents(notification *models.Notification) ([]*models.Event, error) {
|
||||
//pull and push manifest by docker-client
|
||||
if strings.HasPrefix(event.Request.UserAgent, "docker") && (event.Action == "pull" || event.Action == "push") {
|
||||
events = append(events, &event)
|
||||
log.Debugf("add event to collect: %s", event.ID)
|
||||
continue
|
||||
}
|
||||
|
||||
//push manifest by docker-client or job-service
|
||||
if strings.ToLower(strings.TrimSpace(event.Request.UserAgent)) == "harbor-registry-client" && event.Action == "push" {
|
||||
events = append(events, &event)
|
||||
log.Debugf("add event to collect: %s", event.ID)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user