Skip to content

Commit 1fbbedb

Browse files
committed
Handle nil steps and add error message
Signed-off-by: divyansh42 <diagrawa@redhat.com>
1 parent a509aa3 commit 1fbbedb

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

pkg/log/task_reader.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ func (r *Reader) readPodLogs(podC <-chan string, podErrC <-chan error, follow, t
201201
errC <- fmt.Errorf("task %s failed: %s. Run tkn tr desc %s for more details", r.task, strings.TrimSpace(err.Error()), r.run)
202202
}
203203
steps := filterSteps(pod, r.allSteps, r.steps)
204+
if len(steps) == 0 {
205+
errC <- fmt.Errorf("no steps found for task %s", r.task)
206+
continue
207+
}
204208
r.readStepsLogs(logC, errC, steps, p, follow, timestamps)
205209
}
206210
}()
@@ -291,6 +295,7 @@ func (r *Reader) getTaskRunPodNames(run *v1.TaskRun) (<-chan string, <-chan erro
291295
func filterSteps(pod *corev1.Pod, allSteps bool, stepsGiven []string) []*step {
292296
steps := []*step{}
293297
if pod == nil {
298+
fmt.Printf("pod not found")
294299
return steps
295300
}
296301
stepsInPod := getSteps(pod)

0 commit comments

Comments
 (0)