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 deprecated call to JGit setLastModified(long) #2572

Merged
merged 1 commit into from
Sep 15, 2024

Conversation

MarkEWaite
Copy link
Contributor

@MarkEWaite MarkEWaite commented Sep 14, 2024

[JENKINS-73775] Replace deprecated call to JGit setLastModified(long)

See JENKINS-73775

JGit 5 deprecated the DirCacheEntry.setLastModified(long) method and recommends DirCacheEntry.setLastModified(Instant). JGit 7.0.0 removes DirCacheEntry.setLastModified(long). This change will work with older versions of JGit (like 6.9.0 and 6.10.0) and JGit 7.0.0 because the replacement method is available with older versions and the most recent release.

Javadoc for JGit 6.9.0 shows the deprecation.

Without this change, users that try to run a commit from the Git portion of Blue Ocean may see a method not found exception that will fail the operation.

No additional tests because the automated tests running in plugin BOM are what showed the issue.

This needs to be merged and released soon so that users of Jenkins weekly 2.463 and later do not see the method not found exception when they install git client plugin 6.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 they no longer accept RSA SHA-1 public keys.

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

JGit 5 deprecated the DirCacheEntry.setLastModified(long) method and
recommends DirCacheEntry.setLastModified(Instant).  JGit 7.0.0 removes
DirCacheEntry.setLastModified(long).  This change will work with old
versions of JGit and JGit 7.0.0 because the replacement method is
available with older versions and the most recent release.

Javadoc for JGit 6.9.0 is available at
https://javadoc.io/doc/org.eclipse.jgit/org.eclipse.jgit/6.9.0.202403050737-r/org.eclipse.jgit/org/eclipse/jgit/dircache/DirCacheEntry.html

Without this change, users that try to run the Git portion of Blue Ocean
may see a method not found exception that will fail the operation.
@MarkEWaite MarkEWaite requested a review from a team as a code owner September 14, 2024 05:08
MarkEWaite added a commit to MarkEWaite/bom that referenced this pull request Sep 14, 2024
1.27.15-rc4520.67a_b_91263b_f9 is the incremental built from:

* jenkinsci/blueocean-plugin#2572
MarkEWaite added a commit to MarkEWaite/bom that referenced this pull request Sep 14, 2024
jenkinsci/blueocean-plugin#2572 proposes the
fix for the next release of the blueocean plugin.
@olamy olamy merged commit 74f5e38 into jenkinsci:master Sep 15, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants