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

Fix binary compatibility for PullRequestSCMRevision.getPull #817

Merged
merged 1 commit into from
Feb 28, 2024

Conversation

rsandell
Copy link
Member

The signature change in recent release caused NoSuchMethodError in plugins that are compiled against the old code.

I've tested it with the PCT and ATH of the affected plugin (cloudbees internal).

Your checklist for this pull request

  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side) and not your master branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or in Jenkins JIRA
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Did you provide a test-case? That demonstrates feature works or fixes the issue.

@rsandell
Copy link
Member Author

@andrey-fomin For some reason I can't request you as a reviewer, so here is a normal ping. 🤷

@andrey-fomin
Copy link
Contributor

For me this fix looks ok.
Another approach can be just returning method with old signature and casting to required type where needed.

andrey-fomin added a commit to andrey-fomin/bitbucket-branch-source-plugin that referenced this pull request Feb 28, 2024
Method `getPull` is used in some private plugins.
jenkinsci#796 changed signature of this method.

Now signature is returned back.
See also jenkinsci#817.
andrey-fomin added a commit to andrey-fomin/bitbucket-branch-source-plugin that referenced this pull request Feb 28, 2024
Method `getPull` is used in some private plugins.
jenkinsci#796 changed signature of this method.

Now signature is returned back.
See also jenkinsci#817.
@andrey-fomin
Copy link
Contributor

andrey-fomin commented Feb 28, 2024

Created #818 with alternative fix. Please can you check it. For me both approaches are ok.

Just little comment maybe for future development. I would suggest to use approach similar to atlassian-bitbucket-server-integration plugin. In this plugin all the hashes are stored in the Head object. And Revision objects are just created from the Head objects. It allows to properly handle the case when revision is not available. For example when build is stared using following method https://github.com/jenkinsci/scm-api-plugin/blob/master/src/main/java/jenkins/scm/api/SCMSource.java#L934

@rsandell rsandell merged commit bbd5243 into jenkinsci:master Feb 28, 2024
16 checks passed
@rsandell rsandell deleted the getpullbinarycompat branch February 28, 2024 15:19
Comment on lines +157 to +161
<dependency>
<groupId>com.infradna.tool</groupId>
<artifactId>bridge-method-annotation</artifactId>
<version>1.29</version>
</dependency>
Copy link
Member

Choose a reason for hiding this comment

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

This is delivered by Jenkins core, so this dependency isn't needed. While in general it is a best practice to declare direct dependencies rather than consuming a transitive dependency without declaring it, with Jenkins plugins we usually recommend the opposite (not declaring a dependency and consuming it transitively via core) in order to avoid bloating JPIs with unused JARs in WEB-INF/lib and dealing with Enforcer issues.

Copy link
Member Author

Choose a reason for hiding this comment

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

It wasn't in my classpath when I did the implementation.

@basil basil mentioned this pull request Mar 11, 2024
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.

4 participants