Skip to content

Commit 84d0c59

Browse files
divyansh42tekton-robot
authored andcommitted
Handle nil steps and add error message
Signed-off-by: divyansh42 <diagrawa@redhat.com>
1 parent 26b9c31 commit 84d0c59

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/log/task_reader.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,13 @@ func (r *Reader) readPodLogs(podC <-chan string, podErrC <-chan error, follow, t
199199
}
200200
if err != nil {
201201
errC <- fmt.Errorf("task %s failed: %s. Run tkn tr desc %s for more details", r.task, strings.TrimSpace(err.Error()), r.run)
202+
continue
202203
}
203204
steps := filterSteps(pod, r.allSteps, r.steps)
205+
if len(steps) == 0 {
206+
errC <- fmt.Errorf("no steps found for task %s", r.task)
207+
continue
208+
}
204209
r.readStepsLogs(logC, errC, steps, p, follow, timestamps)
205210
}
206211
}()
@@ -291,6 +296,7 @@ func (r *Reader) getTaskRunPodNames(run *v1.TaskRun) (<-chan string, <-chan erro
291296
func filterSteps(pod *corev1.Pod, allSteps bool, stepsGiven []string) []*step {
292297
steps := []*step{}
293298
if pod == nil {
299+
fmt.Printf("pod not found")
294300
return steps
295301
}
296302
stepsInPod := getSteps(pod)

0 commit comments

Comments
 (0)