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

GitLab notification fails: projectIdOrPath cannot be null

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • None
    • Jenkins 2.319.3
      GitLab Branch Source Plugin 1.5.9
      Gitlab API Plugin 1.0.6

    Description

      Running a multibranch pipeline normally notifies GitLab at the end of the build about the build status:

      [GitLab Pipeline Status] Notifying branch build status: SUCCESS BUILD_NAME: This commit looks good

      normally followed by

      [GitLab Pipeline Status] Notified

      Sometimes, the "Notified" message is missing. In GitLab the build will stay in "in progress" forever.

      In the Jenkins logs there is a stack trace which might be related:

      Exception caught: Cannot cast org.glassfish.jersey.inject.hk2.Hk2InjectionManagerFactory to org.glassfish.jersey.internal.inject.InjectionManagerFactory
      Feb. 11, 2022 3:36:51 NACHM. WARNUNG hudson.model.listeners.RunListener report
      RunListener failed
      java.lang.RuntimeException: projectIdOrPath cannot be null
      	at org.gitlab4j.api.CommitsApi.addCommitStatus(CommitsApi.java:572)
      	at io.jenkins.plugins.gitlabbranchsource.helpers.GitLabPipelineStatusNotifier.sendNotifications(GitLabPipelineStatusNotifier.java:321)
      	at io.jenkins.plugins.gitlabbranchsource.helpers.GitLabPipelineStatusNotifier.access$400(GitLabPipelineStatusNotifier.java:52)
      	at io.jenkins.plugins.gitlabbranchsource.helpers.GitLabPipelineStatusNotifier$JobCompletedListener.onCompleted(GitLabPipelineStatusNotifier.java:483)
      	at hudson.model.listeners.RunListener.fireCompleted(RunListener.java:208)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.finish(WorkflowRun.java:625)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$800(WorkflowRun.java:138)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun$GraphL.onNewHead(WorkflowRun.java:1045)
      	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.notifyListeners(CpsFlowExecution.java:1473)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$3.run(CpsThreadGroup.java:491)
      	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.run(CpsVmExecutorService.java:38)
      	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:139)
      	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
      	at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
      	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:834)
      

      When the problem occurred for the first time, I added "gitLabConnection(gitLabConnection: 'Gitlab')" to the pipeline "properties" because it seems to be related. But, the issue still sometimes manifest itself. I do not see any cause for the failure. Normally, simply rebuilding the job fixes the issue (but this is a problem for long running builds because be block the merge in GitLab as long as the pipeline is not marked as successful).

      Attachments

        Issue Links

          Activity

            As I saw in the code that it might be relevant:

            The issue has been seen in "normal" branch builds. I'm not sure if it ever happend in a MR build.

             

            The multibranch pipeline is configured with one SCM only, but loads two custom libraries from GitLab as well (all repositories are on the same server, though). There is only one GitLab connection configured in the Jenkins global settings

            gordin Christoph Vogtländer added a comment - As I saw in the code that it might be relevant: The issue has been seen in "normal" branch builds. I'm not sure if it ever happend in a MR build.   The multibranch pipeline is configured with one SCM only, but loads two custom libraries from GitLab as well (all repositories are on the same server, though). There is only one GitLab connection configured in the Jenkins global settings
            gordin Christoph Vogtländer added a comment - - edited

            An additional follow up: I just noticed that the "gitLabConnection(gitLabConnection: 'Gitlab')" is not related to the "GitLab Branch Source" plug-in, but to the "GitLab" plug-in which is installed as well on my instance (but currently not used)

            gordin Christoph Vogtländer added a comment - - edited An additional follow up: I just noticed that the "gitLabConnection(gitLabConnection: 'Gitlab')" is not related to the "GitLab Branch Source" plug-in, but to the "GitLab" plug-in which is installed as well on my instance (but currently not used)
            primeos Michael Weiss added a comment - This seems to be a duplicate of https://issues.jenkins.io/browse/JENKINS-66518 . See https://issues.jenkins.io/browse/JENKINS-66518?focusedCommentId=422181&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-422181  for how I finally "fixed" it (hopefully that'll work for you and others too).

            People

              baymac Parichay Barpanda
              gordin Christoph Vogtländer
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: