@@ -306,27 +306,14 @@ func RunRuntimeInstall(ctx context.Context, opts *RuntimeInstallOptions) error {
306306
307307 for _ , component := range rt .Spec .Components {
308308 log .G (ctx ).Infof ("Creating component '%s'" , component .Name )
309- if err = component .CreateApp (ctx , opts .KubeFactory , opts .InsCloneOpts , opts .RuntimeName , store .Get ().CFComponentType ); err != nil {
309+ if err = component .CreateApp (ctx , opts .KubeFactory , opts .InsCloneOpts , opts .RuntimeName , store .Get ().CFComponentType , "" , "" ); err != nil {
310310 return fmt .Errorf ("failed to create '%s' application: %w" , component .Name , err )
311311 }
312312 }
313313
314- if opts .IngressHost != "" {
315- if err = createWorkflowsIngress (ctx , opts .InsCloneOpts , rt ); err != nil {
316- return fmt .Errorf ("failed to patch Argo-Workflows ingress: %w" , err )
317- }
318- }
319-
320- if err = createCodefreshArgoAgentReporter (ctx , opts .InsCloneOpts , opts , rt ); err != nil {
321- return fmt .Errorf ("failed to create argocd-agent-reporter: %w" , err )
322- }
323-
324- if err = createEventsReporter (ctx , opts .InsCloneOpts , opts , rt ); err != nil {
325- return fmt .Errorf ("failed to create events-reporter: %w" , err )
326- }
327-
328- if err = createWorkflowReporter (ctx , opts .InsCloneOpts , opts ); err != nil {
329- return fmt .Errorf ("failed to create workflows-reporter: %w" , err )
314+ err = installComponents (ctx , opts , rt )
315+ if err != nil {
316+ return err
330317 }
331318
332319 gsPath := opts .GsCloneOpts .FS .Join (apstore .Default .AppsDir , store .Get ().GitSourceName , opts .RuntimeName )
@@ -338,6 +325,23 @@ func RunRuntimeInstall(ctx context.Context, opts *RuntimeInstallOptions) error {
338325 GsName : store .Get ().GitSourceName ,
339326 RuntimeName : opts .RuntimeName ,
340327 FullGsPath : fullGsPath ,
328+ CreateDemoWorkflowTemplate : true ,
329+ }); err != nil {
330+ return fmt .Errorf ("failed to create `%s`: %w" , store .Get ().GitSourceName , err )
331+ }
332+
333+ mpCloneOpts := & git.CloneOptions {
334+ Repo : store .Get ().MarketplaceRepo ,
335+ }
336+ mpCloneOpts .Parse ()
337+ if err = RunGitSourceCreate (ctx , & GitSourceCreateOptions {
338+ InsCloneOpts : opts .InsCloneOpts ,
339+ GsCloneOpts : mpCloneOpts ,
340+ GsName : store .Get ().MarketplaceGitSourceName ,
341+ RuntimeName : opts .RuntimeName ,
342+ FullGsPath : store .Get ().MarketplaceRepo ,
343+ CreateDemoWorkflowTemplate : false ,
344+ Include : "**/workflowTemplate.yaml" ,
341345 }); err != nil {
342346 return fmt .Errorf ("failed to create `%s`: %w" , store .Get ().GitSourceName , err )
343347 }
@@ -355,6 +359,28 @@ func RunRuntimeInstall(ctx context.Context, opts *RuntimeInstallOptions) error {
355359 return nil
356360}
357361
362+ func installComponents (ctx context.Context , opts * RuntimeInstallOptions , rt * runtime.Runtime ) error {
363+ var err error
364+ if opts .IngressHost != "" {
365+ if err = createWorkflowsIngress (ctx , opts .InsCloneOpts , rt ); err != nil {
366+ return fmt .Errorf ("failed to patch Argo-Workflows ingress: %w" , err )
367+ }
368+ }
369+
370+ if err = createCodefreshArgoAgentReporter (ctx , opts .InsCloneOpts , opts , rt ); err != nil {
371+ return fmt .Errorf ("failed to create argocd-agent-reporter: %w" , err )
372+ }
373+
374+ if err = createEventsReporter (ctx , opts .InsCloneOpts , opts , rt ); err != nil {
375+ return fmt .Errorf ("failed to create events-reporter: %w" , err )
376+ }
377+
378+ if err = createWorkflowReporter (ctx , opts .InsCloneOpts , opts ); err != nil {
379+ return fmt .Errorf ("failed to create workflows-reporter: %w" , err )
380+ }
381+ return nil
382+ }
383+
358384func preInstallationChecks (ctx context.Context , opts * RuntimeInstallOptions ) error {
359385 log .G (ctx ).Debug ("running pre-installation checks..." )
360386
@@ -707,7 +733,7 @@ func RunRuntimeUpgrade(ctx context.Context, opts *RuntimeUpgradeOptions) error {
707733
708734 for _ , component := range newComponents {
709735 log .G (ctx ).Infof ("Creating app '%s'" , component .Name )
710- if err = component .CreateApp (ctx , nil , opts .CloneOpts , opts .RuntimeName , store .Get ().CFComponentType ); err != nil {
736+ if err = component .CreateApp (ctx , nil , opts .CloneOpts , opts .RuntimeName , store .Get ().CFComponentType , "" , "" ); err != nil {
711737 return fmt .Errorf ("failed to create '%s' application: %w" , component .Name , err )
712738 }
713739 }
@@ -820,7 +846,7 @@ func createEventsReporter(ctx context.Context, cloneOpts *git.CloneOptions, opts
820846 Type : application .AppTypeDirectory ,
821847 URL : cloneOpts .URL () + "/" + resPath ,
822848 }
823- if err := appDef .CreateApp (ctx , opts .KubeFactory , cloneOpts , opts .RuntimeName , store .Get ().CFComponentType ); err != nil {
849+ if err := appDef .CreateApp (ctx , opts .KubeFactory , cloneOpts , opts .RuntimeName , store .Get ().CFComponentType , "" , "" ); err != nil {
824850 return err
825851 }
826852
@@ -875,7 +901,7 @@ func createWorkflowReporter(ctx context.Context, cloneOpts *git.CloneOptions, op
875901 Type : application .AppTypeDirectory ,
876902 URL : cloneOpts .URL () + "/" + resPath ,
877903 }
878- if err := appDef .CreateApp (ctx , opts .KubeFactory , cloneOpts , opts .RuntimeName , store .Get ().CFComponentType ); err != nil {
904+ if err := appDef .CreateApp (ctx , opts .KubeFactory , cloneOpts , opts .RuntimeName , store .Get ().CFComponentType , "" , "" ); err != nil {
879905 return err
880906 }
881907
0 commit comments