Commit 168b17cf authored by Adnan Abdulhussein's avatar Adnan Abdulhussein

fix(tiller): ensure only the parent NOTES is used

parent fcdb79da
......@@ -21,6 +21,7 @@ import (
"errors"
"fmt"
"log"
"path/filepath"
"regexp"
"strings"
......@@ -678,7 +679,10 @@ func (s *releaseServer) renderResources(ch *chart.Chart, values chartutil.Values
notes := ""
for k, v := range files {
if strings.HasSuffix(k, notesFileSuffix) {
notes = v
// Only apply the notes if it belongs to the parent chart
if k == filepath.Join(ch.Metadata.Name, notesFileSuffix) {
notes = v
}
delete(files, k)
}
}
......
......@@ -393,6 +393,53 @@ func TestInstallReleaseWithNotesRendered(t *testing.T) {
}
}
func TestInstallReleaseWithChartAndDependencyNotes(t *testing.T) {
c := helm.NewContext()
rs := rsFixture()
// TODO: Refactor this into a mock.
req := &services.InstallReleaseRequest{
Namespace: "spaced",
Chart: &chart.Chart{
Metadata: &chart.Metadata{Name: "hello"},
Templates: []*chart.Template{
{Name: "hello", Data: []byte("hello: world")},
{Name: "hooks", Data: []byte(manifestWithHook)},
{Name: "NOTES.txt", Data: []byte(notesText)},
},
Dependencies: []*chart.Chart{
{
Metadata: &chart.Metadata{Name: "hello"},
Templates: []*chart.Template{
{Name: "hello", Data: []byte("hello: world")},
{Name: "hooks", Data: []byte(manifestWithHook)},
{Name: "NOTES.txt", Data: []byte(notesText + " child")},
},
},
},
},
}
res, err := rs.InstallRelease(c, req)
if err != nil {
t.Fatalf("Failed install: %s", err)
}
if res.Release.Name == "" {
t.Errorf("Expected release name.")
}
rel, err := rs.env.Releases.Get(res.Release.Name, res.Release.Version)
if err != nil {
t.Errorf("Expected release for %s (%v).", res.Release.Name, rs.env.Releases)
}
t.Logf("rel: %v", rel)
if rel.Info.Status.Notes != notesText {
t.Fatalf("Expected '%s', got '%s'", notesText, rel.Info.Status.Notes)
}
}
func TestInstallReleaseDryRun(t *testing.T) {
c := helm.NewContext()
rs := rsFixture()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment