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

ide update fails on first error #628

Closed
hohwille opened this issue Sep 17, 2024 · 1 comment · Fixed by #638
Closed

ide update fails on first error #628

hohwille opened this issue Sep 17, 2024 · 1 comment · Fixed by #638
Assignees
Labels
bug Something isn't working create Create commandlet used to create new IDEasy projects with "ide create" update related to updating software or the entire ide

Comments

@hohwille
Copy link
Member

Expected behavior

As a IDEasy, I want that ide update applies all updates so that I can continue working and even if one of the step fails this should not block other steps.

Actual behavior

IDEasy stops on the first error (IMHO also the same for ide create).
This was already a problem in devonfw-ide and the reason why we invented steps (#282) what was too complex to implement in Bash.
Now with Java we have all this, however we do not properly apply the nice infrastructure we have created.

As you can read in #102:

That is if we iterate over tools in 2.,3., and 4. and some tool update fails with an error, we should not abort the entire process and prevent other tools to get updated. Instead in Java we can now properly catch and collect the errors and include a report at the end of the process.

However, we do not properly test that all aspects of a story have really been implemented before closing and also never did a sprint review of that story.

Steps to reproduce (bug) / Use Case of feature request (enhancement)

  1. ide update (with a tool that for some reason fails on update)
$ ide update
Updates are available for the settings repository. If you want to pull the latest changes, call ide update.
Start: Pull settings repository
Successfully updated settings repository.
Start: Copy configuration templates
Copy configuration templates
Start: Install or update software
Start: Install node
Version v18.20.4 of tool node is already installed
Install node
Start: Install mvn
Version 3.9.9 of tool mvn is already installed
Install mvn
Start: Install aws
Trying to download aws-2.17.52-windows-x64.msi from https://awscli.amazonaws.com/AWSCLIV2-2.17.52.msi
Failed to download from https://awscli.amazonaws.com/AWSCLIV2-2.17.52.msi
java.lang.IllegalStateException: Failed to download file from URL https://awscli.amazonaws.com/AWSCLIV2-2.17.52.msi to D:\projects\_ide\tmp\Downloads\aws-2.17.52-windows-x64.msi
        at com.devonfw.tools.ide.io.FileAccessImpl.download(FileAccessImpl.java:121)
        at com.devonfw.tools.ide.repo.AbstractToolRepository.download(AbstractToolRepository.java:160)
        at com.devonfw.tools.ide.repo.AbstractToolRepository.download(AbstractToolRepository.java:94)
        at com.devonfw.tools.ide.repo.AbstractToolRepository.download(AbstractToolRepository.java:64)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.installTool(LocalToolCommandlet.java:222)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.installTool(LocalToolCommandlet.java:177)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.installTool(LocalToolCommandlet.java:151)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.doInstall(LocalToolCommandlet.java:78)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.doInstall(LocalToolCommandlet.java:65)
        at com.devonfw.tools.ide.tool.ToolCommandlet.install(ToolCommandlet.java:233)
        at com.devonfw.tools.ide.commandlet.AbstractUpdateCommandlet.updateSoftware(AbstractUpdateCommandlet.java:170)
        at com.devonfw.tools.ide.commandlet.AbstractUpdateCommandlet.run(AbstractUpdateCommandlet.java:52)
        at com.devonfw.tools.ide.commandlet.UpdateCommandlet.run(UpdateCommandlet.java:29)
        at com.devonfw.tools.ide.context.AbstractIdeContext.applyAndRun(AbstractIdeContext.java:856)
        at com.devonfw.tools.ide.context.AbstractIdeContext.run(AbstractIdeContext.java:765)
        at com.devonfw.tools.ide.cli.Ideasy.runOrThrow(Ideasy.java:89)
        at com.devonfw.tools.ide.cli.Ideasy.run(Ideasy.java:52)
        at com.devonfw.tools.ide.cli.Ideasy.main(Ideasy.java:29)
        at java.base@21.0.2/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
Caused by: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
        at java.net.http@21.0.2/jdk.internal.net.http.HttpClientImpl.send(HttpClientImpl.java:956)
        at java.net.http@21.0.2/jdk.internal.net.http.HttpClientFacade.send(HttpClientFacade.java:133)
        at com.devonfw.tools.ide.io.FileAccessImpl.download(FileAccessImpl.java:103)
        ... 18 more
Caused by: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
        at java.base@21.0.2/sun.security.ssl.Alert.createSSLException(Alert.java:130)
        at java.base@21.0.2/sun.security.ssl.TransportContext.fatal(TransportContext.java:378)
        at java.base@21.0.2/sun.security.ssl.TransportContext.fatal(TransportContext.java:321)
        at java.base@21.0.2/sun.security.ssl.TransportContext.fatal(TransportContext.java:316)
        at java.base@21.0.2/sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(CertificateMessage.java:1318)
        at java.base@21.0.2/sun.security.ssl.CertificateMessage$T13CertificateConsumer.onConsumeCertificate(CertificateMessage.java:1195)
        at java.base@21.0.2/sun.security.ssl.CertificateMessage$T13CertificateConsumer.consume(CertificateMessage.java:1138)
        at java.base@21.0.2/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:393)
        at java.base@21.0.2/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:476)
        at java.base@21.0.2/sun.security.ssl.SSLEngineImpl$DelegatedTask$DelegatedAction.run(SSLEngineImpl.java:1273)
        at java.base@21.0.2/sun.security.ssl.SSLEngineImpl$DelegatedTask$DelegatedAction.run(SSLEngineImpl.java:1260)
        at java.base@21.0.2/java.security.AccessController.executePrivileged(AccessController.java:114)
        at java.base@21.0.2/java.security.AccessController.doPrivileged(AccessController.java:714)
        at java.base@21.0.2/sun.security.ssl.SSLEngineImpl$DelegatedTask.run(SSLEngineImpl.java:1205)
        at java.base@21.0.2/java.util.ArrayList.forEach(ArrayList.java:1596)
        at java.net.http@21.0.2/jdk.internal.net.http.common.SSLFlowDelegate.lambda$executeTasks$3(SSLFlowDelegate.java:1134)
        at java.net.http@21.0.2/jdk.internal.net.http.HttpClientImpl$DelegatingExecutor.execute(HttpClientImpl.java:177)
        at java.net.http@21.0.2/jdk.internal.net.http.common.SSLFlowDelegate.executeTasks(SSLFlowDelegate.java:1129)
        at java.net.http@21.0.2/jdk.internal.net.http.common.SSLFlowDelegate.doHandshake(SSLFlowDelegate.java:1095)
        at java.net.http@21.0.2/jdk.internal.net.http.common.SSLFlowDelegate$Reader.processData(SSLFlowDelegate.java:494)
        at java.net.http@21.0.2/jdk.internal.net.http.common.SSLFlowDelegate$Reader$ReaderDownstreamPusher.run(SSLFlowDelegate.java:269)
        at java.net.http@21.0.2/jdk.internal.net.http.common.SequentialScheduler$LockingRestartableTask.run(SequentialScheduler.java:182)
        at java.net.http@21.0.2/jdk.internal.net.http.common.SequentialScheduler$CompleteRestartableTask.run(SequentialScheduler.java:149)
        at java.net.http@21.0.2/jdk.internal.net.http.common.SequentialScheduler$SchedulableTask.run(SequentialScheduler.java:207)
        at java.base@21.0.2/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at java.base@21.0.2/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base@21.0.2/java.lang.Thread.runWith(Thread.java:1596)
        at java.base@21.0.2/java.lang.Thread.run(Thread.java:1583)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:833)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.windows.WindowsPlatformThreads.osThreadStartRoutine(WindowsPlatformThreads.java:214)
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
        at java.base@21.0.2/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:388)
        at java.base@21.0.2/sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:271)
        at java.base@21.0.2/sun.security.validator.Validator.validate(Validator.java:256)
        at java.base@21.0.2/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:284)
        at java.base@21.0.2/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:144)
        at java.base@21.0.2/sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(CertificateMessage.java:1296)
        ... 25 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
        at java.base@21.0.2/sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:148)
        at java.base@21.0.2/sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:129)
        at java.base@21.0.2/java.security.cert.CertPathBuilder.build(CertPathBuilder.java:297)
        at java.base@21.0.2/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:383)
        ... 30 more

Step 'Install or update software' ended with failure.
Step 'ide (update)' failed: com.devonfw.tools.ide.cli.CliException: Download of aws-2.17.52-windows-x64.msi failed after trying 1 URL(s).
 Step 'Install or update software' failed: null
  Step 'Install aws (*)' failed: com.devonfw.tools.ide.cli.CliException: Download of aws-2.17.52-windows-x64.msi failed after trying 1 URL(s).
3 step(s) failed out of 8 steps.
Download of aws-2.17.52-windows-x64.msi failed after trying 1 URL(s).

Error: IDEasy failed with exit code 1

As you can see the process failed on the first error instead of catching it, adding the error to the step and then failing at the end since the root step failed. Maybe we still have some lacking feature for that in our Step infrastructure but lets see.

Related/Dependent Issues

#102

Comments/Hints:

Affected version:

  • latest version: 2024.09.002-beta-SNAPSHOT
@hohwille hohwille added the bug Something isn't working label Sep 17, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in IDEasy board Sep 17, 2024
@hohwille hohwille added update related to updating software or the entire ide create Create commandlet used to create new IDEasy projects with "ide create" labels Sep 17, 2024
@hohwille hohwille added this to the release:2024.09.002 milestone Sep 17, 2024
@hohwille
Copy link
Member Author

Bugfix: add try / catch here:

@jan-vcapgemini jan-vcapgemini self-assigned this Sep 19, 2024
jan-vcapgemini added a commit to jan-vcapgemini/IDEasy that referenced this issue Sep 19, 2024
added catch of exceptions for ToolCommandlet installations
converted steps to try-with-resources
added new test for failed update substeps
added mvn and java repositories to update test-project
jan-vcapgemini added a commit to jan-vcapgemini/IDEasy that referenced this issue Sep 20, 2024
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in IDEasy board Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working create Create commandlet used to create new IDEasy projects with "ide create" update related to updating software or the entire ide
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

2 participants