Last active
November 15, 2024 12:16
-
-
Save xr09/e760aeee47df08c2b1a81b33f378161c to your computer and use it in GitHub Desktop.
check helm minimum version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{- define "check-minimum-helm-version" -}} | |
{{- $majorRequired := 3 -}} | |
{{- $minorRequired := 7 -}} | |
{{- $match := .Capabilities.HelmVersion.Version | toString | regexFind "^v[0-9]+\\.[0-9]+\\." -}} | |
{{- $major := $match | trimPrefix "v" | trimSuffix "." | regexFind "[0-9]+\\." | trimAll "." | int -}} | |
{{- $minor := $match | trimPrefix "v" | trimSuffix "." | regexFind "\\.[0-9]+" | trimAll "." | int -}} | |
{{- if (lt $major $majorRequired) }} | |
{{- fail "Helm version is too old, please upgrade to at least Helm 3.7" }} | |
{{- else if and ( eq $major $majorRequired ) (lt $minor $minorRequired) }} | |
{{- fail "Helm version is too old, please upgrade to at least Helm 3.7" }} | |
{{- end }} | |
{{- end }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment