diff --git a/cmd/pipelines-as-code-controller/main.go b/cmd/pipelines-as-code-controller/main.go index e33dbb26d..6e7f05027 100644 --- a/cmd/pipelines-as-code-controller/main.go +++ b/cmd/pipelines-as-code-controller/main.go @@ -28,11 +28,15 @@ func main() { log.Fatal("failed to init kinit client : ", err) } + c := make(chan struct{}) go func() { + c <- struct{}{} if err := run.WatchConfigMapChanges(ctx, run); err != nil { log.Fatal(err) } }() + // Force WatchConfigMapChanges go routines to actually start + <-c evadapter.MainWithContext(ctx, PACControllerLogKey, adapter.NewEnvConfig, adapter.New(run, kinteract)) } diff --git a/cmd/pipelines-as-code-watcher/main.go b/cmd/pipelines-as-code-watcher/main.go index 57bea6584..5cb3ff6e5 100644 --- a/cmd/pipelines-as-code-watcher/main.go +++ b/cmd/pipelines-as-code-watcher/main.go @@ -25,7 +25,10 @@ func main() { w.WriteHeader(200) _, _ = fmt.Fprint(w, "ok") }) + + c := make(chan struct{}) go func() { + c <- struct{}{} // start the web server on port and accept requests log.Printf("Readiness and health check server listening on port %s", probesPort) // timeout values same as default one from triggers eventlistener @@ -38,6 +41,7 @@ func main() { } log.Fatal(srv.ListenAndServe()) }() + <-c sharedmain.Main("pac-watcher", reconciler.NewController()) }