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

CLI could not see Helidon version #487

Closed
tomas-langer opened this issue Sep 16, 2021 · 10 comments · Fixed by #600
Closed

CLI could not see Helidon version #487

tomas-langer opened this issue Sep 16, 2021 · 10 comments · Fixed by #600
Labels
bug Something isn't working cli
Milestone

Comments

@tomas-langer
Copy link
Member

During HOL session, a user had a problem that CLI could not see version 2.3.2.
Using maven archetype worked just fine.

Worked OK from my own environment with the exact same command (my output below).

Environment:

mvn --version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: C:\Program Files\JetBrains\IntelliJ IDEA 2020.3.1\plugins\maven\lib\maven3\bin\..
Java version: 15.0.1, vendor: Oracle Corporation, runtime: c:\Java\jdk-15.0.1
Default locale: pl_PL, platform encoding: Cp1250
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Dev output with debug:

helidon init --debug --version 2.3.2
Found maven executable C:\Program Files\JetBrains\IntelliJ IDEA 2020.3.1\plugins\maven\lib\maven3\bin\mvn.cmd
stale check forced (not found) for C:\Users\user\.helidon\cache\latest
Looking up latest Helidon version
executing [java, -XX:TieredStopAtLevel=1, -XX:CICompilerCount=2, -jar, C:\Users\user\.helidon\plugins\cli-plugins-d4b7bb55.jar, UpdateMetadata, --debug, --baseUrl, https://helidon.io/cli-data, --cacheDir, C:\Users\user\.helidon\cache, --cliVersion, 2.2.3, --maxAttempts, 1]
Executing command: java -XX:TieredStopAtLevel=1 -XX:CICompilerCount=2 -jar C:\Users\user\.helidon\plugins\cli-plugins-d4b7bb55.jar UpdateMetadata --debug --baseUrl https://helidon.io/cli-data --cacheDir C:\Users\user\.helidon\cache --cliVersion 2.2.3 --maxAttempts 1
Using Helidon version 2.3.2
Helidon flavor
  (1) SE
  (2) MP
Enter selection (Default: 1): 2
stale check forced (not found) for C:\Users\user\.helidon\cache\2.3.2\.lastUpdate
Updating metadata for Helidon version 2.3.2
executing [java, -XX:TieredStopAtLevel=1, -XX:CICompilerCount=2, -jar, C:\Users\user\.helidon\plugins\cli-plugins-d4b7bb55.jar, UpdateMetadata, --debug, --baseUrl, https://helidon.io/cli-data, --cacheDir, C:\Users\user\.helidon\cache, --version, 2.3.2, --cliVersion, 2.2.3, --maxAttempts, 3]
Executing command: java -XX:TieredStopAtLevel=1 -XX:CICompilerCount=2 -jar C:\Users\user\.helidon\plugins\cli-plugins-d4b7bb55.jar UpdateMetadata --debug --baseUrl https://helidon.io/cli-data --cacheDir C:\Users\user\.helidon\cache --version 2.3.2 --cliVersion 2.2.3 --maxAttempts 3

Helidon version 2.3.2 not found.

Dev output with debug on a working machine:

helidon init --debug --version 2.3.2
Found maven executable /Users/tomas/bin/apache-maven-3.6.3/bin/mvn
stale check is false for /Users/tomas/.helidon/cache/latest (last: 09-16-2021 14:35:56 CEST, now: 09-16-2021 14:38:40 CEST, elapsed: 0 days 00:02:43, remain: 0 days 11:57:16)
stale check is false for /Users/tomas/.helidon/cache/2.3.3/.lastUpdate (last: 09-16-2021 14:35:54 CEST, now: 09-16-2021 14:38:40 CEST, elapsed: 0 days 00:02:45, remain: 0 days 11:57:14)
stale check is false (retry) for /Users/tomas/.helidon/cache/latest
stale check is false (retry) for /Users/tomas/.helidon/cache/2.3.3/.lastUpdate

Version 2.2.3 of this CLI is now available.
Please see https://github.com/oracle/helidon-build-tools/blob/master/helidon-cli/CHANGELOG.md to update.

Using Helidon version 2.3.2
Helidon flavor
  (1) SE
  (2) MP
Enter selection (Default: 1): 2
stale check forced (not found) for /Users/tomas/.helidon/cache/2.3.2/.lastUpdate
Updating metadata for Helidon version 2.3.2
executing [java, -XX:TieredStopAtLevel=1, -XX:CICompilerCount=2, -jar, /Users/tomas/.helidon/plugins/cli-plugins-17f7cba0.jar, UpdateMetadata, --debug, --baseUrl, https://helidon.io/cli-data, --cacheDir, /Users/tomas/.helidon/cache, --version, 2.3.2, --cliVersion, 2.2.0, --maxAttempts, 3]
Executing command: java -XX:TieredStopAtLevel=1 -XX:CICompilerCount=2 -jar /Users/tomas/.helidon/plugins/cli-plugins-17f7cba0.jar UpdateMetadata --debug --baseUrl https://helidon.io/cli-data --cacheDir /Users/tomas/.helidon/cache --version 2.3.2 --cliVersion 2.2.0 --maxAttempts 3
Process ID: 82005
Waiting for completion, pid=82005, timeout=30, unit=SECONDS
Select archetype
  (1) bare | Minimal Helidon MP project suitable to start from scratch
  (2) quickstart | Sample Helidon MP project that includes multiple REST operations
  (3) database | Helidon MP application that uses JPA with an in-memory H2 database
@tomas-langer
Copy link
Member Author

Also the link in my output does not exist:
https://github.com/oracle/helidon-build-tools/blob/master/helidon-cli/CHANGELOG.md

@tomas-langer
Copy link
Member Author

Tried with latest CLI version, works good. Output:

helidon init --debug --version 2.3.2
Found maven executable /Users/tomas/bin/apache-maven-3.6.3/bin/mvn
stale check is false for /Users/tomas/.helidon/cache/latest (last: 09-16-2021 14:38:42 CEST, now: 09-16-2021 15:08:42 CEST, elapsed: 0 days 00:30:00, remain: 0 days 11:29:59)
stale check is false for /Users/tomas/.helidon/cache/2.3.3/.lastUpdate (last: 09-16-2021 14:35:54 CEST, now: 09-16-2021 15:08:42 CEST, elapsed: 0 days 00:32:47, remain: 0 days 11:27:12)
no update available
Using Helidon version 2.3.2
Helidon flavor
  (1) SE
  (2) MP
Enter selection (Default: 1): 2
stale check forced (not found) for /Users/tomas/.helidon/cache/2.3.2/.lastUpdate
Updating metadata for Helidon version 2.3.2
unpacked /Users/tomas/.helidon/plugins/cli-plugins-d4b7bb55.jar
executing [java, -XX:TieredStopAtLevel=1, -XX:CICompilerCount=2, -jar, /Users/tomas/.helidon/plugins/cli-plugins-d4b7bb55.jar, UpdateMetadata, --debug, --baseUrl, https://helidon.io/cli-data, --cacheDir, /Users/tomas/.helidon/cache, --version, 2.3.2, --cliVersion, 2.2.3, --maxAttempts, 3]
Executing command: java -XX:TieredStopAtLevel=1 -XX:CICompilerCount=2 -jar /Users/tomas/.helidon/plugins/cli-plugins-d4b7bb55.jar UpdateMetadata --debug --baseUrl https://helidon.io/cli-data --cacheDir /Users/tomas/.helidon/cache --version 2.3.2 --cliVersion 2.2.3 --maxAttempts 3
Process ID: 82878
Waiting for completion, pid=82878, timeout=30, unit=SECONDS
Select archetype
  (1) bare | Minimal Helidon MP project suitable to start from scratch
  (2) quickstart | Sample Helidon MP project that includes multiple REST operations
  (3) database | Helidon MP application that uses JPA with an in-memory H2 database

@dalexandrov
Copy link

local settings.xml issue?

@romain-grecourt
Copy link
Contributor

Seems like it gave up without an error message, I'm not too familiar with the code that does this.

@tomas-langer the URL has been fixed in the latest release, but it's only going to take effect in the next upgrade.
@dalexandrov settings.xml is not involved in the metadata check.

@romain-grecourt romain-grecourt added the bug Something isn't working label Sep 16, 2021
@romain-grecourt romain-grecourt modified the milestone: 2.2.4 Sep 16, 2021
@tomas-langer
Copy link
Member Author

I can see that when I run UpdateMetadata in IDE, it prints nice debug messages. The output is lost when running within CLI.
We should at least make sure the output is visible when we run cli with --debug to be able to troubleshoot such issues

@tomas-langer
Copy link
Member Author

This is my output when I connect through VPN:

stale check forced (not found) for /Users/tomas/.helidon/cache/2.3.2/.lastUpdate
Updating metadata for Helidon version 2.3.2
executing [java, -XX:TieredStopAtLevel=1, -XX:CICompilerCount=2, -jar, /Users/tomas/.helidon/plugins/cli-plugins-d4b7bb55.jar, UpdateMetadata, --debug, --baseUrl, https://helidon.io/cli-data, --cacheDir, /Users/tomas/.helidon/cache, --version, 2.3.2, --cliVersion, 2.2.3, --maxAttempts, 3]
Executing command: java -XX:TieredStopAtLevel=1 -XX:CICompilerCount=2 -jar /Users/tomas/.helidon/plugins/cli-plugins-d4b7bb55.jar UpdateMetadata --debug --baseUrl https://helidon.io/cli-data --cacheDir /Users/tomas/.helidon/cache --version 2.3.2 --cliVersion 2.2.3 --maxAttempts 3
Process ID: 16819
Waiting for completion, pid=16819, timeout=30, unit=SECONDS

Helidon version 2.3.2 not found.

@romain-grecourt
Copy link
Contributor

Is the VPN output with the CLI or IDE ?

@tomas-langer
Copy link
Member Author

CLI

@tomas-langer
Copy link
Member Author

Identified where we throw away the debug output of the plugins:
Class Plugins, line 113 - method execute - the message consumer is set to Plugins::devNull

@romain-grecourt
Copy link
Contributor

Looks like this variant of the execute method is designed to throw await the output.

Usages in Metadata shows that the other variant is used and output shouldn't be thrown away:

if (debugPlugin) {
    args.add("--debug");
    Plugins.execute(PLUGIN_NAME, args, PLUGIN_MAX_WAIT_SECONDS, Metadata::info);
} else {
    Plugins.execute(PLUGIN_NAME, args, PLUGIN_MAX_WAIT_SECONDS);
}

debugPlugin is set by calling Metadata.builder().debugPlugin(), see this

The usage of Metadata.builder() is in CommonOptions:

metadata = Metadata.builder()
     .url(metadataUrl)
     .updateFrequency(config.checkForUpdatesIntervalHours())
     .build();

I'm thinking the problem might be that It doesn't call .debugPlugin() with the value of --debug, also the log level used should probably be debug instead of info.

@romain-grecourt romain-grecourt added this to the 2.2.4 milestone Sep 29, 2021
romain-grecourt added a commit to romain-grecourt/helidon-build-tools that referenced this issue Sep 29, 2021
 - Make Plugins.PluginFailed a checked exception to force error handling
 - Wrap Plugins.PluginFailed with Metadata.UpdatedFailed as another checked exception to expose metadata update errors
 - Metadata.UpdateFailed is explicitly thrown by every public methods of Metadata that performs an update check

Promote io.helidon.build.cli.codegen.Unchecked to io.helidon.build.util.Unchecke
Rename util module from helidon.build.utils to io.helidon.build.util (same as the package name)

Fixes helidon-io#487
romain-grecourt added a commit that referenced this issue Sep 29, 2021
* Improve Metadata udpate error handling:
 - Make Plugins.PluginFailed a checked exception to force error handling
 - Wrap Plugins.PluginFailed with Metadata.UpdatedFailed as another checked exception to expose metadata update errors
 - Metadata.UpdateFailed is explicitly thrown by every public methods of Metadata that performs an update check
 - Add a Plugins.PluginFailedUnchecked to propagate errors that are already logged

Promote io.helidon.build.cli.codegen.Unchecked to io.helidon.build.util.Unchecke
Rename util module from helidon.build.utils to io.helidon.build.util (same as the package name)

Fixes #487
romain-grecourt added a commit to romain-grecourt/helidon-build-tools that referenced this issue Jan 4, 2022
Make Plugins.PluginFailed a checked exception to force error handling
Wrap Plugins.PluginFailed with Metadata.UpdatedFailed as another checked exception to expose metadata update errors
Metadata.UpdateFailed is explicitly thrown by every public methods of Metadata that performs an update check
Promote io.helidon.build.cli.codegen.Unchecked to io.helidon.build.util.Unchecke

Fixed a bug in Plugin log when Plugin.execute is invoked with a null consumer for output.

Fixes helidon-io#487
Fixes helidon-io#507 (forward port of helidon-io#506)
romain-grecourt added a commit that referenced this issue Jan 5, 2022
* Improve Metadata update error handling:

Make Plugins.PluginFailed a checked exception to force error handling
Wrap Plugins.PluginFailed with Metadata.UpdatedFailed as another checked exception to expose metadata update errors
Metadata.UpdateFailed is explicitly thrown by every public methods of Metadata that performs an update check
Promote io.helidon.build.cli.codegen.Unchecked to io.helidon.build.util.Unchecke

Fixed a bug in Plugin log when Plugin.execute is invoked with a null consumer for output.

Fixes #487
Fixes #507 (forward port of #506)

* Always pass-in a string consumer for Plugins.execute
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants