-
Task
-
Resolution: Fixed
-
Minor
-
None
-
Jenkins 3.463 and newer
Git client plugin 6.0.0 (with JGit 7.0.0)
When the blue ocean plugin performs a git commit, it may fail with Jenkins 2.463 and later if git client plugin 6.0.0 is installed. Git client plugin 6.0.0 includes JGit 7.0.0 and JGit 7.0.0 removes methods that were previously deprecated.
The DirCacheEntry.setLastModified(long) signature was deprecated in JGit 5.1.11 and has been removed from JGit 7.0.0.
I've confirmed that I can see the issue with interactive testing of Jenkins 2.476 using git client plugin 6.0.0. When I replace git client plugin 6.0.0 with git client plugin 5.0.0 the issue does not appear. In order to duplicate it with Jenkins 2.476, I had to use a FreeBSD git server (git.markwaite.net) where I could add the RSA SHA-1 public key that Blue Ocean generates to ~/.ssh/authorized_keys. I can't do that with github.com because github.com no longer accepts RSA SHA-1 public keys and that seems to be the only type of key that the Blue Ocean Pipeline editor will generate.
Steps that I used to show the issue with a repository on git.markwaite.net (a FreeBSD machine where I host git repositories inside my network):
- Create an ECDSA private key on the client machine and add its public key to ~/.ssh/authorized_keys in the mwaite account on git.markwaite.net
- Create a private key credential in the Jenkins controller using the ECDSA private key with git client plugin 5.0.0 installed
- Create a multibranch Pipeline job using the Git source code provider, the repository URL mwaite@git.markwaite.net:git/bare/bin.git, and the private key credential defined in the previous step
- After the multibranch Pipeline job runs, open Blue Ocean from the multibranch Pipeline job page
- Confirm that all the branches are shown on the Blue Ocean page and that the pencil icon is displayed for each of the branches
- Click the pencil icon to open the Blue Ocean editor, edit the job definition, and save it as a new branch
- Confirm that the new branch is saved and the job runs
- Upgrade git client plugin from 5.0.0 to 6.0.0 and restart the controller
- Run the job from the new branch to confirm it works
- Click the pencil icon to edit the Jenkinsfile, make a change, and save it
- Note the error message in the Jenkins log
2024-09-14 23:04:46.590+0000 [id=28] WARNING h.i.i.InstallUncaughtExceptionHandler#handleException: Caught unhandled exception with ID 1322e6ce-89f7-4af0-b13d-d9f61e88a177 java.lang.NoSuchMethodError: 'void org.eclipse.jgit.dircache.DirCacheEntry.setLastModified(long)' at PluginClassLoader for blueocean-git-pipeline//io.jenkins.blueocean.blueocean_git_pipeline.GitUtils.createTemporaryIndex(GitUtils.java:414) at PluginClassLoader for blueocean-git-pipeline//io.jenkins.blueocean.blueocean_git_pipeline.GitUtils.commit(GitUtils.java:339) at PluginClassLoader for blueocean-git-pipeline//io.jenkins.blueocean.blueocean_git_pipeline.GitBareRepoReadSaveRequest.lambda$save$1(GitBareRepoReadSaveRequest.java:131) at PluginClassLoader for git//jenkins.plugins.git.GitSCMFileSystem.lambda$invoke$e8567d7e$1(GitSCMFileSystem.java:185)
My sincere apologies that I released git client plugin 6.0.0 without checking usages in plugins. I should have done that as part of the release preparation process, since there are breaking changes in the transition from JGit 6 to JGit 7 and the git client plugin is intentionally the provider of JGit for Jenkins plugins.
Additional failure
The initial failure is immediately followed by another failure that is reported in 1.27.15 as
2024-09-16 03:36:01.064+0000 [id=89] WARNING o.e.j.e.n.ContextHandler$APIContext#log: Error while serving http://testing-b.markwaite.net:8080/blue/rest/organizations/jenkins/pipelines/bin-multibranch-git.markwaite.net/scm/content/ java.lang.NoSuchFieldError: Class org.eclipse.jgit.lib.Constants does not have member field 'java.lang.String CHARACTER_ENCODING' at PluginClassLoader for blueocean-git-pipeline//io.jenkins.blueocean.blueocean_git_pipeline.GitUtils.commit(GitUtils.java:347) at PluginClassLoader for blueocean-git-pipeline//io.jenkins.blueocean.blueocean_git_pipeline.GitBareRepoReadSaveRequest.lambda$save$1(GitBareRepoReadSaveRequest.java:131) at PluginClassLoader for git//jenkins.plugins.git.GitSCMFileSystem.lambda$invoke$e8567d7e$1(GitSCMFileSystem.java:185) at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.withRepository(AbstractGitAPIImpl.java:28)
I've submitted a pull request 2578 to fix my mistake and have interactively tested that pull request to confirm that it passes the test steps documented above.
- is related to
-
JENKINS-73780 Checkout fails with setForce() method not found exception with git client 6.0.0 and later
- Open
-
JENKINS-73781 Last change publishing fails with peel() method not found in git client 6.0.0 and later
- Closed
- links to