rockcarver / frodo-cli

A CLI to manage ForgeRock platform deployments supporting Identity Cloud tenants, ForgeOps deployments, and classic deployments.
MIT License
17 stars 16 forks source link

Breaking change: Incompatible name format in latest release (Frodo CLI 1.0.0) affects binaries since v0.16.2-0 #266

Closed brain-hol closed 1 year ago

brain-hol commented 1 year ago

Frodo CLI version

# frodo -v
You seem to be running the binary package
Installed versions:
cli: v1.0.0
lib: v1.1.0
node: v18.5.0

Describe the issue

The latest version of Frodo CLI (1.0.0) was released with the name Frodo CLI 1.0.0 which does not adhere to the Semantic Versioning (SemVer) standard. This naming inconsistency breaks compatibility with all versions of Frodo CLI since v0.16.2-0 (specifically commit 648697e) that check for remote versions.

Here's the output of all commands since this breaking issue occurred:

# frodo
ERROR: exception running frodo - Error: Invalid argument not valid semver ('Frodo CLI 1.0.0' received)

Reason for Error

When running Frodo, the following line is executed to check the version being used against the remote version:

https://github.com/rockcarver/frodo-cli/blob/f66677899882c607e4d5551e352f073360cc2cbe/src/utils/Version.ts#L154

This line subsequently utilizes the compare-versions library to parse the SemVer and perform a comparison.

To fetch the latest version, frodo-cli (or more accurately, frodo-lib) makes a GET request to https://api.github.com/repos/rockcarver/frodo-cli/releases. It then filters the response to find only non-prerelease releases:

https://github.com/rockcarver/frodo-cli/blob/f66677899882c607e4d5551e352f073360cc2cbe/src/utils/Version.ts#L60

Running this request manually provides the list of non-prerelease versions that the endpoint returns:

"Frodo CLI 1.0.0"
"0.24.5"
"0.24.4"
"0.24.3"
"0.24.2"
"0.23.0"

As shown above, all previous non-prerelease versions were valid SemVer, but the latest release, Frodo CLI 1.0.0, deviates from the standard. Consequently, the compare-versions library throws an exception that frodo-cli fails to catch, resulting in a process crash.

To resolve this issue, the latest version should adhere to the SemVer standard, allowing for proper comparison and preventing errors in the frodo command execution.

hfranklin commented 1 year ago

@vscheuber it looks like the release names were changed in the pipeline on the last GitHub release and that is causing this issue. The question is if we should change the release naming back or if we should move to using the release tag rather than the release name. Do you have a preference?

vscheuber commented 1 year ago

@hfranklin Yeah, I just completed a fire-drill chasing down this issue. This appears to be unrelated to our pipeline changes (our release naming did not change, I validated that) but it appears that the name tag has changed format a few weeks ago (before we ever merged the pipeline changes) but since we didn't have a full binary release, we didn't notice until I pushed out the 1.0.0 release.

I have a full fix ready to go, which uses the tag_name instead of the name element of the github release document to determine the version. This seems a lot safer than the name, which might be muddied with more human readable text going forward.

rjeghanathan commented 1 year ago

Anyone still facing the issue? I am on a macbook pro 16 intel and using homebrew to install frodo and get the below exception while running frodo: ERROR: exception running frodo - Error: Invalid argument not valid semver ('Frodo CLI 1.0.1' received) Error: Invalid argument not valid semver ('Frodo CLI 1.0.1' received) at validateAndParse (/snapshot/frodo-cli-20230711-19907-f6y6t5/node_modules/compare-versions/lib/umd/index.js:126:19) at compareVersions (/snapshot/frodo-cli-20230711-19907-f6y6t5/node_modules/compare-versions/lib/umd/index.js:17:20) at getVersions (/snapshot/frodo-cli-20230711-19907-f6y6t5/cjs/utils/Version.js:122:91) at process.runNextTicks [as _tickCallback] (node:internal/process/task_queues:60:5) at Function.runMain (pkg/prelude/bootstrap.js:1980:13) at node:internal/main/run_main_module:17:47 at async /snapshot/frodo-cli-20230711-19907-f6y6t5/cjs/app.js:34:61

vscheuber commented 1 year ago

@rjeghanathan and others still seeing this issue, can you please follow these steps and let us know if they solve your issue:

rm ~/.frodo/Versions.json
brew unlink frodo-cli
brew untap rockcarver/frodo-cli
brew tap rockcarver/frodo-cli
brew install frodo-cli
rjeghanathan commented 1 year ago

thank you @vscheuber That helped with the issue