@@ -306,27 +306,14 @@ func RunRuntimeInstall(ctx context.Context, opts *RuntimeInstallOptions) error {
306
306
307
307
for _ , component := range rt .Spec .Components {
308
308
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 {
310
310
return fmt .Errorf ("failed to create '%s' application: %w" , component .Name , err )
311
311
}
312
312
}
313
313
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
330
317
}
331
318
332
319
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 {
338
325
GsName : store .Get ().GitSourceName ,
339
326
RuntimeName : opts .RuntimeName ,
340
327
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" ,
341
345
}); err != nil {
342
346
return fmt .Errorf ("failed to create `%s`: %w" , store .Get ().GitSourceName , err )
343
347
}
@@ -355,6 +359,28 @@ func RunRuntimeInstall(ctx context.Context, opts *RuntimeInstallOptions) error {
355
359
return nil
356
360
}
357
361
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
+
358
384
func preInstallationChecks (ctx context.Context , opts * RuntimeInstallOptions ) error {
359
385
log .G (ctx ).Debug ("running pre-installation checks..." )
360
386
@@ -707,7 +733,7 @@ func RunRuntimeUpgrade(ctx context.Context, opts *RuntimeUpgradeOptions) error {
707
733
708
734
for _ , component := range newComponents {
709
735
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 {
711
737
return fmt .Errorf ("failed to create '%s' application: %w" , component .Name , err )
712
738
}
713
739
}
@@ -820,7 +846,7 @@ func createEventsReporter(ctx context.Context, cloneOpts *git.CloneOptions, opts
820
846
Type : application .AppTypeDirectory ,
821
847
URL : cloneOpts .URL () + "/" + resPath ,
822
848
}
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 {
824
850
return err
825
851
}
826
852
@@ -875,7 +901,7 @@ func createWorkflowReporter(ctx context.Context, cloneOpts *git.CloneOptions, op
875
901
Type : application .AppTypeDirectory ,
876
902
URL : cloneOpts .URL () + "/" + resPath ,
877
903
}
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 {
879
905
return err
880
906
}
881
907
0 commit comments