Fix helm remove duplicate plugins for versions >= 3.10.x #106
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The first string comparison (if [[ "${HELM_VERSION}" > "3.3.1" ]];) may not work as expected for versions greater than or equal to 3.10.x due to the fact that string comparison in Bash is lexicographical rather than numerical. In lexicographical comparison, each character in the string is compared one by one, which may lead to unexpected results when dealing with version numbers that have more than one digit.
For instance, in lexicographical comparison:
"3.10" is considered less than "3.2" because the comparison starts with the first character and "1" comes before "2" in the ASCII character set.
Similarly, "3.10" is considered less than "3.2.1" for the same reason.
To address this limitation, the modified code uses semantic version sorting by employing the sort -V command. This ensures that version numbers are compared based on their numeric significance rather than lexicographically. The modification is designed to handle cases where the version number includes multiple digits or subversions, such as 3.10.x, and accurately determines if the version is equal to or greater than 3.3.1.