@@ -13,12 +13,12 @@ import (
1313 "github.com/docker/app/internal/helm/templateconversion"
1414 "github.com/docker/app/internal/helm/templateloader"
1515 "github.com/docker/app/internal/helm/templatev1beta2"
16- "github.com/docker/app/internal/settings"
1716 "github.com/docker/app/internal/slices"
1817 "github.com/docker/app/internal/yaml"
1918 "github.com/docker/app/render"
2019 "github.com/docker/app/types"
2120 "github.com/docker/app/types/metadata"
21+ "github.com/docker/app/types/settings"
2222 "github.com/docker/cli/cli/command/stack/kubernetes"
2323 "github.com/docker/cli/cli/compose/loader"
2424 "github.com/docker/cli/kubernetes/compose/v1beta1"
@@ -49,8 +49,8 @@ func Helm(app *types.App, env map[string]string, shouldRender bool, stackVersion
4949 if err := os .MkdirAll (targetDir , 0755 ); err != nil {
5050 return errors .Wrap (err , "failed to create Chart directory" )
5151 }
52- err := makeChart ( app .Metadata (), targetDir )
53- if err != nil {
52+ meta := app .Metadata ()
53+ if err := makeChart ( & meta , targetDir ); err != nil {
5454 return err
5555 }
5656 if shouldRender {
@@ -70,8 +70,7 @@ func Helm(app *types.App, env map[string]string, shouldRender bool, stackVersion
7070 for k := range vars {
7171 variables = append (variables , k )
7272 }
73- err = makeStack (app .Name , targetDir , data , stackVersion )
74- if err != nil {
73+ if err := makeStack (app .Name , targetDir , data , stackVersion ); err != nil {
7574 return err
7675 }
7776 return makeValues (app , targetDir , env , variables )
@@ -80,11 +79,8 @@ func Helm(app *types.App, env map[string]string, shouldRender bool, stackVersion
8079// makeValues updates helm values.yaml with used variables from settings and env
8180func makeValues (app * types.App , targetDir string , env map [string ]string , variables []string ) error {
8281 // merge our variables into Values.yaml
83- s , err := settings .LoadMultiple (app .Settings ())
84- if err != nil {
85- return err
86- }
87- metaPrefixed , err := settings .Load (app .Metadata (), settings .WithPrefix ("app" ))
82+ s := app .Settings ()
83+ metaPrefixed , err := settings .Load (app .MetadataRaw (), settings .WithPrefix ("app" ))
8884 if err != nil {
8985 return err
9086 }
@@ -210,13 +206,8 @@ func helmRender(app *types.App, targetDir string, env map[string]string, stackVe
210206 return ioutil .WriteFile (filepath .Join (targetDir , "templates" , "stack.yaml" ), stackData , 0644 )
211207}
212208
213- func makeChart (data []byte , targetDir string ) error {
214- var meta metadata.AppMetadata
215- err := yaml .Unmarshal (data , & meta )
216- if err != nil {
217- return errors .Wrap (err , "failed to parse application metadata" )
218- }
219- hmeta , err := toHelmMeta (& meta )
209+ func makeChart (meta * metadata.AppMetadata , targetDir string ) error {
210+ hmeta , err := toHelmMeta (meta )
220211 if err != nil {
221212 return errors .Wrap (err , "failed to convert application metadata" )
222213 }
0 commit comments