elastic/support-diagnostics

Checking for diagnostic version updates fails because of invalid version string

fgierlinger opened this issue · 3 comments

Summary
Since the version 8.1.3 the version tag has changed and a v is prepended to the version string.

  • 8.1.1
  • 8.1.2
  • v8.1.3
  • v8.1.4

The diagnostics.log reveal that there is an error while parsing the string.

12:58:41.841 [main] INFO  com.elastic.support.diagnostics.commands.CheckDiagnosticVersion - Checking for diagnostic version updates.
12:58:42.307 [main] ERROR com.elastic.support.diagnostics.commands.CheckDiagnosticVersion - com.vdurmont.semver4j.SemverException: Invalid version (no major version): v8.1.4
12:58:42.307 [main] INFO  com.elastic.support.diagnostics.commands.CheckDiagnosticVersion - Issue encountered while checking diagnostic version for updates.
12:58:42.307 [main] INFO  com.elastic.support.diagnostics.commands.CheckDiagnosticVersion - Failed to get current diagnostic version from Github.
12:58:42.307 [main] INFO  com.elastic.support.diagnostics.commands.CheckDiagnosticVersion - If Github is not accessible from this environment current supported version cannot be confirmed.

I suppose the added v is not stripped before passing the version string to the com.vdurmont.semver4j library.

String ver = rootNode.path("tag_name").asText();
Semver diagVer = new Semver(context.diagVersion, Semver.SemverType.NPM);
String rule = ">= " + ver;

Expected behaviour
The version string gets parsed successfully and the check, if the current version is used, succeeds.

System information
OS: RHEL 7.9
Docker: 1.13.1
Support Diagnostics: v8.1.4

Good catch. We added the v to be consistent with other tags, but missed that we broke this. Thanks, we'll see what we can do to fix it.

Thanks for this report @fgierlinger. With today's release, the included fix future proof's it and, for existing user's, I have released with the v-free tag style so that they can properly parse it. After a few releases I'll stop doing that, but this way users can upgrade naturally without it breaking.

Checking for diagnostic version updates.
Warning: DiagnosticService version:8.1.4 is not the current recommended release
The current release is 8.2.1
The latest version can be downloaded at https://github.com/elastic/support-diagnostics/releases/download/8.2.1/diagnostics-8.2.1-dist.zip
Press the Enter key to continue.