@@ -743,6 +743,7 @@ func createGitSources(ctx context.Context, opts *RuntimeInstallOptions) error {
743
743
mpCloneOpts .Parse ()
744
744
745
745
createGitSrcMessgae := fmt .Sprintf ("Creating %s" , store .Get ().MarketplaceGitSourceName )
746
+
746
747
err = RunGitSourceCreate (ctx , & GitSourceCreateOptions {
747
748
InsCloneOpts : opts .InsCloneOpts ,
748
749
GsCloneOpts : mpCloneOpts ,
@@ -781,6 +782,28 @@ func createGitIntegration(ctx context.Context, opts *RuntimeInstallOptions) erro
781
782
return nil
782
783
}
783
784
785
+ func removeGitIntegrations (ctx context.Context , opts * RuntimeUninstallOptions ) error {
786
+ appProxyClient , err := cfConfig .NewClient ().AppProxy (ctx , opts .RuntimeName , store .Get ().InsecureIngressHost )
787
+ if err != nil {
788
+ return fmt .Errorf ("failed to build app-proxy client: %w" , err )
789
+ }
790
+
791
+ integrations , err := appProxyClient .GitIntegrations ().List (ctx )
792
+ if err != nil {
793
+ return fmt .Errorf ("failed to get list of git integrations: %w" , err )
794
+ }
795
+
796
+ for _ , intg := range integrations {
797
+ if err = RunGitIntegrationRemoveCommand (ctx , appProxyClient , intg .Name ); err != nil {
798
+ command := util .Doc (fmt .Sprintf ("\t <BIN> integration git remove %s" , intg .Name ))
799
+
800
+ return fmt .Errorf (`%w. You can try to remove it manually by running: %s` , err , command )
801
+ }
802
+ }
803
+
804
+ return nil
805
+ }
806
+
784
807
func addDefaultGitIntegration (ctx context.Context , appProxyClient codefresh.AppProxyAPI , runtime string , opts * apmodel.AddGitIntegrationArgs ) error {
785
808
if err := RunGitIntegrationAddCommand (ctx , appProxyClient , opts ); err != nil {
786
809
command := util .Doc (fmt .Sprintf (
@@ -1306,6 +1329,16 @@ func RunRuntimeUninstall(ctx context.Context, opts *RuntimeUninstallOptions) err
1306
1329
1307
1330
log .G (ctx ).Infof ("Uninstalling runtime \" %s\" - this process may take a few minutes..." , opts .RuntimeName )
1308
1331
1332
+ err = removeGitIntegrations (ctx , opts )
1333
+ if opts .Force {
1334
+ err = nil
1335
+ }
1336
+ handleCliStep (reporter .UninstallStepRemoveGitIntegrations , "Removing git integrations" , err , true )
1337
+ if err != nil {
1338
+ summaryArr = append (summaryArr , summaryLog {"you can attempt to uninstall again with the \" --force\" flag" , Info })
1339
+ return err
1340
+ }
1341
+
1309
1342
err = apcmd .RunRepoUninstall (ctx , & apcmd.RepoUninstallOptions {
1310
1343
Namespace : opts .RuntimeName ,
1311
1344
Timeout : opts .Timeout ,
@@ -1314,12 +1347,13 @@ func RunRuntimeUninstall(ctx context.Context, opts *RuntimeUninstallOptions) err
1314
1347
Force : opts .Force ,
1315
1348
FastExit : opts .FastExit ,
1316
1349
})
1350
+ if opts .Force {
1351
+ err = nil
1352
+ }
1317
1353
handleCliStep (reporter .UninstallStepUninstallRepo , "Uninstalling repo" , err , true )
1318
1354
if err != nil {
1319
- if ! opts .Force {
1320
- summaryArr = append (summaryArr , summaryLog {"you can attempt to uninstall again with the \" --force\" flag" , Info })
1321
- return err
1322
- }
1355
+ summaryArr = append (summaryArr , summaryLog {"you can attempt to uninstall again with the \" --force\" flag" , Info })
1356
+ return err
1323
1357
}
1324
1358
1325
1359
err = deleteRuntimeFromPlatform (ctx , opts )
0 commit comments