Skip to content

Commit

Permalink
adding fix for helm versioning issue
Browse files Browse the repository at this point in the history
Signed-off-by: Vishwanath Hiremath <[email protected]>
  • Loading branch information
vishwahiremat committed Jan 6, 2025
1 parent fa1078f commit 311ab9b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ require (
cloud.google.com/go/iam v1.1.8 // indirect
cloud.google.com/go/storage v1.42.0 // indirect
dario.cat/mergo v1.0.1 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/Microsoft/hcsshim v0.12.4 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ
github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE=
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
github.com/Masterminds/semver/v3 v3.3.0 h1:B8LGeaivUe71a5qox1ICM/JLl0NqZSW5CHyL+hmvYS0=
github.com/Masterminds/semver/v3 v3.3.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe3tPhs=
Expand Down
9 changes: 8 additions & 1 deletion pkg/cli/helm/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"helm.sh/helm/v3/pkg/storage/driver"
"k8s.io/cli-runtime/pkg/genericclioptions"

"github.com/Masterminds/semver"
"github.com/radius-project/radius/pkg/version"
)

Expand All @@ -51,7 +52,13 @@ func NewDefaultClusterOptions() ClusterOptions {
// If this is an edge build, we'll use the latest available.
chartVersion := version.ChartVersion()
if !version.IsEdgeChannel() {
chartVersion = fmt.Sprintf("~%s", version.ChartVersion())
// When the chart version is the final release, we should use the ~ operator to ensure we fetch the latest patch version.
// For the pre release or dev builds, we should use the exact version.
ver, _ := semver.NewVersion(chartVersion)
preRelease := ver.Prerelease()
if preRelease == "" {
chartVersion = fmt.Sprintf("~%s", version.ChartVersion())
}
}

return ClusterOptions{
Expand Down

0 comments on commit 311ab9b

Please sign in to comment.