Skip to content

Commit

Permalink
makes sure patch version does not contain any build or subpatch version
Browse files Browse the repository at this point in the history
Signed-off-by: Navratan Lal Gupta <navilg0409@gmail.com>
  • Loading branch information
navilg committed Nov 2, 2024
1 parent cdf24db commit 0280609
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion internal/ikubernetes/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,16 @@ func GetK8sVersion() (*string, error) {
return nil, err
}

k8sSemversion := k8sVersion.String()
k8sSemversionSplit := strings.Split(k8sVersion.String(), ".")

re := regexp.MustCompile(`[^0-9]`)
result := re.ReplaceAllString(k8sSemversionSplit[2], "/")

resultSplit := strings.Split(result, "/")

k8sSemversionPatch := resultSplit[0]

k8sSemversion := k8sSemversionSplit[0] + "." + k8sSemversionSplit[1] + "." + k8sSemversionPatch

return &k8sSemversion, nil

Expand Down

0 comments on commit 0280609

Please sign in to comment.