in internal/pkg/cli/app_deploy.go [109:142]
func (opts *DeployAppOpts) Execute() error {
oamWorkload, err := workload.NewOamWorkload(
&workload.OamWorkloadProps{
OamFiles: opts.OamFiles,
})
if err != nil {
return err
}
// Validate we have app config and component schematics that go together
for _, component := range oamWorkload.ApplicationConfiguration.Spec.Components {
_, ok := oamWorkload.ComponentSchematics[component.ComponentName]
if !ok {
log.Errorf("Could not find the component schematic for %s\n", component.ComponentName)
return fmt.Errorf("Application configuration refers to component %s, but no file provided the component schematic", component.ComponentName)
}
}
// Deploy or dry-run the application components
for _, componentInstance := range oamWorkload.ApplicationConfiguration.Spec.Components {
schematic, _ := oamWorkload.ComponentSchematics[componentInstance.ComponentName]
if opts.DryRun {
err = opts.dryRunComponentInstance(oamWorkload.ApplicationConfiguration, &componentInstance, schematic)
} else {
err = opts.deployComponentInstance(oamWorkload.ApplicationConfiguration, &componentInstance, schematic)
}
if err != nil {
break
}
}
return err
}