jenkins-infra / plugin-modernizer-tool

MIT License
9 stars 8 forks source link

java.io.UncheckedIOException: java.nio.file.NoSuchFileException: /home/gitpod/.cache/jenkins-plugin-modernizer-cli/update-center.json #99

Closed gounthar closed 4 months ago

gounthar commented 4 months ago

Jenkins and plugins versions report

java -jar plugin-modernizer-cli/target/jenkins-plugin-modernizer-999999-SNAPSHOT.jar --dry-run --plugin-file plugins.txt  --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
Plugins: [pipeline-milestone-step, mina-sshd-api-core, jakarta-activation-api, github-branch-source, snakeyaml-api, trilead-api, commons-text-api, workflow-multibranch, javax-mail-api, pipeline-stage-tags-metadata, javax-activation-api, plugin-util-api, git-client, scm-api, variant, pipeline-stage-step, font-awesome-api, pipeline-model-extensions, github, build-timeout, pipeline-groovy-lib, configuration-as-code, workflow-support, checks-api, mailer, antisamy-markup-formatter, jackson2-api, pipeline-rest-api, workflow-scm-step, jakarta-mail-api, ws-cleanup, pipeline-model-api, token-macro, pipeline-input-step, metrics, jquery3-api, okhttp-api, credentials-binding, workflow-aggregator, pipeline-build-step, pipeline-stage-view, credentials, mina-sshd-api-common, pipeline-model-definition, caffeine-api, instance-identity, workflow-step-api, locale, plain-credentials, matrix-project, resource-disposer, bouncycastle-api, jaxb, git, bootstrap5-api, workflow-durable-task-step, pipeline-graph-view, ssh-credentials, cloudbees-folder, durable-task, workflow-basic-steps, workflow-job, github-api, timestamper, junit, pipeline-graph-analysis, echarts-api, apache-httpcomponents-client-4-api, structs, ant, workflow-cps, ssh-slaves, sshd, matrix-auth, gradle, jjwt-api, ionicons-api, commons-lang3-api, display-url-api, script-security, branch-api, workflow-api] 
Recipes: [AddPluginsBom, AddCodeOwner] 
GitHub owner: gounthar 
Forking and cloning pipeline-milestone-step locally 
Error extracting repository name:  
java.nio.file.NoSuchFileException: /home/gitpod/.cache/jenkins-plugin-modernizer-cli/update-center.json
        at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
        at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:218)
        at java.base/java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:484)
        at java.base/java.nio.file.Files.newOutputStream(Files.java:228)
        at java.base/java.nio.file.Files.write(Files.java:3512)
        at java.base/java.nio.file.Files.writeString(Files.java:3734)
        at java.base/java.nio.file.Files.writeString(Files.java:3674)
        at io.jenkins.tools.pluginmodernizer.core.utils.JenkinsPluginInfo.getCachedUpdateCenterData(JenkinsPluginInfo.java:49)
        at io.jenkins.tools.pluginmodernizer.core.utils.JenkinsPluginInfo.extractRepoName(JenkinsPluginInfo.java:26)
        at io.jenkins.tools.pluginmodernizer.core.github.GHService.forkCloneAndCreateBranch(GHService.java:58)
        at io.jenkins.tools.pluginmodernizer.core.impl.PluginModernizer.start(PluginModernizer.java:40)
        at io.jenkins.tools.pluginmodernizer.cli.Main.run(Main.java:132)
        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:34)
Failed to process plugin: pipeline-milestone-step 
java.io.UncheckedIOException: java.nio.file.NoSuchFileException: /home/gitpod/.cache/jenkins-plugin-modernizer-cli/update-center.json
        at io.jenkins.tools.pluginmodernizer.core.utils.JenkinsPluginInfo.extractRepoName(JenkinsPluginInfo.java:37)
        at io.jenkins.tools.pluginmodernizer.core.github.GHService.forkCloneAndCreateBranch(GHService.java:58)
        at io.jenkins.tools.pluginmodernizer.core.impl.PluginModernizer.start(PluginModernizer.java:40)
        at io.jenkins.tools.pluginmodernizer.cli.Main.run(Main.java:132)
        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:34)
Caused by: java.nio.file.NoSuchFileException: /home/gitpod/.cache/jenkins-plugin-modernizer-cli/update-center.json
        at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
        at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:218)
        at java.base/java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:484)
        at java.base/java.nio.file.Files.newOutputStream(Files.java:228)
        at java.base/java.nio.file.Files.write(Files.java:3512)
        at java.base/java.nio.file.Files.writeString(Files.java:3734)
        at java.base/java.nio.file.Files.writeString(Files.java:3674)
        at io.jenkins.tools.pluginmodernizer.core.utils.JenkinsPluginInfo.getCachedUpdateCenterData(JenkinsPluginInfo.java:49)
        at io.jenkins.tools.pluginmodernizer.core.utils.JenkinsPluginInfo.extractRepoName(JenkinsPluginInfo.java:26)
        ... 10 common frames omitted
Forking and cloning mina-sshd-api-core locally 

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

GitPod

Reproduction steps

java -jar plugin-modernizer-cli/target/jenkins-plugin-modernizer-999999-SNAPSHOT.jar --dry-run --plugin-file plugins.txt --recipes AddPluginsBom,AddCodeOwner

Expected Results

I thought that with the merge of #87 we would be good with the --plugin-file option.

Actual Results

java.io.UncheckedIOException: java.nio.file.NoSuchFileException: /home/gitpod/.cache/jenkins-plugin-modernizer-cli/update-center.json

Anything else?

No response

Are you interested in contributing a fix?

No response

sridamul commented 4 months ago

As said in this comment, I am not sure which place would be opt to create dir, any suggestions?

gounthar commented 4 months ago

The place you chose is not bad, but it does not allow us to use the tool. 🤷 I think we should add a test about this cache directory creation that would prevent to merge to the main branch code that does not work.

jonesbusy commented 4 months ago

It's possible to override the cache dire via CLI or env vars to point to a writable location.

We can set it on the gitpod environnement

On Wed, 17 Jul 2024, 08:14 Bruno Verachten, @.***> wrote:

The place you chose is not bad, but it does not allow us to use the tool. 🤷 I think we should add a test about this cache directory creation that would prevent to merge to the main branch code that does not work.

— Reply to this email directly, view it on GitHub https://github.com/jenkinsci/plugin-modernizer-tool/issues/99#issuecomment-2232509734, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGJTFTLTDZ4BMFPPIAL7X3ZMYDV5AVCNFSM6AAAAABK75I7LGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZSGUYDSNZTGQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

jonesbusy commented 4 months ago

See --cache-path option

gounthar commented 4 months ago

java -jar plugin-modernizer-cli/target/jenkins-plugin-modernizer-999999-SNAPSHOT.jar --dry-run --plugin-file plugins.txt --recipes AddPluginsBom,AddCodeOwner --cache-path /tmp works, but the tool should try to create the path if it does not exist, and fail if it can't use it before even trying to use the path to store files.

sridamul commented 4 months ago

java -jar plugin-modernizer-cli/target/jenkins-plugin-modernizer-999999-SNAPSHOT.jar --dry-run --plugin-file plugins.txt --recipes AddPluginsBom,AddCodeOwner --cache-path /tmp works, but the tool should try to create the path if it does not exist, and fail if it can't use it before even trying to use the path to store files.

your right! merging #100 should resolve this issue.