Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-73775] Replace call to removed CommitBuilder.setEncoding(String) #2578

Merged
merged 2 commits into from
Sep 16, 2024

Conversation

MarkEWaite
Copy link
Contributor

[JENKINS-73775] Replace call to removed CommitBuilder.setEncoding(String)

See JENKINS-73775

JGit 7.0.0 removed the setEncoding(String) method that had been deprecated previously. The replacement is setEncoding(Charset). The JGit documentation recommends commit.setEncoding(StandardCharsets.UTF_8)

Failure was hidden by the previous setLastModified() exception because this call happens later in the same calling sequence.

Exclude org.eclipse.jgit from transitive inclusion in the git-pipeline plugin

The org.eclipse.jgit jar file is already provided by the git client plugin. Let's not risk that a 6.9.0 copy of the library is loaded into the same Java process that is running either JGit 6.10.0 (with git client plugin 5.0.0) or JGit 7.0.0 with git client plugin 6.0.0)

Testing done

Confirmed that the steps that show the error in JENKINS-73775 are passing with a snapshot build of the plugin. Steps are:

  1. 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
  2. Create a private key credential in the Jenkins controller using the ECDSA private key with git client plugin 5.0.0 installed
  3. 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
  4. After the multibranch Pipeline job runs, open Blue Ocean from the multibranch Pipeline job page
  5. Confirm that all the branches are shown on the Blue Ocean page and that the pencil icon is displayed for each of the branches
  6. Click the pencil icon to open the Blue Ocean editor, edit the job definition, and save it as a new branch
  7. Confirm that the new branch is saved and the job runs
  8. Upgrade git client plugin from 5.0.0 to 6.0.0 and restart the controller
  9. Run the job from the new branch to confirm it works
  10. Click the pencil icon to edit the Jenkinsfile, make a change, and save it

Submitter checklist

  • Link to JIRA ticket in description, if appropriate.
  • Change is code complete and matches issue description
  • Appropriate unit or acceptance tests or explanation to why this change has no tests
  • Reviewer's manual test instructions provided in PR description. See Reviewer's first task below.

Reviewer checklist

  • Run the changes and verified the change matches the issue description
  • Reviewed the code
  • Verified that the appropriate tests have been written or valid explanation given

…ing)

JGit 7.0.0 removed the setEncoding(String) method that had been
deprecated previously.  The replacement is setEncoding(Charset).  The JGit
documentation recommends commit.setEncoding(StandardCharsets.UTF_8)

Failure was hidden by the previous setLastModified() exception because
this call happens later in the same calling sequence.
The org.eclipse.jgit jar file is already provided by the git client
plugin.  Let's not risk that a 6.9.0 copy of the library is loaded into
the same Java process that is running either JGit 6.10.0 (with git client
plugin 5.0.0) or JGit 7.0.0 with git client plugin 6.0.0)
@MarkEWaite MarkEWaite requested a review from a team as a code owner September 16, 2024 03:25
@olamy olamy merged commit 88cbc39 into jenkinsci:master Sep 16, 2024
16 checks passed
@MarkEWaite MarkEWaite deleted the replace-deprecated-jgit-use branch September 16, 2024 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants