Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-58839

NPE in GitLabMergeRequestSCMEvent and GitLabPushSCMEvent

    Details

    • Similar Issues:
    • Sprint:
      GSoC 2019. Coding Phase 3

      Description

      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)
      ...

        Attachments

          Activity

          derkoe Christian Köberl created issue -
          Hide
          baymac Parichay Barpanda added a comment -

          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?

          Show
          baymac Parichay Barpanda added a comment - 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?
          baymac Parichay Barpanda made changes -
          Field Original Value New Value
          Epic Link JENKINS-57538 [ 199446 ]
          baymac Parichay Barpanda made changes -
          Labels gsoc-2019
          Sprint GSoC 2019. Coding Phase 3 [ 696 ]
          Hide
          derkoe Christian Köberl added a comment -

          > neither of the objects we are comparing should be null in any case
          I also looked at the code and yes that seems strange.

          >  Can you retest the plugin by building hpi from the develop branch from repository?
          Yes I will do that but I'll need until tomorrow. I will also add some logging in the isMatch method.

          > What gitlab server version are you using?
          We are running 12.0.4 - but I think this does not matter since the JSON payload looks OK.

          Show
          derkoe Christian Köberl added a comment - > neither of the objects we are comparing should be null in any case I also looked at the code and yes that seems strange. >  Can you retest the plugin by building hpi from the develop branch from repository? Yes I will do that but I'll need until tomorrow. I will also add some logging in the isMatch method. > What gitlab server version are you using? We are running 12.0.4 - but I think this does not matter since the JSON payload looks OK.
          Hide
          derkoe Christian Köberl added a comment -

          The current develop version built by me works without issues.

          Show
          derkoe Christian Köberl added a comment - The current develop version built by me works without issues.
          baymac Parichay Barpanda made changes -
          Status Open [ 1 ] Fixed but Unreleased [ 10203 ]
          Resolution Fixed [ 1 ]

            People

            • Assignee:
              baymac Parichay Barpanda
              Reporter:
              derkoe Christian Köberl
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: