mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-11 09:21:56 +01:00
add support jib
Signed-off-by: mmpei <peimingming1986@126.com> Signed-off-by: peimingming <peimingming@corp.netease.com>
This commit is contained in:
parent
99c70ceab9
commit
a209519b0e
@ -158,18 +158,9 @@ func filterEvents(notification *models.Notification) ([]*models.Event, error) {
|
||||
continue
|
||||
}
|
||||
|
||||
// pull and push manifest by docker-client or vic
|
||||
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") {
|
||||
if checkEvent(&event) {
|
||||
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)
|
||||
log.Debugf("add event to collection: %s", event.ID)
|
||||
continue
|
||||
}
|
||||
}
|
||||
@ -177,6 +168,19 @@ func filterEvents(notification *models.Notification) ([]*models.Event, error) {
|
||||
return events, nil
|
||||
}
|
||||
|
||||
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") {
|
||||
return true
|
||||
}
|
||||
// push manifest by docker-client or job-service
|
||||
if strings.ToLower(strings.TrimSpace(event.Request.UserAgent)) == "harbor-registry-client" && event.Action == "push" {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func autoScanEnabled(project *models.Project) bool {
|
||||
if !config.WithClair() {
|
||||
log.Debugf("Auto Scan disabled because Harbor is not deployed with Clair")
|
||||
|
Loading…
Reference in New Issue
Block a user