@@ -299,9 +299,13 @@ func (r *LocalbuildReconciler) ReconcileArgoAppsWithGitea(ctx context.Context, r
299
299
}
300
300
}
301
301
302
- // TODO: this needs to be removed for local file syncs.
303
- r .shouldShutdown = true
304
- return ctrl.Result {}, nil
302
+ shutdown , err := r .shouldShutDown (ctx , resource )
303
+ if err != nil {
304
+ return ctrl.Result {Requeue : true }, err
305
+ }
306
+ r .shouldShutdown = shutdown
307
+
308
+ return ctrl.Result {RequeueAfter : time .Second * 30 }, nil
305
309
}
306
310
307
311
func (r * LocalbuildReconciler ) reconcileEmbeddedApp (ctx context.Context , appName string , resource * v1alpha1.Localbuild ) (ctrl.Result , error ) {
@@ -366,6 +370,21 @@ func (r *LocalbuildReconciler) reconcileEmbeddedApp(ctx context.Context, appName
366
370
return ctrl.Result {}, nil
367
371
}
368
372
373
+ func (r * LocalbuildReconciler ) shouldShutDown (ctx context.Context , resource * v1alpha1.Localbuild ) (bool , error ) {
374
+ repos := & v1alpha1.GitRepositoryList {}
375
+ err := r .Client .List (ctx , repos , client .InNamespace (resource .Namespace ))
376
+ if err != nil {
377
+ return false , fmt .Errorf ("getting repo list %w" , err )
378
+ }
379
+ for i := range repos .Items {
380
+ repo := repos .Items [i ]
381
+ if ! repo .Status .Synced {
382
+ return false , nil
383
+ }
384
+ }
385
+ return true , nil
386
+ }
387
+
369
388
func GetEmbeddedRawInstallResources (name string ) ([][]byte , error ) {
370
389
switch name {
371
390
case "argocd" :
0 commit comments