Merge pull request #6688 from bacongobbler/restore-revision

fix(chartutil): restore .Release.Revision
pull/6691/head
Matthew Fisher 5 years ago committed by GitHub
commit 5f15be36e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -200,6 +200,7 @@ func (i *Install) Run(chrt *chart.Chart, vals map[string]interface{}) (*release.
options := chartutil.ReleaseOptions{ options := chartutil.ReleaseOptions{
Name: i.ReleaseName, Name: i.ReleaseName,
Namespace: i.Namespace, Namespace: i.Namespace,
Revision: 1,
IsInstall: true, IsInstall: true,
} }
valuesToRender, err := chartutil.ToRenderValues(chrt, vals, options, caps) valuesToRender, err := chartutil.ToRenderValues(chrt, vals, options, caps)

@ -147,6 +147,7 @@ func (u *Upgrade) prepareUpgrade(name string, chart *chart.Chart, vals map[strin
options := chartutil.ReleaseOptions{ options := chartutil.ReleaseOptions{
Name: name, Name: name,
Namespace: currentRelease.Namespace, Namespace: currentRelease.Namespace,
Revision: revision,
IsUpgrade: true, IsUpgrade: true,
} }

@ -130,6 +130,7 @@ func ReadValuesFile(filename string) (Values, error) {
type ReleaseOptions struct { type ReleaseOptions struct {
Name string Name string
Namespace string Namespace string
Revision int
IsUpgrade bool IsUpgrade bool
IsInstall bool IsInstall bool
} }
@ -149,6 +150,7 @@ func ToRenderValues(chrt *chart.Chart, chrtVals map[string]interface{}, options
"Namespace": options.Namespace, "Namespace": options.Namespace,
"IsUpgrade": options.IsUpgrade, "IsUpgrade": options.IsUpgrade,
"IsInstall": options.IsInstall, "IsInstall": options.IsInstall,
"Revision": options.Revision,
"Service": "Helm", "Service": "Helm",
}, },
} }

@ -99,6 +99,8 @@ func TestToRenderValues(t *testing.T) {
o := ReleaseOptions{ o := ReleaseOptions{
Name: "Seven Voyages", Name: "Seven Voyages",
Namespace: "default",
Revision: 1,
IsInstall: true, IsInstall: true,
} }
@ -115,6 +117,12 @@ func TestToRenderValues(t *testing.T) {
if name := relmap["Name"]; name.(string) != "Seven Voyages" { if name := relmap["Name"]; name.(string) != "Seven Voyages" {
t.Errorf("Expected release name 'Seven Voyages', got %q", name) t.Errorf("Expected release name 'Seven Voyages', got %q", name)
} }
if namespace := relmap["Namespace"]; namespace.(string) != "default" {
t.Errorf("Expected namespace 'default', got %q", namespace)
}
if revision := relmap["Revision"]; revision.(int) != 1 {
t.Errorf("Expected revision '1', got %d", revision)
}
if relmap["IsUpgrade"].(bool) { if relmap["IsUpgrade"].(bool) {
t.Error("Expected upgrade to be false.") t.Error("Expected upgrade to be false.")
} }

Loading…
Cancel
Save