Harbor: Support webhook in harbor

Created on 2 Jan 2019  路  9Comments  路  Source: goharbor/harbor

webhook is an important feature for image repository especially for CICD flow. and harbor should support webhook not only the push image event but also scan image , replicate image or deleting image event.

the feature should support:

  1. user could define his own trigger policy, and this policy should support regular expression of repo name or tag, or the list of tag.
  2. and the event define should be extensible. pushing image event is in need for CICD. but other event should be implemented easily including finishing scanning image, finishing replicate, delete image and so on.
  3. the logs of event triggered should be searched easily, these logs should incluing the http request and http response from remote endpoint.
  4. the hook request should be resend after failed.

the work flow should like:
default

  1. registry triggers a notification event to harbor(actually Core) when finish pushing a manifest.
  2. Core revices this event and process it in eventHandler.
  3. eventHandler will invoke notificationHandler, some default notificationHandler including webhook handler will be registered when initialization.
  4. in notificationHandler, harbor will find the related policy, do filter and generate cresponding correlative jobs, there could be several jobs if user defined muilty policies.
  5. send Jobs to Harbor JobService, and JobService put these jobs into work queue.
  6. Job will be run in JS, and will be retry if failed. log will be generated.
  7. webhook finished.

the hook message like:
{ "events": [ { "project": "prj", "repoName": "repo1", "tag": "latest", "fullName": "prj/repo1", "triggerTime": 158322233213, "imageId": "9e2c9d5f44efbb6ee83aecd17a120c513047d289d142ec5738c9f02f9b24ad07", "projectType": "PRIVATE", "eventType","PUSH" } ] }

arewebhook candidat1.9.0 needproposal

Most helpful comment

i have finished coding. and doing testing these days. i will show it when i finish all.

All 9 comments

@steven-zou @fengchj

@mmpei

I'd like to suggest you convert it(or create a new epic) into an epic with linked issues. That will be easy to track the overall progress.

Is there an associated proposal for this? If not, do we need/want one?

@nlowe

Of course, @mmpei need to submit a proposal doc first.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

i have finished coding. and doing testing these days. i will show it when i finish all.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@mmpei Did this get included in 1.9.0?

yes, see the proposal here @MrMEEE

Was this page helpful?
0 / 5 - 0 ratings

Related issues

reasonerjt picture reasonerjt  路  3Comments

reasonerjt picture reasonerjt  路  3Comments

Poil picture Poil  路  3Comments

Hotege picture Hotege  路  3Comments

mramanathan picture mramanathan  路  3Comments