()
| 78 | ) |
| 79 | |
| 80 | func getHelmVersion() (*semver.Version, error) { |
| 81 | cmd := exec.Command(os.Getenv("HELM_BIN"), "version") |
| 82 | debugPrint("Executing %s", strings.Join(cmd.Args, " ")) |
| 83 | output, err := cmd.CombinedOutput() |
| 84 | if err != nil { |
| 85 | return nil, fmt.Errorf("Failed to run `%s version`: %w", os.Getenv("HELM_BIN"), err) |
| 86 | } |
| 87 | versionOutput := string(output) |
| 88 | |
| 89 | matches := helmVersionRE.FindStringSubmatch(versionOutput) |
| 90 | if matches == nil { |
| 91 | return nil, fmt.Errorf("Failed to find version in output %#v", versionOutput) |
| 92 | } |
| 93 | helmVersion, err := semver.NewVersion(matches[1]) |
| 94 | if err != nil { |
| 95 | return nil, fmt.Errorf("Failed to parse version %#v: %w", matches[1], err) |
| 96 | } |
| 97 | |
| 98 | return helmVersion, nil |
| 99 | } |
| 100 | |
| 101 | func isHelmVersionAtLeast(versionToCompareTo *semver.Version) (bool, error) { |
| 102 | helmVersion, err := getHelmVersion() |
no test coverage detected