jenkinsci / jenkinsci/gitlab-branch-source-plugin
[JENKINS-67817] GitLab notification fails: projectIdOrPath cannot be null
- Dominant language
- Java
- Stars
- 134
- Forks
- 113
- PR merge metrics
- No merged PRs in 30d
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).
---
Originally reported by
gordin, imported from: GitLab notification fails: projectIdOrPath cannot be null
baymac
Raw content of original issue
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 goodnormally followed by
[GitLab Pipeline Status] NotifiedSometimes, 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).
environment
```
Jenkins 2.319.3
GitLab Branch Source Plugin 1.5.9
Gitlab API Plugin 1.0.6
```
Contributor guide
Assessment
This issue has not been assessed yet.