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

Updates SCM URLs in POM files from git:// to https:// protocol. #560

Merged
merged 11 commits into from
Jan 4, 2025

Conversation

nagu165
Copy link
Contributor

@nagu165 nagu165 commented Jan 2, 2025

Needs further Review
GitHub has deprecated one of the unauthenticated access protocols (git:// protocol). The pom.xml section that defines the scm for the plugin should refer to the repository with the https:// protocol instead of the git:// protocol

Testing done

This pr still needs some additional review.
What i did till now: Added a recipe in recipes.yml
Created UpdatedScmUrl.java, UpdatedScmUrlVisitor.java, UpdatedScmUrlTest.java

Submitter checklist

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

@nagu165 nagu165 requested a review from jonesbusy as a code owner January 2, 2025 13:40
Copy link
Member

@krisstern krisstern left a comment

Choose a reason for hiding this comment

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

Your formatting needs a bit tweaking

plugin-modernizer-core/pom.xml Outdated Show resolved Hide resolved
@krisstern
Copy link
Member

Please also check for any errors or failures in the log say at https://github.com/jenkins-infra/plugin-modernizer-tool/pull/560/checks?check_run_id=35070687985 to debug

@nagu165
Copy link
Contributor Author

nagu165 commented Jan 2, 2025

Please also check for any errors or failures in the log say at https://github.com/jenkins-infra/plugin-modernizer-tool/pull/560/checks?check_run_id=35070687985 to debug

Ok sir, Thank you.

@nagu165
Copy link
Contributor Author

nagu165 commented Jan 2, 2025

Your formatting needs a bit tweaking

Sorry for not checking them beforehand, I will work on it.

Thank you.

@Override
public Xml.Tag visitTag(Xml.Tag tag, ExecutionContext context) {
tag = super.visitTag(tag, context);
if ("scm".equals(tag.getName())) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of using lot of level of conditional, we can return directly if the tag is not what we expect.

This would improve readability of the code

if(!"scm".equals(tag.getName()) {
   return tag;
}

@jonesbusy
Copy link
Collaborator

Thanks for your PR. Some minor cosmetic, formatting and idioms. Tests also need to be fixed

@nagu165
Copy link
Contributor Author

nagu165 commented Jan 3, 2025

Hello sir,
There seems to be some issue in the main branch code since the last time i ran tests.
I was running some tests on my branch(pr branch) and noticed 10 test failures instead of the previously 2, so i tried running tests on the main repo and there were 8 failures introduced
Screenshot 2025-01-03 085619
Could you please look into it.

@jonesbusy
Copy link
Collaborator

Probably caused by #565 due to a test still hardcoding bom version (that was released some hours ago https://github.com/jenkinsci/bom/releases/tag/3875.v1df09947cde6)

PR need to be rebased when merged on main)

@nagu165
Copy link
Contributor Author

nagu165 commented Jan 3, 2025

Hello sir,
Could you please look into the changes to UpdateScmUrlVisitor file.
I've tried many changes but it's always throwing a nullpointerexception.

@jonesbusy
Copy link
Collaborator

Can we fix the tests before ?

Caused by: java.lang.NullPointerException
	at java.base/java.util.Objects.requireNonNull(Objects.java:233)
	at org.openrewrite.maven.internal.RawPom.toPom(RawPom.java:408)
	at org.openrewrite.maven.MavenParser.parseInputs(MavenParser.java:78)

Most likely invalid pom

When it's green we can optimize and cleanup the code.

@nagu165
Copy link
Contributor Author

nagu165 commented Jan 3, 2025

Can we fix the tests before ?

I thought previously you meant that these test cases would be enough for now

Caused by: java.lang.NullPointerException
	at java.base/java.util.Objects.requireNonNull(Objects.java:233)
	at org.openrewrite.maven.internal.RawPom.toPom(RawPom.java:408)
	at org.openrewrite.maven.MavenParser.parseInputs(MavenParser.java:78)

Most likely invalid pom

When it's green we can optimize and cleanup the code.

Ok sir, working on it.

@jonesbusy
Copy link
Collaborator

I thought previously you meant that these test cases would be enough for now

Yes but tests are failing ? What's the point of having failing tests ?

How can we validate the recipe work as expected withtout test ?

@nagu165
Copy link
Contributor Author

nagu165 commented Jan 3, 2025

I thought previously you meant that these test cases would be enough for now

Yes but tests are failing ? What's the point of having failing tests ?

How can we validate the recipe work as expected withtout test ?

Then could you please guide me on how to fix the tests sir

Thank you

@jonesbusy
Copy link
Collaborator

Then could you please guide me on how to fix the tests sir

I will not do this investigation for you. Try to take a look at the difference with other tests that perform transformation of the pom.xml and that are working.

The only tests that are failing is the 2 that were added

I will put this PR is draft until it's green and ready to be reviewed

Regards,

@jonesbusy jonesbusy marked this pull request as draft January 3, 2025 12:42
@nagu165
Copy link
Contributor Author

nagu165 commented Jan 3, 2025

Then could you please guide me on how to fix the tests sir

I will not do this investigation for you. Try to take a look at the difference with other tests that perform transformation of the pom.xml and that are working.

The only tests that are failing is the 2 that were added

I will put this PR is draft until it's green and ready to be reviewed

Regards,

Ok sir, Understood
Thank you.

@nagu165
Copy link
Contributor Author

nagu165 commented Jan 3, 2025

Why is the build failing here?
They ran successfully for me
Screenshot 2025-01-03 193741

@jonesbusy
Copy link
Collaborator

@jonesbusy jonesbusy added the chore label Jan 3, 2025
@jonesbusy jonesbusy marked this pull request as ready for review January 3, 2025 21:04
@jonesbusy jonesbusy merged commit f1ccf6f into jenkins-infra:main Jan 4, 2025
16 checks passed
@nagu165
Copy link
Contributor Author

nagu165 commented Jan 4, 2025

Thank you so much sir.

@nagu165 nagu165 deleted the update-scm-url branch January 4, 2025 07:04
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