We get a NullPointerException on every hook event with the current version of gitlab-branch-source (0.0.6-beta.5C).
07-Aug-2019 07:39:52.137 WARNING [class io.jenkins.plugins.gitlabbranchsource.GitLabMergeRequestSCMEvent Wed Aug 07 07:39:52 CEST 2019 / SCMEvent [#4]] jenkins.scm.api.SCMHeadEvent$DispatcherImpl.log SCMEventListener.onSCMHeadEvent(SCMHeadEvent) jenkins.branch.OrganizationFolder$SCMEventListenerImpl@6e03b818 propagated an exception
java.lang.NullPointerException
at io.jenkins.plugins.gitlabbranchsource.GitLabMergeRequestSCMEvent.isMatch(GitLabMergeRequestSCMEvent.java:59)
at io.jenkins.plugins.gitlabbranchsource.AbstractGitLabSCMHeadEvent.isMatch(AbstractGitLabSCMHeadEvent.java:22)
at jenkins.branch.OrganizationFolder$SCMEventListenerImpl.onSCMHeadEvent(OrganizationFolder.java:1062)
at jenkins.scm.api.SCMHeadEvent$DispatcherImpl.fire(SCMHeadEvent.java:246)
at jenkins.scm.api.SCMHeadEvent$DispatcherImpl.fire(SCMHeadEvent.java:229)
at jenkins.scm.api.SCMEvent$Dispatcher.run(SCMEvent.java:505)
at jenkins.security.ImpersonatingScheduledExecutorService$1.run(ImpersonatingScheduledExecutorService.java:58)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
The payload (logged before as INFO) looks fine:
07-Aug-2019 07:39:52.040 INFO [Handling POST /jenkins/gitlab-webhook/post from x.x.x.x : ajp-nio-8039-exec-6] org.gitlab4j.api.webhook.WebHookManager.handleRequest handleEvent: X-Gitlab-Event=Merge Request Hook
07-Aug-2019 07:39:52.048 INFO [Handling POST /jenkins/gitlab-webhook/post from x.x.x.x : ajp-nio-8039-exec-6] io.jenkins.plugins.gitlabbranchsource.GitLabWebhookListener.onMergeRequestEvent MR EVENT
07-Aug-2019 07:39:52.052 INFO [Handling POST /jenkins/gitlab-webhook/post from x.x.x.x : ajp-nio-8039-exec-6] io.jenkins.plugins.gitlabbranchsource.GitLabWebhookListener.onMergeRequestEvent {
"object_kind" : "merge_request",
"user" : {
...
},
"project" : {
...
"pathWithNamespace" : "demo/gitlab-jenkins",
...
}
...
Here the same for a push event
07-Aug-2019 07:39:52.237 WARNING [class io.jenkins.plugins.gitlabbranchsource.GitLabPushSCMEvent Wed Aug 07 07:39:51 CEST 2019 / SCMEvent [#7]] jenkins.scm.api.SCMHeadEvent$DispatcherImpl.log SCMEventListener.onSCMHeadEvent(SCMHeadEvent) jenkins.branch.OrganizationFolder$SCMEventListenerImpl@6e03b818 propagated an exception
java.lang.NullPointerException
at io.jenkins.plugins.gitlabbranchsource.GitLabPushSCMEvent.isMatch(GitLabPushSCMEvent.java:70)
...
Hi Christian, the log is pretty confusing as neither of the objects we are comparing should be null in any case. So the NPE is strange. On my machine I am not getting the same problem you are facing. I performed a GitLab Group Job type on my GitLab User account and the Push SCM and MR SCM Event are working fine. Can you retest the plugin by building hpi from the develop branch from repository? In that case please remove your old job and create a new job. What gitlab server version are you using?