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

Applied recipes AddOrModernizeJenkinsFile, AddDependencyCheck, AddPluginsBom, UpgradeParentVersion, RemoveDependencyVersionOverride, RemoveExtraMavenProperties, UpgradeToJava17, AddOrModernizeJenkinsFile, AddDependencyCheck, UpgradeToRecommendCoreVersion, MigrateJUnitTestCase #178

Closed
wants to merge 1 commit into from

Conversation

gounthar
Copy link
Contributor

@gounthar gounthar commented Nov 4, 2024

Hello build-token-root developers!

This is an automated pull request created by the Jenkins Plugin Modernizer tool. The tool has applied the following recipes to modernize the plugin:

Add Jenkinsfile

io.jenkins.tools.pluginmodernizer.AddOrModernizeJenkinsFile

Updates Jenkinsfile to build with recommended Java versions, platforms, and settings, or creates the file if absent. Also upgrades to a newer parent version, as the new version of the Jenkinsfille uses JDK17 and JDK21.
Add dependency check

io.jenkins.tools.pluginmodernizer.AddDependencyCheck

Adds a dependabot GitHub action to the plugin repository
Add plugins BOM

io.jenkins.tools.pluginmodernizer.AddPluginsBom

Add the Jenkins BOM to the dependenciesManagement section of the pom.xml.
Upgrade parent version

io.jenkins.tools.pluginmodernizer.UpgradeParentVersion

Upgrade the parent version to latest available
Remove dependency version override

io.jenkins.tools.pluginmodernizer.RemoveDependencyVersionOverride

Remove dependencies version override if managed from parent or bom
Remove extra maven properties

io.jenkins.tools.pluginmodernizer.RemoveExtraMavenProperties

Remove extra maven properties from the pom
Migrate from Java 11 to Java 17

io.jenkins.tools.pluginmodernizer.UpgradeToJava17

Migrate from Java 11 to Java 17
Add Jenkinsfile

io.jenkins.tools.pluginmodernizer.AddOrModernizeJenkinsFile

Updates Jenkinsfile to build with recommended Java versions, platforms, and settings, or creates the file if absent. Also upgrades to a newer parent version, as the new version of the Jenkinsfille uses JDK17 and JDK21.
Add dependency check

io.jenkins.tools.pluginmodernizer.AddDependencyCheck

Adds a dependabot GitHub action to the plugin repository
Upgrade to latest recommended core version and ensure the bom is matching the core version

io.jenkins.tools.pluginmodernizer.UpgradeToRecommendCoreVersion

Upgrade to latest recommended core version and ensure the bom is matching the core version
Convert JUnit 4 TestCase to JUnit Jupiter

io.jenkins.tools.pluginmodernizer.MigrateJUnitTestCase

Convert JUnit 4 TestCase to JUnit Jupiter

…ginsBom, UpgradeParentVersion, RemoveDependencyVersionOverride, RemoveExtraMavenProperties, UpgradeToJava17, AddOrModernizeJenkinsFile, AddDependencyCheck, UpgradeToRecommendCoreVersion, MigrateJUnitTestCase
@gounthar gounthar requested a review from a team as a code owner November 4, 2024 18:18
@jglick
Copy link
Member

jglick commented Nov 4, 2024

Convert JUnit 4 TestCase to JUnit Jupiter

WDYM? There was no such conversion. (Anyway I would not be eager to accept it if there were—JUnit 4 works fine from my PoV, and I have no interest in JUnit 5.)

Comment on lines +1 to +5
/*
See the documentation for more options:
https://github.com/jenkins-infra/pipeline-library/
*/ buildPlugin(
useContainerAgent: true, // Set to `false` if you need to use Docker for containerized tests
Copy link
Member

Choose a reason for hiding this comment

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

Useless.

Suggested change
/*
See the documentation for more options:
https://github.com/jenkins-infra/pipeline-library/
*/ buildPlugin(
useContainerAgent: true, // Set to `false` if you need to use Docker for containerized tests
buildPlugin(
useContainerAgent: true,

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

  • the rewrite is missing forkCount
  • would be nicer if the rewrite did not touch a file which was materially the same (ignoring whitespace)
  • the proposed rewrite had mangled whitespace after the comment

Copy link
Member

Choose a reason for hiding this comment

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

FWIW I think the comment is fine in the archetype, because that is deliberately intended as a skeleton for a brand-new plugin showing you some things you might consider doing and explaining what they mean if you have never encountered them before. Seems less helpful in the OpenRewrite proposed text. Would be less intrusive to have a single-line comment like

// Reference: https://github.com/jenkins-infra/pipeline-library/blob/f26089381c825325666e3f2f1b31e35e9f63c2c7/README.adoc#buildplugin

(Here I am using the permalink since the docs might well be rearranged in the future. Or just the repo link would suffice I guess.)

<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<maven.compiler.release>17</maven.compiler.release>
Copy link
Member

Choose a reason for hiding this comment

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

No! This should never be done this way in a plugin repo. If the dep is 2.479.x and the parent is 5.x then this is automatic.

</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.440.x</artifactId>
<version>3435.v238d66a_043fb_</version>
<artifactId>bom-2.452.x</artifactId>
Copy link
Member

Choose a reason for hiding this comment

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

This should anyway be using the newer idiom with a shared property for LTS line.

Choose a reason for hiding this comment

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

jenkinsci/archetypes#738
jenkins-infra/plugin-modernizer-tool#368

Need most likely to be fixed on https://github.com/openrewrite/rewrite-jenkins/blob/main/src/main/java/org/openrewrite/jenkins/AddPluginsBom.java

The recipe is already handling the mismatch of jenkins.version and bom. But since we moved to the new property the recipe must be adapted

Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

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

#178 (comment) is blocking

@jglick
Copy link
Member

jglick commented Nov 4, 2024

@gounthar I think there are some issues ^^^

@gounthar
Copy link
Contributor Author

gounthar commented Nov 4, 2024

Indeed.
Let me see.

@gounthar gounthar marked this pull request as draft November 4, 2024 18:32
@gounthar gounthar closed this Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants