Hi all,

I am working on adding webhook support in GitLab Branch Source Plugin. 

Current implementation looks like this:

1. When `afterSave()` method is called upon in `GitLabSCMSource` or 
`GitLabSCMNavigator` then a webhook url is created in the GitLab Server by 
`GitLabWebhookCreator` class. Creation of webhook depend on the mode chosen 
by user.

2. When an event occurs in GitLab Server, `GitLabWebhookAction` class which 
implements an `UnprotectedRootAction` processes the http request.

3. The request is then sent to `GitLabWebhookManager` class which is 
provided with a listener called `GitLabWebhookListener` which listens to 
the GitLabEvent.

4. `GitLabWebhookListener` provides the onEvent methods like 
`onMergeRequest`, `onPushEvent` etc. The `GitLabWebhookListener` works 
correctly and each method gets their respective GitLab event. (as is logged)

5. With the help of GitLab specific event object(`PushEvent`, 
`MergeRequestEvent` etc) now I am creating a Jenkins specific SCMHeadEvent 
e.g. `GitLabPushSCMEvent`, `GitLabMergeRequestSCMEvent` etc. 

6. Now when I fire any of these event e.g. 
`SCMHeadEvent.fireNow(GitLabPushSCMEvent)`, it doesn't fire the event.

I know all this is confusing, looking at the codebase can help? 
https://github.com/jenkinsci/gitlab-branch-source-plugin/.

I want to know how does an `SCMSource` or `SCMNavigator` listen to a 
SCMHeadEvent? I think in all the above implementation I have missed the 
part of setting a listener on source and navigator itself as they don't 
receive any project events. At the same time I am unable to figure out how 
to setup a listener on them. Can someone help me with this? Some toplevel 
idea of how SCMHeadEvent works will also be a big help for me.

Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/b69258ed-b68d-4440-ab3d-fa274ae485a0%40googlegroups.com.

Reply via email to