()
| 48 | } |
| 49 | |
| 50 | func (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 | |
| 102 | func (o *InitOptions) getAppBuildName(appBuild *buildconfigs.AppBuild) error { |
| 103 | o.ui.PrintHeaderText("\nBasic Information") |
nothing calls this directly
no test coverage detected