Skip to content

Commit

Permalink
Show error when there is an invalid filtered task
Browse files Browse the repository at this point in the history
and show the available ones to make it easy to choose

Signed-off-by: Chmouel Boudjnah <[email protected]>
  • Loading branch information
chmouel committed Aug 22, 2023
1 parent 6d41e8e commit 45de500
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/log/pipeline_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ func (r *Reader) readAvailablePipelineLogs(pr *v1.PipelineRun) (<-chan Log, <-ch
}

taskRuns := taskrunpkg.Filter(ordered, r.tasks)
if len(taskRuns) == 0 && len(r.tasks) != 0 {
avail_tasks := []string{}
for _, o := range ordered {
avail_tasks = append(avail_tasks, o.Task)
}
return nil, nil, fmt.Errorf("passed filtered tasks: %v is not available, available tasks are: %v", r.tasks, avail_tasks)
}

logC := make(chan Log)
errC := make(chan error)
Expand Down Expand Up @@ -123,7 +130,7 @@ func (r *Reader) readAvailablePipelineLogs(pr *v1.PipelineRun) (<-chan Log, <-ch
// and keep checking the status until it changes to true|false
// or the reach timeout
func (r *Reader) waitUntilAvailable() error {
var first = true
first := true
opts := metav1.ListOptions{
FieldSelector: fields.OneTermEqualSelector("metadata.name", r.run).String(),
}
Expand Down

0 comments on commit 45de500

Please sign in to comment.