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

Method Run

cli/pkg/kctrl/cmd/app/init.go:50–100  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

48}
49
50func (o *InitOptions) Run() error {
51 if o.chdir != "" {
52 err := os.Chdir(o.chdir)
53 if err != nil {
54 return err
55 }
56 }
57
58 o.ui.PrintHeaderText("\nPre-requisite")
59 o.ui.PrintInformationalText("Welcome! Before we start on the app creation journey, please ensure the following pre-requites are met:\n" +
60 "* The Carvel suite of tools are installed. Do get familiar with the following Carvel tools: ytt, imgpkg, vendir, and kbld.\n" +
61 "* You have access to an OCI registry, and authenticated locally so that images can be pushed. e.g. docker login <REGISTRY URL>\n")
62
63 appBuild, err := buildconfigs.NewAppBuild()
64 if err != nil {
65 return err
66 }
67
68 err = o.getAppBuildName(appBuild)
69 if err != nil {
70 return err
71 }
72
73 err = o.writeAppFile(appBuild)
74 if err != nil {
75 return err
76 }
77
78 fetchMode, err := sources.NewSource(o.ui, appBuild).Configure()
79 if err != nil {
80 return err
81 }
82
83 err = sources.NewVendirRunner(o.ui).Sync(fetchMode)
84 if err != nil {
85 return err
86 }
87
88 err = sources.NewTemplate(o.ui, appBuild).Configure(fetchMode)
89 if err != nil {
90 return err
91 }
92
93 appBuild.InitializeOrKeepDeploySection()
94 buildconfigs.ConfigureExportSection(appBuild, fetchMode == sources.LocalDirectory, sources.VendirSyncDirectory)
95 err = appBuild.Save()
96 if err != nil {
97 return err
98 }
99 return nil
100}
101
102func (o *InitOptions) getAppBuildName(appBuild *buildconfigs.AppBuild) error {
103 o.ui.PrintHeaderText("\nBasic Information")

Callers

nothing calls this directly

Calls 13

getAppBuildNameMethod · 0.95
writeAppFileMethod · 0.95
SaveMethod · 0.95
NewAppBuildFunction · 0.92
NewSourceFunction · 0.92
NewVendirRunnerFunction · 0.92
NewTemplateFunction · 0.92
ConfigureExportSectionFunction · 0.92
SyncMethod · 0.80
PrintHeaderTextMethod · 0.65

Tested by

no test coverage detected