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

Modernize to Jenkins 2.479 and Jakarta EE 9 #134

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mtughan
Copy link

@mtughan mtughan commented Nov 21, 2024

  • Adapter methods are added for old overrides.
  • Switch to JUnit 5 for tests

Required for the Scriptler plugin to modernize as well without breaking SSH compatibility.

Testing done

Unit tests updated and run.

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@mtughan mtughan requested a review from a team as a code owner November 21, 2024 15:02
@mtughan mtughan marked this pull request as draft November 21, 2024 16:40
@mtughan
Copy link
Author

mtughan commented Nov 21, 2024

Trying to figure out why SpotBugs is errantly flagging a null issue where one doesn’t exist and why it’s not suppressing.

@mtughan mtughan marked this pull request as ready for review November 21, 2024 17:48
@mtughan mtughan marked this pull request as draft November 21, 2024 18:53
@mtughan mtughan marked this pull request as ready for review November 21, 2024 19:34
@mtughan mtughan force-pushed the modernize-2.479 branch 2 times, most recently from 90bd3d1 to 0d96613 Compare November 22, 2024 15:18
@mtughan mtughan force-pushed the modernize-2.479 branch 2 times, most recently from bfb36e4 to f4a410b Compare December 2, 2024 19:23
@mtughan
Copy link
Author

mtughan commented Dec 11, 2024

@jenkinsci/git-server-plugin-developers, please review when able.

@basil basil added the internal label Jan 17, 2025
Copy link
Member

@basil basil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

@@ -56,6 +55,7 @@ public FetchConnection openFetch() throws NotSupportedException, TransportExcept
} catch (IOException e) {
throw new TransportException("Failed to open a fetch connection",e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not appear to be related to the stated PR goal?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was flagged by the SonarQube for IDE in my IntelliJ IDEA (rule java:S1242). I've been fixing a bunch of other issues like this and so wanted to fix it here too. However, if you'd prefer it to be dropped, I can do so. I'm not stuck on getting that in.

@@ -60,11 +63,27 @@ public HttpGitRepository() {
*
* @see ReceivePackFactory#create(Object, Repository)
*/
public abstract ReceivePack createReceivePack(HttpServletRequest context, Repository db) throws ServiceNotEnabledException, ServiceNotAuthorizedException;
@SuppressWarnings({"deprecated", "java:S1874"})
Copy link
Member

@basil basil Feb 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coming back to this PR, this is the only part I feel uneasy about. It implements the compatibility layer in the opposite way that Jenkins core did in jenkinsci/jenkins#9672, by having the new functionality delegate to the old rather than having the old functionality delegate to the new. This also makes it harder to eventually remove the old functionality. For consistency, I would want to see this compatibility layer implemented the same way as jenkinsci/jenkins#9672 or jenkinsci/cloudbees-folder-plugin#444.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, weird. I don't remember why I did this now. I'll flip it around.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, the closest analog I can find for this method (as I needed to change the signature of an abstract method, not a concrete method) is ReconfigurableDescribable in jenkinsci/jenkins#9672, as it's an interface and one of the interface methods needed to change. In that scenario, the interface method was changed into 2 default methods that both check if the other is present. I will take this approach, changing the abstract method into the 2 concrete methods I've already done, but by having both check for the presence of the other.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ParameterDefinition is an example of an abstract method that doesn't throw an exception. For one that does, View#submit is an example.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I missed those ones. I think what I've gotten is quite close to View#submit.

* Adapter methods are added for old overrides.
* Switch to JUnit 5 for tests
Copy link
Author

@mtughan mtughan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for the larger diff between the commits. I discovered that Spotless hadn't been run on the plugin code, so I made one more commit before mine that runs Spotless first.

@@ -60,11 +63,27 @@ public HttpGitRepository() {
*
* @see ReceivePackFactory#create(Object, Repository)
*/
public abstract ReceivePack createReceivePack(HttpServletRequest context, Repository db) throws ServiceNotEnabledException, ServiceNotAuthorizedException;
@SuppressWarnings({"deprecated", "java:S1874"})
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, the closest analog I can find for this method (as I needed to change the signature of an abstract method, not a concrete method) is ReconfigurableDescribable in jenkinsci/jenkins#9672, as it's an interface and one of the interface methods needed to change. In that scenario, the interface method was changed into 2 default methods that both check if the other is present. I will take this approach, changing the abstract method into the 2 concrete methods I've already done, but by having both check for the presence of the other.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants