Skip to content

Commit

Permalink
Fetch {Cluster}Tasks using generated client
Browse files Browse the repository at this point in the history
It seems like using the Lister to fetch ClusterTasks and Tasks results
in some flakiness when attempting to run the Task immediately after it's
created (as in clustertask.yaml). Using the Lister is likely faster, due
to caching, but if it means failed runs for just-created Tasks, that
speed isn't worth it.
  • Loading branch information
imjasonh authored and tekton-robot committed Dec 3, 2019
1 parent 478460c commit 610c7a5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/reconciler/taskrun/taskrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func (c *Reconciler) getTaskFunc(tr *v1alpha1.TaskRun) (resources.GetTask, v1alp
kind := v1alpha1.NamespacedTaskKind
if tr.Spec.TaskRef != nil && tr.Spec.TaskRef.Kind == v1alpha1.ClusterTaskKind {
gtFunc = func(name string) (v1alpha1.TaskInterface, error) {
t, err := c.clusterTaskLister.Get(name)
t, err := c.PipelineClientSet.TektonV1alpha1().ClusterTasks().Get(name, metav1.GetOptions{})
if err != nil {
return nil, err
}
Expand All @@ -211,7 +211,7 @@ func (c *Reconciler) getTaskFunc(tr *v1alpha1.TaskRun) (resources.GetTask, v1alp
kind = v1alpha1.ClusterTaskKind
} else {
gtFunc = func(name string) (v1alpha1.TaskInterface, error) {
t, err := c.taskLister.Tasks(tr.Namespace).Get(name)
t, err := c.PipelineClientSet.TektonV1alpha1().Tasks(tr.Namespace).Get(name, metav1.GetOptions{})
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 610c7a5

Please sign in to comment.