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

NPE when using with gitlab-plugin's statuses.

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      We are using gitlab-plugin to pushes statuses back to GitLab server and evaluating gitlab-branch-source-plugin for our need.

      Pipeline is failing with: "Null pointer exception" and prior that failure in Jenkins maser log:

      ...
      org.gitlab4j.api.GitLabApiException: Cannot transition status via :run from :running (Reason(s): Status cannot transition via "run")
      ...
      

      in pipeline we have something like that:

      ..
        steps {
          gitlabCommitStatus(STAGE_NAME) {
            container('deploy') {
               sh 'mvn deploy'
         }
      

      When I remove all "gitlabCommitStatus(STAGE_NAME)

      {" in all stages it starts working. Logs snapshot: {noformat}

      java.lang.NullPointerException
      at org.eclipse.jgit.lib.ObjectId.fromString(ObjectId.java:235)
      at com.dabsquared.gitlabjenkins.util.CommitStatusUpdater.retrieveGitlabProjectIds(CommitStatusUpdater.java:195)
      at com.dabsquared.gitlabjenkins.util.CommitStatusUpdater.updateCommitStatus(CommitStatusUpdater.java:61)
      at com.dabsquared.gitlabjenkins.util.CommitStatusUpdater.updateCommitStatus(CommitStatusUpdater.java:97)
      at com.dabsquared.gitlabjenkins.workflow.GitLabBuildsStep$GitLabBuildStepExecution$1.onStart(GitLabBuildsStep.java:85)
      at org.jenkinsci.plugins.workflow.cps.CpsBodyExecution.launch(CpsBodyExecution.java:135)
      at org.jenkinsci.plugins.workflow.cps.CpsBodyInvoker.launch(CpsBodyInvoker.java:187)
      at org.jenkinsci.plugins.workflow.cps.DSL$ThreadTaskImpl.lambda$invokeBodiesAndSwitchToAsyncMode$0(DSL.java:660)
      at org.jenkinsci.plugins.workflow.cps.CpsStepContext.withBodyInvokers(CpsStepContext.java:537)
      at org.jenkinsci.plugins.workflow.cps.DSL$ThreadTaskImpl.invokeBodiesAndSwitchToAsyncMode(DSL.java:650)
      at org.jenkinsci.plugins.workflow.cps.DSL$ThreadTaskImpl.eval(DSL.java:615)
      at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:195)
      at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:405)
      at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$400(CpsThreadGroup.java:96)
      at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:317)
      at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:281)
      at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:67)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
      at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
      at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      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)
      Finished: FAILURE

      
      

        Attachments

          Activity

          Hide
          tamerlaha ipleten added a comment -
          Show
          tamerlaha ipleten added a comment - Looks like NPE goes from gitlan-plugin in https://github.com/jenkinsci/gitlab-plugin/blob/master/src/main/java/com/dabsquared/gitlabjenkins/util/CommitStatusUpdater.java#L185 It expect class to be an instance of "AbstractGitSCMSource.SCMRevisionImpl" but for MergeRequest it's a "ChangeRequestSCMRevision" in https://github.com/jenkinsci/gitlab-branch-source-plugin/blob/master/src/main/java/io/jenkins/plugins/gitlabbranchsource/MergeRequestSCMRevision.java#L8
          Hide
          pleibiger Peter Leibiger added a comment -

          I am seeing the same stack without the nullpointer, only the second part.

          Show
          pleibiger Peter Leibiger added a comment - I am seeing the same stack without the nullpointer, only the second part.
          Hide
          tamerlaha ipleten added a comment - - edited

          I tried to fix the problem in gitlab-plugin:
          https://github.com/jenkinsci/gitlab-plugin/pull/1014
          https://github.com/jenkinsci/gitlab-plugin/pull/1012
          They haven't released that yet, but I checkout 1.5.13 (currently released as master breaks another things see: https://github.com/jenkinsci/gitlab-plugin/pull/916#issuecomment-57266272.) version and cherry-pick'ed both commits to branch and build self-hosted version.
          Give it a try.
          UPDATE: you right about log. I've updated summary with correct log.

          Show
          tamerlaha ipleten added a comment - - edited I tried to fix the problem in gitlab-plugin: https://github.com/jenkinsci/gitlab-plugin/pull/1014 https://github.com/jenkinsci/gitlab-plugin/pull/1012 They haven't released that yet, but I checkout 1.5.13 (currently released as master breaks another things see: https://github.com/jenkinsci/gitlab-plugin/pull/916#issuecomment-57266272 .) version and cherry-pick'ed both commits to branch and build self-hosted version. Give it a try. UPDATE: you right about log. I've updated summary with correct log.
          Hide
          tamerlaha ipleten added a comment -

          Should be fixed in gitlab-plugin-1.5.16

          Show
          tamerlaha ipleten added a comment - Should be fixed in gitlab-plugin-1.5.16
          Show
          tamerlaha ipleten added a comment - Fixed in https://github.com/jenkinsci/gitlab-plugin/pull/1014 https://github.com/jenkinsci/gitlab-plugin/pull/1012

            People

            Assignee:
            tamerlaha ipleten
            Reporter:
            tamerlaha ipleten
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: