Skip to content

Commit

Permalink
Fix panic on pipeline logs
Browse files Browse the repository at this point in the history
This will fix the issue of pipelinerun logs
panic in case of pod not yet ready or
taskruns not created

Fixes #361
  • Loading branch information
piyush-garg authored and tekton-robot committed Oct 22, 2019
1 parent 2b3a8d6 commit 0182294
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions pkg/cmd/pipelinerun/log_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ func (lr *LogReader) readLiveLogs(pr *v1alpha1.PipelineRun) (<-chan Log, <-chan

wg.Wait()

if pr.Status.Conditions[0].Status == corev1.ConditionFalse {
errC <- fmt.Errorf(pr.Status.Conditions[0].Message)
if pr.Status.Conditions != nil {
if pr.Status.Conditions[0].Status == corev1.ConditionFalse {
errC <- fmt.Errorf(pr.Status.Conditions[0].Message)
}
}
}()

Expand Down
5 changes: 4 additions & 1 deletion pkg/helper/taskrun/taskrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ func IsFiltered(tr Run, allowed []string) bool {
}

func HasScheduled(trs *v1alpha1.PipelineRunTaskRunStatus) bool {
return trs.Status.PodName != ""
if trs.Status != nil {
return trs.Status.PodName != ""
}
return false
}

func Filter(trs []Run, ts []string) []Run {
Expand Down

0 comments on commit 0182294

Please sign in to comment.