diff --git a/pkg/apis/pipeline/v1/pipeline_validation.go b/pkg/apis/pipeline/v1/pipeline_validation.go index 0c60fae33bd..ecb5e874d92 100644 --- a/pkg/apis/pipeline/v1/pipeline_validation.go +++ b/pkg/apis/pipeline/v1/pipeline_validation.go @@ -103,6 +103,8 @@ func (l PipelineTaskList) Validate(ctx context.Context, taskNames sets.String, p taskNames.Insert(t.Name) // validate custom task, dag, or final task errs = errs.Also(t.Validate(ctx).ViaFieldIndex(path, i)) + // validate taskref to prevent creating invalid data + errs = errs.Also(t.TaskRef.Validate(ctx)) } return errs } diff --git a/pkg/apis/pipeline/v1beta1/pipeline_validation.go b/pkg/apis/pipeline/v1beta1/pipeline_validation.go index c170e85a3b9..0135b42a87a 100644 --- a/pkg/apis/pipeline/v1beta1/pipeline_validation.go +++ b/pkg/apis/pipeline/v1beta1/pipeline_validation.go @@ -107,6 +107,8 @@ func (l PipelineTaskList) Validate(ctx context.Context, taskNames sets.String, p taskNames.Insert(t.Name) // validate custom task, bundle, dag, or final task errs = errs.Also(t.Validate(ctx).ViaFieldIndex(path, i)) + // validate taskref to prevent creating invalid data + errs = errs.Also(t.TaskRef.Validate(ctx)) } return errs }