jenkinsci / plugin-modernizer-tool

MIT License
6 stars 5 forks source link

'Build failed' when fetching metadata for some plugins. #215

Open gounthar opened 3 weeks ago

gounthar commented 3 weeks ago

Jenkins and plugins versions report

Environment ```text Paste the output here ```

What Operating System are you using (both controller, and any agents involved in the problem)?

WSL2

Reproduction steps

I have a plugins.txt file which lists tons of plugins. job-poll-action-plugin is part of that list. java -jar plugin-modernizer-cli/target/jenkins-plugin-modernizer-999999-SNAPSHOT.jar --plugin-file plugins.txt --recipes FetchMetadata

I don't have any log available in the logs directory. If I launch directly for this plugin, not using a list, I get an error in the logs.

java -jar plugin-modernizer-cli/target/jenkins-plugin-modernizer-999999-SNAPSHOT.jar --plugins vagrant --recipes FetchMetadata
Starting Plugin Modernizer
Skipping fork for plugin vagrant as only metadata is required
Skipping sync for plugin vagrant as only metadata is required
Fetching plugin code locally vagrant...
Plugin processing error. Check the logs at logs/vagrant.log
*************
Plugin: vagrant
Error: Plugin processing error. Check the logs at logs/vagrant.log
*************
Plugin Modernizer aborted.

The logs are:

2024-08-22T12:09:16.044Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] Scanning for projects... 
2024-08-22T12:09:18.653Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [WARNING] The requested profile "consume-incrementals" could not be activated because it does not exist. 
2024-08-22T12:09:18.654Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [WARNING] The requested profile "might-produce-incrementals" could not be activated because it does not exist. 
2024-08-22T12:09:18.855Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO]  
2024-08-22T12:09:18.857Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] -------------------< org.jenkins-ci.plugins:vagrant >------------------- 
2024-08-22T12:09:18.859Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] Building vagrant 1.0.3-SNAPSHOT 
2024-08-22T12:09:18.860Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO]   from pom.xml 
2024-08-22T12:09:18.860Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] --------------------------------[ hpi ]--------------------------------- 
2024-08-22T12:09:18.943Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [WARNING] Parameter 'showDeprecation' is unknown for plugin 'maven-hpi-plugin:1.106:validate (default-validate)' 
2024-08-22T12:09:18.975Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [WARNING] Parameter 'showDeprecation' is unknown for plugin 'maven-hpi-plugin:1.106:insert-test (default-insert-test)' 
2024-08-22T12:09:18.983Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [WARNING] Parameter 'showDeprecation' is unknown for plugin 'maven-hpi-plugin:1.106:test-hpl (default-test-hpl)' 
2024-08-22T12:09:18.984Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [WARNING] Parameter 'showDeprecation' is unknown for plugin 'maven-hpi-plugin:1.106:resolve-test-dependencies (default-resolve-test-dependencies)' 
2024-08-22T12:09:19.003Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO]  
2024-08-22T12:09:19.004Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] >>> rewrite:5.39.0:run (default-cli) > process-test-classes @ vagrant >>> 
2024-08-22T12:09:20.280Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO]  
2024-08-22T12:09:20.281Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] --- hpi:1.106:validate (default-validate) @ vagrant --- 
2024-08-22T12:09:20.685Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO]  
2024-08-22T12:09:20.686Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] --- enforcer:1.0.1:enforce (enforce-maven) @ vagrant --- 
2024-08-22T12:09:20.813Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO]  
2024-08-22T12:09:20.814Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] --- enforcer:1.0.1:display-info (display-info) @ vagrant --- 
2024-08-22T12:09:20.817Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] Maven Version: 3.9.9 
2024-08-22T12:09:20.820Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] JDK Version: 17.0.12 normalized as: 17.0.12 
2024-08-22T12:09:20.822Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] OS Info: Arch: amd64 Family: unix Name: linux Version: 5.15.153.1-microsoft-standard-wsl2 
2024-08-22T12:09:20.824Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO]  
2024-08-22T12:09:20.824Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] --- localizer:1.14:generate (default) @ vagrant --- 
2024-08-22T12:09:23.003Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO]  
2024-08-22T12:09:23.004Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] --- resources:2.5:resources (default-resources) @ vagrant --- 
2024-08-22T12:09:23.124Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [debug] execute contextualize 
2024-08-22T12:09:23.141Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] Using 'UTF-8' encoding to copy filtered resources. 
2024-08-22T12:09:24.685Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] Copying 27 resources 
2024-08-22T12:09:36.893Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO]  
2024-08-22T12:09:36.927Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] --- compiler:2.5:compile (default-compile) @ vagrant --- 
2024-08-22T12:09:37.706Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] Compiling 8 source files to /mnt/c/support/users/gsoc/plugin-modernizer-tool/test-plugins/vagrant/target/classes 
2024-08-22T12:09:38.341Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] ------------------------------------------------------------- 
2024-08-22T12:09:38.342Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [ERROR] COMPILATION ERROR :  
2024-08-22T12:09:38.342Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] ------------------------------------------------------------- 
2024-08-22T12:09:38.343Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [ERROR] error: Source option 5 is no longer supported. Use 7 or later. 
2024-08-22T12:09:38.344Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [ERROR] error: Target option 5 is no longer supported. Use 7 or later. 
2024-08-22T12:09:38.345Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] 2 errors  
2024-08-22T12:09:38.346Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] ------------------------------------------------------------- 
2024-08-22T12:09:38.346Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] ------------------------------------------------------------------------ 
2024-08-22T12:09:38.347Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] BUILD FAILURE 
2024-08-22T12:09:38.347Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] ------------------------------------------------------------------------ 
2024-08-22T12:09:38.359Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] Total time:  22.382 s 
2024-08-22T12:09:38.360Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] Finished at: 2024-08-22T14:09:38+02:00 
2024-08-22T12:09:38.361Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [INFO] ------------------------------------------------------------------------ 
2024-08-22T12:09:38.361Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [WARNING] The requested profile "consume-incrementals" could not be activated because it does not exist. 
2024-08-22T12:09:38.362Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [WARNING] The requested profile "might-produce-incrementals" could not be activated because it does not exist. 
2024-08-22T12:09:38.363Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5:compile (default-compile) on project vagrant: Compilation failure: Compilation failure:  
2024-08-22T12:09:38.363Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [ERROR] error: Source option 5 is no longer supported. Use 7 or later. 
2024-08-22T12:09:38.364Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [ERROR] error: Target option 5 is no longer supported. Use 7 or later. 
2024-08-22T12:09:38.365Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [ERROR] -> [Help 1] 
2024-08-22T12:09:38.365Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [ERROR]  
2024-08-22T12:09:38.366Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
2024-08-22T12:09:38.366Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [ERROR] Re-run Maven using the -X switch to enable full debug logging. 
2024-08-22T12:09:38.367Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [ERROR]  
2024-08-22T12:09:38.367Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [ERROR] For more information about the errors and possible solutions, please read the following articles: 
2024-08-22T12:09:38.368Z [INFO] [Thread=StreamPumper-systemOut] - i.j.t.p.core.impl.MavenInvoker # [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException 
2024-08-22T12:09:38.471Z [ERROR] [Thread=main] - i.j.t.p.core.impl.MavenInvoker # Build fail with code: 1 
2024-08-22T12:11:12.148Z [ERROR] [Thread=main] - i.j.t.p.core.model.Plugin # Plugin processing error. Check the logs at logs/vagrant.log 
io.jenkins.tools.pluginmodernizer.core.model.PluginProcessingException: Failed to get repository
    at io.jenkins.tools.pluginmodernizer.core.github.GHService.getRepositoryFork(GHService.java:106)
    at io.jenkins.tools.pluginmodernizer.core.model.Plugin.getRemoteForkRepository(Plugin.java:567)
    at io.jenkins.tools.pluginmodernizer.core.github.GHService.checkoutBranch(GHService.java:438)
    at io.jenkins.tools.pluginmodernizer.core.model.Plugin.checkoutBranch(Plugin.java:502)
    at io.jenkins.tools.pluginmodernizer.core.impl.PluginModernizer.process(PluginModernizer.java:119)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
    at io.jenkins.tools.pluginmodernizer.core.impl.PluginModernizer.start(PluginModernizer.java:67)
    at io.jenkins.tools.pluginmodernizer.cli.Main.run(Main.java:205)
    at picocli.CommandLine.executeUserObject(CommandLine.java:2030)
    at picocli.CommandLine.executeHelpRequest(CommandLine.java:2016)
    at picocli.CommandLine.executeHelpRequest(CommandLine.java:1987)
    at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2272)
    at picocli.CommandLine$RunLast.execute(CommandLine.java:2421)
    at picocli.CommandLine.execute(CommandLine.java:2174)
    at io.jenkins.tools.pluginmodernizer.cli.Main.main(Main.java:45)
Caused by: org.kohsuke.github.GHFileNotFoundException: https://api.github.com/repos/gounthar/vagrant-plugin {"message":"Not Found","documentation_url":"https://docs.github.com/rest/repos/repos#get-a-repository","status":"404"}
    at org.kohsuke.github.GitHubClient.interpretApiError(GitHubClient.java:737)
    at org.kohsuke.github.GitHubClient.sendRequest(GitHubClient.java:480)
    at org.kohsuke.github.GitHubClient.sendRequest(GitHubClient.java:427)
    at org.kohsuke.github.Requester.fetch(Requester.java:85)
    at org.kohsuke.github.GHRepository.read(GHRepository.java:142)
    at org.kohsuke.github.GitHub.getRepository(GitHub.java:684)
    at io.jenkins.tools.pluginmodernizer.core.github.GHService.getRepositoryFork(GHService.java:104)
    ... 14 common frames omitted
Caused by: java.io.FileNotFoundException: https://api.github.com/repos/gounthar/vagrant-plugin
    at org.kohsuke.github.GitHubConnectorResponseErrorHandler$1.onError(GitHubConnectorResponseErrorHandler.java:79)
    at org.kohsuke.github.GitHubClient.detectKnownErrors(GitHubClient.java:504)
    at org.kohsuke.github.GitHubClient.sendRequest(GitHubClient.java:464)
    ... 19 common frames omitted

Could the error be linked to the fact the plugin is super old, declaring Java source file compatibility with Java 5?

Expected Results

No error.

Actual Results

Skipping fork for plugin job-poll-action-plugin as only metadata is required
Skipping sync for plugin job-poll-action-plugin as only metadata is required
Fetching plugin code locally job-poll-action-plugin...
Collecting metadata for plugin job-poll-action-plugin... Please be patient
Build failed
Done

Anything else?

No response

Are you interested in contributing a fix?

No response

jonesbusy commented 3 weeks ago

Yea it's some particular case we need to manage before trying anything.

In case of the vagrant plugin is because of the java.version 7

It's probably even Maven not supporting build of such project

error: Source option 5 is no longer supported. Use 7 or later. 

https://maven.apache.org/docs/3.9.0/release-notes.html#overview-about-the-changes

Minimum Java version to use with Maven 3.9.0 is raised to Java 8.

For the job-poll-action is because of the HTTP URL

maven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositories: [repo.jenkins-ci.org (http://repo.jenkins-ci.org/public/,

So 2 things blocked by some recent maven version.

We need to think how to manage those use cases