MCPcopy Create free account
hub / github.com/carvel-dev/kapp-controller / writeAppFile

Method writeAppFile

cli/pkg/kctrl/cmd/app/init.go:136–156  ·  view source on GitHub ↗
(appBuild *buildconfigs.AppBuild)

Source from the content-addressed store, hash-verified

134}
135
136func (o *InitOptions) writeAppFile(appBuild *buildconfigs.AppBuild) error {
137 appConfig, err := o.generateApp(appBuild)
138 if err != nil {
139 return err
140 }
141
142 appContent, err := yaml.Marshal(appConfig)
143 if err != nil {
144 return err
145 }
146 err = os.WriteFile(AppFileName, appContent, os.ModePerm)
147 if err != nil {
148 return err
149 }
150 o.ui.PrintHeaderText("\nOutput")
151 o.ui.PrintInformationalText("Successfully updated app-build.yml\n")
152 o.ui.PrintInformationalText("Successfully updated app.yml\n")
153 o.ui.PrintHeaderText("\n**Next steps**")
154 o.ui.PrintInformationalText("Use `dev deploy` command to iterate on the app and deploy locally.\n")
155 return nil
156}
157
158func (o *InitOptions) generateApp(appBuild *buildconfigs.AppBuild) (kcv1alpha1.App, error) {
159 var app kcv1alpha1.App

Callers 1

RunMethod · 0.95

Calls 4

generateAppMethod · 0.95
PrintHeaderTextMethod · 0.65
MarshalMethod · 0.45

Tested by

no test coverage detected