@@ -39,6 +39,19 @@ func WatchInstrumentedPod(parentCtx context.Context, clientSet kubernetes.Interf
39
39
}
40
40
41
41
notifier .Align (watcher .State ())
42
+
43
+ if ctx .Err () != nil {
44
+ log .DefaultLogger .Warnw ("canceled watching execution" , "executionId" , watcher .State ().ResourceId (), "err" , ctx .Err (), "debug" , watcher .State ().Debug ())
45
+ close (notifier .ch )
46
+ return
47
+ }
48
+
49
+ if ! watcher .State ().Completed () {
50
+ log .DefaultLogger .Warnw ("execution was not detected as complete" , "executionId" , watcher .State ().ResourceId (), "err" , ctx .Err (), "debug" , watcher .State ().Debug ())
51
+ close (notifier .ch )
52
+ return
53
+ }
54
+
42
55
notifier .End ()
43
56
ctxCancel ()
44
57
close (notifier .ch )
@@ -85,12 +98,14 @@ func WatchInstrumentedPod(parentCtx context.Context, clientSet kubernetes.Interf
85
98
// Handle the case when it has been complete without pod start
86
99
if ! watcher .State ().PodStarted () && (watcher .State ().Completed () || opts .DisableFollow ) {
87
100
notifier .Align (watcher .State ())
101
+ log .DefaultLogger .Warnw ("execution complete without pod start" , "executionId" , watcher .State ().ResourceId (), "debug" , watcher .State ().Debug ())
88
102
return
89
103
}
90
104
91
105
// Load the pod information
92
106
if watcher .State ().EstimatedPodStartTimestamp ().IsZero () {
93
107
notifier .Error (fmt .Errorf ("cannot estimate Pod start" ))
108
+ log .DefaultLogger .Warnw ("cannot estimate execution pod start" , "executionId" , watcher .State ().ResourceId (), "debug" , watcher .State ().Debug ())
94
109
return
95
110
}
96
111
@@ -100,6 +115,7 @@ func WatchInstrumentedPod(parentCtx context.Context, clientSet kubernetes.Interf
100
115
actions , err := watcher .State ().ActionGroups ()
101
116
if err != nil {
102
117
notifier .Error (fmt .Errorf ("cannot read execution instructions: %v" , err ))
118
+ log .DefaultLogger .Warnw ("cannot read execution instructions" , "executionId" , watcher .State ().ResourceId (), "debug" , watcher .State ().Debug ())
103
119
return
104
120
}
105
121
refs , endRefs := ExtractRefsFromActionGroup (actions )
0 commit comments