Skip to content

Commit 4e473de

Browse files
authored
Compare semvers when checking if existing chart is up-to-date (#702)
When chartfile.yaml requirements are parsed, version string is converted into a semver.Version struct, dropping "optional" v prefix from the version. Match this behaviour for Chart.yaml version so that they can be compared with each other. Closes #701
1 parent f0cb798 commit 4e473de

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/helm/charts.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ type Charts struct {
6969

7070
// chartManifest represents a Helm chart's Chart.yaml
7171
type chartManifest struct {
72-
Version string `yaml:"version"`
72+
Version semver.Version `yaml:"version"`
7373
}
7474

7575
// ChartDir returns the directory pulled charts are saved in
@@ -108,7 +108,7 @@ func (c Charts) Vendor() error {
108108
return fmt.Errorf("unmarshalling chart manifest: %w", err)
109109
}
110110

111-
if chartYAML.Version == r.Version.String() {
111+
if chartYAML.Version.String() == r.Version.String() {
112112
log.Printf(" %s@%s exists", r.Chart, r.Version.String())
113113
continue
114114
} else {

0 commit comments

Comments
 (0)