checkout fails due to issue with JGit 5.0.2 (in 3.0.0.beta-5)

Details

Description

when running checkout scm I get the error:

java.lang.NoSuchMethodError: org.eclipse.jgit.lib.Repository.getRef(Ljava/lang/String;)Lorg/eclipse/jgit/lib/Ref;
at jenkins.plugins.git.GitSCMFileSystem$1.invoke(GitSCMFileSystem.java:117)
at jenkins.plugins.git.GitSCMFileSystem$1.invoke(GitSCMFileSystem.java:114)
at jenkins.plugins.git.GitSCMFileSystem$3.invoke(GitSCMFileSystem.java:193)
at org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.withRepository(AbstractGitAPIImpl.java:28)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.withRepository(CliGitAPIImpl.java:75)
at jenkins.plugins.git.GitSCMFileSystem.invoke(GitSCMFileSystem.java:189)
at jenkins.plugins.git.GitSCMFileSystem.<init>(GitSCMFileSystem.java:114)
at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:353)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:196)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:172)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:108)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:67)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:303)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE

I suspect this is related to introducing JGit5.02 in 3.0.0.beta-5 When I step back to 2.7.3 it all works fine.

I'd like to use the new beta because shallow clone of submodules is supported.

Attachments

Activity

A new beta release of the git plugin is needed, both to resolve that NoSuchMethodError and to provide shallow submodule update support in the git plugin. The current git plugin beta does not include shallow submodule update support and still contains a reference to a symbol that JGit 4.x deprecated and JGit 5.x removed.

You can use git client plugin 3.0.0-beta5 and the git plugin pull request build now to evaluate shallow clone of submodules. When you've evaluated that build, please describe your results on the pull request. That will be one more step to speed the merge of that pull request into the git plugin.

Mark Waite
added a comment - 2018-08-13 14:09 - edited A new beta release of the git plugin is needed, both to resolve that NoSuchMethodError and to provide shallow submodule update support in the git plugin. The current git plugin beta does not include shallow submodule update support and still contains a reference to a symbol that JGit 4.x deprecated and JGit 5.x removed.
You can use git client plugin 3.0.0-beta5 and the git plugin pull request build now to evaluate shallow clone of submodules. When you've evaluated that build, please describe your results on the pull request . That will be one more step to speed the merge of that pull request into the git plugin.

java.lang.NoSuchMethodError: org.eclipse.jgit.lib.Repository.getRef(Ljava/lang/String;)Lorg/eclipse/jgit/lib/Ref;
at jenkins.plugins.git.GitSCMFileSystem$1.invoke(GitSCMFileSystem.java:117)
at jenkins.plugins.git.GitSCMFileSystem$1.invoke(GitSCMFileSystem.java:114)
at jenkins.plugins.git.GitSCMFileSystem$3.invoke(GitSCMFileSystem.java:193)
at org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.withRepository(AbstractGitAPIImpl.java:28)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.withRepository(CliGitAPIImpl.java:75)
at jenkins.plugins.git.GitSCMFileSystem.invoke(GitSCMFileSystem.java:189)
at jenkins.plugins.git.GitSCMFileSystem.<init>(GitSCMFileSystem.java:114)
at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:353)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:196)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:172)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:108)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:67)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:303)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE

I suspect this is related to introducting JGit5.02 in 3.0.0.beta-5 When I step back to 2.7.3 it all works fine.

I'd like to use the new beta because shallow clone of submodules is supported.

when running checkout scm I get the error:

{noformat}
java.lang.NoSuchMethodError: org.eclipse.jgit.lib.Repository.getRef(Ljava/lang/String;)Lorg/eclipse/jgit/lib/Ref;
at jenkins.plugins.git.GitSCMFileSystem$1.invoke(GitSCMFileSystem.java:117)
at jenkins.plugins.git.GitSCMFileSystem$1.invoke(GitSCMFileSystem.java:114)
at jenkins.plugins.git.GitSCMFileSystem$3.invoke(GitSCMFileSystem.java:193)
at org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.withRepository(AbstractGitAPIImpl.java:28)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.withRepository(CliGitAPIImpl.java:75)
at jenkins.plugins.git.GitSCMFileSystem.invoke(GitSCMFileSystem.java:189)
at jenkins.plugins.git.GitSCMFileSystem.<init>(GitSCMFileSystem.java:114)
at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:353)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:196)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:172)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:108)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:67)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:303)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE
{noformat}

I suspect this is related to introducing JGit5.02 in 3.0.0.beta-5 When I step back to 2.7.3 it all works fine.

I'd like to use the new beta because shallow clone of submodules is supported.

Johannes Meixner please provide more details why you believe this is still a problem with git client plugin 3.0.0-rc and git plugin 4.0.0-rc. After you installed those two new versions of the plugin, did you restart your Jenkins server? They are working for me and for other users as well.

Mark Waite
added a comment - 2019-02-05 12:45 Johannes Meixner please provide more details why you believe this is still a problem with git client plugin 3.0.0-rc and git plugin 4.0.0-rc. After you installed those two new versions of the plugin, did you restart your Jenkins server? They are working for me and for other users as well.

Johannes Meixner
added a comment - 2019-02-06 11:12 What I did was
Upgraded Jenkins from 2.138.3 to 2.150.2
Upgraded git client to 3.0.0-rc
Upgraded git plugin to 4.0.0-rc
Restarted Jenkins
Restarted Jenkins nodes
Nodes wouldn't be able to run most jobs
I then downgraded to 2.138.3 again, to see if it was the Jenkins version update gone wrong ... it wasn't.
Then did some back and forth (including multiple restarts) until I noticed this issue on Google.

Bitbucket Build Status Notifier Plugin no longer updating branches with build status. This plugin depends on Git plugin and after downgrading Git plugin to 3.9.1, build status started showing on branches again

Some builds started failing with the following error. Downgrading Git client plugin to 2.7.6 fixed the issue

java.lang.NoSuchMethodError: org.eclipse.jgit.lib.Repository.getRef(Ljava/lang/String;)Lorg/eclipse/jgit/lib/Ref;
at jenkins.plugins.git.GitSCMFileSystem$1.invoke(GitSCMFileSystem.java:117)
at jenkins.plugins.git.GitSCMFileSystem$1.invoke(GitSCMFileSystem.java:114)
at jenkins.plugins.git.GitSCMFileSystem$3.invoke(GitSCMFileSystem.java:193)
at org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.withRepository(AbstractGitAPIImpl.java:29)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.withRepository(CliGitAPIImpl.java:81)
at jenkins.plugins.git.GitSCMFileSystem.invoke(GitSCMFileSystem.java:189)
at jenkins.plugins.git.GitSCMFileSystem.<init>(GitSCMFileSystem.java:114)
at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:353)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:198)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:174)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:108)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:67)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:293)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE

Hamza Boulaares
added a comment - 2019-02-06 16:34 - edited I am having the same issue as Johannes Meixner . I am running Jenkins 2.150.2 and today I upgraded:
Git client to 3.0.0-rc
Git plugin to 4.0.0-rc
I had the following behavior:
Bitbucket Build Status Notifier Plugin no longer updating branches with build status. This plugin depends on Git plugin and after downgrading Git plugin to 3.9.1, build status started showing on branches again
Some builds started failing with the following error. Downgrading Git client plugin to 2.7.6 fixed the issue
java.lang.NoSuchMethodError: org.eclipse.jgit.lib.Repository.getRef(Ljava/lang/String;)Lorg/eclipse/jgit/lib/Ref;
at jenkins.plugins.git.GitSCMFileSystem$1.invoke(GitSCMFileSystem.java:117)
at jenkins.plugins.git.GitSCMFileSystem$1.invoke(GitSCMFileSystem.java:114)
at jenkins.plugins.git.GitSCMFileSystem$3.invoke(GitSCMFileSystem.java:193)
at org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.withRepository(AbstractGitAPIImpl.java:29)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.withRepository(CliGitAPIImpl.java:81)
at jenkins.plugins.git.GitSCMFileSystem.invoke(GitSCMFileSystem.java:189)
at jenkins.plugins.git.GitSCMFileSystem.<init>(GitSCMFileSystem.java:114)
at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:353)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:198)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:174)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:108)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:67)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:293)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE

I'm getting the same issue using the Artifactory plugin. Upgraded Jenkins to latest LTS (2.150.2) & updated all my out of date plugins and all of a sudden the rtGradleRun pipeline task just hangs eternally with no logs in job console or Jenkins logs indicating anything wrong. Downloaded & debugged the artifactory plugin source & managed to uncover this same NoMethodFoundError.

This ticket is marked fixed but I see no commits in the Git-client-plugins github repo that reference it and the 3.0.0-rc version of the plugin was published to https://plugins.jenkins.io/git-client on Jan 30. Rolling back the Git & Git-client plugins to the non-rc versions fixed the issue.

David Rutherford
added a comment - 2019-02-07 16:42 I'm getting the same issue using the Artifactory plugin. Upgraded Jenkins to latest LTS (2.150.2) & updated all my out of date plugins and all of a sudden the rtGradleRun pipeline task just hangs eternally with no logs in job console or Jenkins logs indicating anything wrong. Downloaded & debugged the artifactory plugin source & managed to uncover this same NoMethodFoundError.
This ticket is marked fixed but I see no commits in the Git-client-plugins github repo that reference it and the 3.0.0-rc version of the plugin was published to https://plugins.jenkins.io/git-client on Jan 30. Rolling back the Git & Git-client plugins to the non-rc versions fixed the issue.
Is there a timeline for when we can expect the fix to actually get built & pushed to the https://plugins.jenkins.io?

David Rutherford, the problem you're seeing is a problem in the artifactory plugin, not a problem in the git client plugin.

The artifactory plugin depends on JGit version 3. Git client plugin 2.x delivered JGit version 4 which was largely compatible with JGit version 3 but deprecates some API's that were part of JGit 3. Git client plugin 3.x will deliver JGit 5 which removes at least one of the deprecated APIs.

The artifactory plugin developers have created a pre-release of their plugin that uses the JGit 4 and JGit 5 API instead of the JGit 3 API.

Your best near term solution is to downgrade to git client plugin 2.7.x. The git client plugin 3.0.0-rc and git plugin 4.0.0-rc were intended to be release candidate builds for further testing in the experimental update center. They were not intended to be production releases for general availability. I made a serious mistake when I chose the "-rc" suffix for the release.

Mark Waite
added a comment - 2019-02-07 19:55 David Rutherford, the problem you're seeing is a problem in the artifactory plugin, not a problem in the git client plugin.
The artifactory plugin depends on JGit version 3. Git client plugin 2.x delivered JGit version 4 which was largely compatible with JGit version 3 but deprecates some API's that were part of JGit 3. Git client plugin 3.x will deliver JGit 5 which removes at least one of the deprecated APIs.
The artifactory plugin developers have created a pre-release of their plugin that uses the JGit 4 and JGit 5 API instead of the JGit 3 API.
Your best near term solution is to downgrade to git client plugin 2.7.x. The git client plugin 3.0.0-rc and git plugin 4.0.0-rc were intended to be release candidate builds for further testing in the experimental update center. They were not intended to be production releases for general availability. I made a serious mistake when I chose the "-rc" suffix for the release.
The update center will soon hide the git client plugin 3.0.0-rc and git plugin 4.0.0-rc release

My apologies Mark Waite, I naturally should have thought about the problem from the "opposite direction". I made the mistake of updating my test Jenkins instance plugins wholesale without taking a backup of the plugins dir first and went into panic-mode once my pipeline job started hanging without any sort of logs indicating errors. Then I managed to crater my entire install & had to restart from a completely clean install making it even harder to figure out where the problem plugin was. I was certain the issue was somewhere in the recently updated Pipeline: step api plugins until I encountered this error in the debugger. On the plus side, this was just a test instance running on my local machine & it forced me to learn how to debug Jenkins plugins but I was definitely pulling my hair out for a bit there.

David Rutherford
added a comment - 2019-02-07 20:11 My apologies Mark Waite , I naturally should have thought about the problem from the "opposite direction". I made the mistake of updating my test Jenkins instance plugins wholesale without taking a backup of the plugins dir first and went into panic-mode once my pipeline job started hanging without any sort of logs indicating errors. Then I managed to crater my entire install & had to restart from a completely clean install making it even harder to figure out where the problem plugin was. I was certain the issue was somewhere in the recently updated Pipeline: step api plugins until I encountered this error in the debugger. On the plus side, this was just a test instance running on my local machine & it forced me to learn how to debug Jenkins plugins but I was definitely pulling my hair out for a bit there.