jenkins-infra/plugin-modernizer-tool

Error: Plugin processing error. Check the logs at logs/jobcacher.log

Closed this issue · 2 comments

Jenkins and plugins versions report

Environment
Paste the output here

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

WSL2

Reproduction steps

java -jar plugin-modernizer-cli/target/jenkins-plugin-modernizer-999999-SNAPSHOT.jar --plugins git,git-client,jobcacher --recipes FetchMetadata

Could it be because we're looking for a file in a fork that does not exist, as we have not forked the repo (we're in the metadata phase)?

Expected Results

No error.

Actual Results

java -jar plugin-modernizer-cli/target/jenkins-plugin-modernizer-999999-SNAPSHOT.jar --plugins git,git-client,jobcacher --recipes FetchMetadata
Starting Plugin Modernizer
Skipping fork for plugin git as only metadata is required
Skipping sync for plugin git as only metadata is required
Fetching plugin code locally git...
Metadata is not yet computed for plugin git. Using minimum JDK available
Skipping compilation for plugin git as it's a metadata only fetch
Collecting metadata for plugin git... Please be patient
Done
Skipping OpenRewrite recipe application for plugin git as only metadata is required
Skipping verification for plugin git as it's a metadata only fetch
Skipping push changes for plugin git in fetch-metadata-only mode
Skipping pull request for plugin git in fetch-metadata-only mode
Skipping fork for plugin git-client as only metadata is required
Skipping sync for plugin git-client as only metadata is required
Fetching plugin code locally git-client...
Metadata is not yet computed for plugin git-client. Using minimum JDK available
Skipping compilation for plugin git-client as it's a metadata only fetch
Collecting metadata for plugin git-client... Please be patient
Done
Skipping OpenRewrite recipe application for plugin git-client as only metadata is required
Skipping verification for plugin git-client as it's a metadata only fetch
Skipping push changes for plugin git-client in fetch-metadata-only mode
Skipping pull request for plugin git-client in fetch-metadata-only mode
Skipping fork for plugin jobcacher as only metadata is required
Skipping sync for plugin jobcacher as only metadata is required
Plugin processing error. Check the logs at logs/jobcacher.log
*************
Plugin: git
Metadata was fetched for plugin git and is available at /home/poddingue/.cache/jenkins-plugin-modernizer-cli/git/plugin-metadata
*************
*************
Plugin: git-client
Metadata was fetched for plugin git-client and is available at /home/poddingue/.cache/jenkins-plugin-modernizer-cli/git-client/plugin-metadata
*************
*************
Plugin: jobcacher
Error: Plugin processing error. Check the logs at logs/jobcacher.log
*************
Plugin Modernizer aborted.

Anything else?

2024-08-22T07:03:22.416Z [ERROR] [Thread=main] - i.j.t.p.core.model.Plugin # Plugin processing error. Check the logs at logs/jobcacher.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.github.GHService.fetch(GHService.java:369)
	at io.jenkins.tools.pluginmodernizer.core.model.Plugin.fetch(Plugin.java:534)
	at io.jenkins.tools.pluginmodernizer.core.impl.PluginModernizer.process(PluginModernizer.java:98)
	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/jobcacher-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)
	... 13 common frames omitted
Caused by: java.io.FileNotFoundException: https://api.github.com/repos/gounthar/jobcacher-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)
	... 18 common frames omitted

Are you interested in contributing a fix?

No response

Interesting, we should miss a condition to get the original repo and not the fork when running in this fetch metadata mode