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-75410] extends AbstractGitSCMSource for BitbucketSCMSource #1006

Open
wants to merge 1 commit into
base: 935.1.x
Choose a base branch
from

Conversation

gboucherie
Copy link

@gboucherie gboucherie commented Mar 12, 2025

Change BitbucketSCMSource extended class to AbstractGitSCMSource to be fully compatible with Pipeline: Multibranch build strategy extension.
Otherwise the srategy extension plugin throws an exception when trying to get the changeset to apply the strategy defined in the job.

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.

@gboucherie gboucherie changed the base branch from master to 935.1.x March 12, 2025 13:05
scmSource.getServerUrl(),
scmSource.getOwner(),
BitbucketSCMSource.DescriptorImpl.SAME.equals(
scmSource.getCheckoutCredentialsId()) ? credentialsId :

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
BitbucketSCMSource.getCheckoutCredentialsId
should be avoided because it has been deprecated.
scmSource.getOwner(),
BitbucketSCMSource.DescriptorImpl.SAME.equals(
scmSource.getCheckoutCredentialsId()) ? credentialsId :
scmSource.getCheckoutCredentialsId(),

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
BitbucketSCMSource.getCheckoutCredentialsId
should be avoided because it has been deprecated.
@nfalco79
Copy link
Member

Otherwise the srategy extension plugin throws an exception when trying to get the changeset to apply the strategy defined in the job.

Which is this exception? Why the "Multibranch build strategy extension" does not use the interface API instead of the abstract class?

@gboucherie
Copy link
Author

The exception is a ClassCastException because on this line when calling the build method the BitbucketSourceScm cannot be cast to AbstractGitSCMSource.

I also try to change the code in other plugin to get the SCMFileSystem.Builder corresponding to the current SCMSource but the SCMFileSystem must implement the changesSince() methods for the plugin to get the change set. And implementation BitbucketSCMFileSystem doesn't leading to another exception.

@nfalco79
Copy link
Member

but the SCMFileSystem must implement the changesSince()

See JENKINS-49417.
AbstractGit....class to build the changelog rely on git cli operation (that why I would not get this way) where maybe code is not yet cloned or checkout (insted of the lightweight checkout using API to get diff).

@gboucherie
Copy link
Author

Ok, I understand your point. Thanks

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