diff --git a/pkg/reconciler/pipelinerun/pipelinerun.go b/pkg/reconciler/pipelinerun/pipelinerun.go index 7d09f543a17..3ad15d183c2 100644 --- a/pkg/reconciler/pipelinerun/pipelinerun.go +++ b/pkg/reconciler/pipelinerun/pipelinerun.go @@ -297,7 +297,7 @@ func (c *Reconciler) resolvePipelineState( return nil, controller.NewPermanentError(err) } - resolvedTask, err := resources.ResolvePipelineRunTask(ctx, + resolvedTask, err := resources.ResolvePipelineTask(ctx, *pr, fn, func(name string) (*v1beta1.TaskRun, error) { diff --git a/pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go b/pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go index 1a4bc161f5c..1a6c852707d 100644 --- a/pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go +++ b/pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go @@ -496,11 +496,11 @@ func isCustomTask(ctx context.Context, rpt ResolvedPipelineTask) bool { return cfg.FeatureFlags.EnableCustomTasks && !invalidSpec && (isTaskRefCustomTask || isTaskSpecCustomTask) } -// ResolvePipelineRunTask retrieves a single Task's instance using the getTask to fetch +// ResolvePipelineTask retrieves a single Task's instance using the getTask to fetch // the spec. If it is unable to retrieve an instance of a referenced Task, it will return // an error, otherwise it returns a list of all the Tasks retrieved. It will retrieve -// the Resources needed for the TaskRun using the mapping of providedResources. -func ResolvePipelineRunTask( +// the Resources needed for the TaskRuns or Runs using the mapping of providedResources. +func ResolvePipelineTask( ctx context.Context, pipelineRun v1beta1.PipelineRun, getTask resources.GetTask, diff --git a/pkg/reconciler/pipelinerun/resources/pipelinerunresolution_test.go b/pkg/reconciler/pipelinerun/resources/pipelinerunresolution_test.go index bf1ee488261..7b565a3ee5a 100644 --- a/pkg/reconciler/pipelinerun/resources/pipelinerunresolution_test.go +++ b/pkg/reconciler/pipelinerun/resources/pipelinerunresolution_test.go @@ -1562,7 +1562,7 @@ func TestResolvePipelineRun(t *testing.T) { pipelineState := PipelineRunState{} for _, task := range p.Spec.Tasks { - ps, err := ResolvePipelineRunTask(context.Background(), pr, getTask, getTaskRun, nopGetRun, task, providedResources) + ps, err := ResolvePipelineTask(context.Background(), pr, getTask, getTaskRun, nopGetRun, task, providedResources) if err != nil { t.Fatalf("Error getting tasks for fake pipeline %s: %s", p.ObjectMeta.Name, err) } @@ -1659,9 +1659,9 @@ func TestResolvePipelineRun_CustomTask(t *testing.T) { }) ctx = cfg.ToContext(ctx) for _, task := range pts { - ps, err := ResolvePipelineRunTask(ctx, pr, nopGetTask, nopGetTaskRun, getRun, task, nil) + ps, err := ResolvePipelineTask(ctx, pr, nopGetTask, nopGetTaskRun, getRun, task, nil) if err != nil { - t.Fatalf("ResolvePipelineRunTask: %v", err) + t.Fatalf("ResolvePipelineTask: %v", err) } pipelineState = append(pipelineState, ps) } @@ -1709,7 +1709,7 @@ func TestResolvePipelineRun_PipelineTaskHasNoResources(t *testing.T) { } pipelineState := PipelineRunState{} for _, task := range pts { - ps, err := ResolvePipelineRunTask(context.Background(), pr, getTask, getTaskRun, nopGetRun, task, providedResources) + ps, err := ResolvePipelineTask(context.Background(), pr, getTask, getTaskRun, nopGetRun, task, providedResources) if err != nil { t.Errorf("Error getting tasks for fake pipeline %s: %s", p.ObjectMeta.Name, err) } @@ -1762,7 +1762,7 @@ func TestResolvePipelineRun_TaskDoesntExist(t *testing.T) { }, } for _, pt := range pts { - _, err := ResolvePipelineRunTask(context.Background(), pr, getTask, getTaskRun, nopGetRun, pt, providedResources) + _, err := ResolvePipelineTask(context.Background(), pr, getTask, getTaskRun, nopGetRun, pt, providedResources) switch err := err.(type) { case nil: t.Fatalf("Expected error getting non-existent Tasks for Pipeline %s but got none", p.Name) @@ -1830,7 +1830,7 @@ func TestResolvePipelineRun_ResourceBindingsDontExist(t *testing.T) { }, } pipelineState := PipelineRunState{} - ps, err := ResolvePipelineRunTask(context.Background(), pr, getTask, getTaskRun, nopGetRun, tt.p.Spec.Tasks[0], providedResources) + ps, err := ResolvePipelineTask(context.Background(), pr, getTask, getTaskRun, nopGetRun, tt.p.Spec.Tasks[0], providedResources) if err == nil { t.Fatalf("Expected error when bindings are in incorrect state for Pipeline %s but got none: %s", p.ObjectMeta.Name, err) } @@ -1891,7 +1891,7 @@ func TestResolvePipelineRun_withExistingTaskRuns(t *testing.T) { // that is not done as part of Run resolution getTask := func(_ context.Context, name string) (v1beta1.TaskObject, error) { return task, nil } getTaskRun := func(name string) (*v1beta1.TaskRun, error) { return nil, nil } - resolvedTask, err := ResolvePipelineRunTask(context.Background(), pr, getTask, getTaskRun, nopGetRun, p.Spec.Tasks[0], providedResources) + resolvedTask, err := ResolvePipelineTask(context.Background(), pr, getTask, getTaskRun, nopGetRun, p.Spec.Tasks[0], providedResources) if err != nil { t.Fatalf("Error getting tasks for fake pipeline %s: %s", p.ObjectMeta.Name, err) } @@ -1958,7 +1958,7 @@ func TestResolvedPipelineRun_PipelineTaskHasOptionalResources(t *testing.T) { } getTaskRun := func(name string) (*v1beta1.TaskRun, error) { return nil, nil } - actualTask, err := ResolvePipelineRunTask(context.Background(), pr, getTask, getTaskRun, nopGetRun, p.Spec.Tasks[0], providedResources) + actualTask, err := ResolvePipelineTask(context.Background(), pr, getTask, getTaskRun, nopGetRun, p.Spec.Tasks[0], providedResources) if err != nil { t.Fatalf("Error getting tasks for fake pipeline %s: %s", p.ObjectMeta.Name, err) } @@ -2310,7 +2310,7 @@ func TestResolvePipeline_WhenExpressions(t *testing.T) { } t.Run("When Expressions exist", func(t *testing.T) { - _, err := ResolvePipelineRunTask(context.Background(), pr, getTask, getTaskRun, nopGetRun, pt, providedResources) + _, err := ResolvePipelineTask(context.Background(), pr, getTask, getTaskRun, nopGetRun, pt, providedResources) if err != nil { t.Fatalf("Did not expect error when resolving PipelineRun: %v", err) } @@ -2431,7 +2431,7 @@ func TestIsCustomTask(t *testing.T) { }, }) ctx = cfg.ToContext(ctx) - rpt, err := ResolvePipelineRunTask(ctx, pr, getTask, getTaskRun, getRun, tc.pt, nil) + rpt, err := ResolvePipelineTask(ctx, pr, getTask, getTaskRun, getRun, tc.pt, nil) if err != nil { t.Fatalf("Did not expect error when resolving PipelineRun: %v", err) } @@ -3035,7 +3035,7 @@ func TestIsMatrixed(t *testing.T) { }, }) ctx = cfg.ToContext(ctx) - rpt, err := ResolvePipelineRunTask(ctx, pr, getTask, getTaskRun, getRun, tc.pt, nil) + rpt, err := ResolvePipelineTask(ctx, pr, getTask, getTaskRun, getRun, tc.pt, nil) if err != nil { t.Fatalf("Did not expect error when resolving PipelineRun: %v", err) } @@ -3141,12 +3141,12 @@ func TestResolvePipelineRunTask_WithMatrix(t *testing.T) { }, }) ctx = cfg.ToContext(ctx) - rpt, err := ResolvePipelineRunTask(ctx, pr, getTask, getTaskRun, getRun, tc.pt, nil) + rpt, err := ResolvePipelineTask(ctx, pr, getTask, getTaskRun, getRun, tc.pt, nil) if err != nil { t.Fatalf("Did not expect error when resolving PipelineRun: %v", err) } if d := cmp.Diff(tc.want, rpt); d != "" { - t.Errorf("Did not get expected ResolvePipelineRunTask with Matrix: %s", diff.PrintWantGot(d)) + t.Errorf("Did not get expected ResolvePipelineTask with Matrix: %s", diff.PrintWantGot(d)) } }) }