Detecting Helm v2 and v3 in scripts

Matt Farina

If you are going to work with both Helm v2 and Helm v3 in your scripts this email is where we are looking for your input.

`helm version` in v2 and the forthcoming v3 work a little different. This includes the `-c` flag for client side version only (not available in v3 where it causes an error). You can get a rundown at

Marc Khouzam noted that the acceptance-testing repo uses the following to detect the versions...

if helm version -c &> /dev/null; then
    // v2

This relies on the error response to detect the versions.

There is a proposed PR to add and ignore the `-c` flag to v3 in over to get the version when it's used. This means a script would need to parse the version to tell the difference between v2 and v3. But, it would provide the ability to read and detect the version with more accurate (e.g., detect minor versions)

The PR to add this flag is at

If you are into scripting with helm which path would you prefer? Do you need to detect minor versions? If you have any feedback please feel free to leave it on the PR or in response to this message.