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

Use the minimum JDK specified in Jenkinsfile to compile the plugin #196

Closed
gounthar opened this issue Aug 19, 2024 · 2 comments
Closed

Use the minimum JDK specified in Jenkinsfile to compile the plugin #196

gounthar opened this issue Aug 19, 2024 · 2 comments
Labels
enhancement For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted

Comments

@gounthar
Copy link
Collaborator

gounthar commented Aug 19, 2024

Suggested Feature

I launched the tool on the git plugin and got this output:

gitpod /workspace/plugin-modernizer-tool (main) $ java -jar plugin-modernizer-cli/target/jenkins-plugin-modernizer-999999-SNAPSHOT.jar --plugins git,git-client,jobcacher --recipes AddPluginsBom,AddCodeOwner
Picked up JAVA_TOOL_OPTIONS: -XX:+UseContainerSupport -XX:ActiveProcessorCount=1
Starting Plugin Modernizer 
Picked up JAVA_TOOL_OPTIONS: -XX:+UseContainerSupport -XX:ActiveProcessorCount=1
Forking plugin git locally from repo git-plugin... 
Repository already forked to personal account gounthar 
Syncing the forked repository gounthar/git-plugin 
Fetching plugin code locally git... 
Metadata is not yet computed for plugin git. Using minimum JDK available 
Build failed 
Compiling plugin git with JDK 8 ... Please be patient 
Build failed 
Plugin git failed to compile with JDK 8. Trying next one 
Compiling plugin git with JDK 11 ... Please be patient 

However, the Jenkinsfile contains the following information:

/*
 See the documentation for more options:
 https://github.com/jenkins-infra/pipeline-library/
*/
buildPlugin(
  forkCount: '1C', // Run a JVM per core in tests
  // we use Docker for containerized tests
  useContainerAgent: false,
  configurations: [
    [platform: 'linux', jdk: 21, jenkins: '2.462'],
    [platform: 'windows', jdk: 17],
])

Could we use the minimum JDK version specified in the Jenkinsfile (17 for this plugin) instead of trying all JDK versions until one matches? This would potentially save time and resources during the compilation process.

Thanks.

@gounthar gounthar added the enhancement For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted label Aug 19, 2024
@gounthar gounthar changed the title Use the minimum JDK found in Jenkinsfile to compile the plugin Use the minimum JDK specified in Jenkinsfile to compile the plugin Aug 19, 2024
@jonesbusy
Copy link
Collaborator

Yes that's the idea. We need to enrich the MetadataCollector to also use rewrite-groovy OpenRewrite visitors/parsing and store the JDK version from the Jenkinsfile on PluginMetadata

Then we can limit the build to JDKs configured on the Jenkinsfile

@jonesbusy
Copy link
Collaborator

Fixed by #201 and #224 and #216

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted
Projects
None yet
Development

No branches or pull requests

2 participants