Skip to content

Commit 04bdb6b

Browse files
savitaashtureShivam Mukhade
authored andcommitted
Added some prints to check pac watcher issue
1 parent 2d29ab5 commit 04bdb6b

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

cmd/pipelines-as-code-controller/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ func main() {
3030

3131
c := make(chan struct{})
3232
go func() {
33+
log.Println("started goroutine to watch configmap changes for controller")
3334
c <- struct{}{}
3435
if err := run.WatchConfigMapChanges(ctx, run); err != nil {
35-
log.Fatal(err)
36+
log.Fatal("error from WatchConfigMapChanges for controller : ", err)
3637
}
3738
}()
3839
// Force WatchConfigMapChanges go routines to actually start

cmd/pipelines-as-code-watcher/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ func main() {
2828

2929
c := make(chan struct{})
3030
go func() {
31+
log.Println("started goroutine for watcher")
3132
c <- struct{}{}
3233
// start the web server on port and accept requests
3334
log.Printf("Readiness and health check server listening on port %s", probesPort)

pkg/params/run.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ func StringToBool(s string) bool {
3939

4040
// WatchConfigMapChanges watches for provide configmap
4141
func (r *Run) WatchConfigMapChanges(ctx context.Context, run *Run) error {
42+
r.Clients.Log.Info("Inside WatchConfigMapChanges function")
4243
ns := os.Getenv("SYSTEM_NAMESPACE")
4344
if ns == "" {
4445
return fmt.Errorf("failed to find pipelines-as-code installation namespace")
@@ -64,7 +65,9 @@ func (r *Run) getConfigFromConfigMapWatcher(ctx context.Context, eventChannel <-
6465
if open {
6566
switch event.Type {
6667
case watch.Added, watch.Modified:
68+
r.Clients.Log.Info("added or modifies events are coming")
6769
if err := r.UpdatePACInfo(ctx); err != nil {
70+
r.Clients.Log.Info("failed to update PAC info", err)
6871
return err
6972
}
7073
case watch.Deleted, watch.Bookmark, watch.Error:

pkg/reconciler/controller.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ func NewController() func(context.Context, configmap.Watcher) *controller.Impl {
3636

3737
c := make(chan struct{})
3838
go func() {
39+
log.Println("started goroutine to watch configmap changes inside controller reconciler")
3940
c <- struct{}{}
4041
if err := run.WatchConfigMapChanges(ctx, run); err != nil {
41-
log.Fatal(err)
42+
log.Fatal("error from WatchConfigMapChanges from controller reconciler : ", err)
4243
}
4344
}()
4445
<-c

0 commit comments

Comments
 (0)