From c8dd7699a3cf7eef62f0afcfb2863103af56d501 Mon Sep 17 00:00:00 2001 From: Luiz Carvalho Date: Thu, 22 Sep 2022 15:30:26 -0400 Subject: [PATCH] Query PipelineResources only if needed Change the `tkn pipeline start` command to only query for PipelineResources in the cluster if the Pipeline uses Resources. As PipelineResources are marked as deprecated, some cluster maintainers may decide to not install this CRD altogether. Signed-off-by: Luiz Carvalho --- pkg/cmd/pipeline/start.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cmd/pipeline/start.go b/pkg/cmd/pipeline/start.go index 447d6969ac..a7aa02cb83 100644 --- a/pkg/cmd/pipeline/start.go +++ b/pkg/cmd/pipeline/start.go @@ -392,7 +392,7 @@ func (opt *startOptions) getInput(pipeline *v1beta1.Pipeline) error { return err } - if len(opt.Resources) == 0 && !opt.Last && opt.UsePipelineRun == "" { + if len(pipeline.Spec.Resources) > 0 && len(opt.Resources) == 0 && !opt.Last && opt.UsePipelineRun == "" { pres, err := getPipelineResources(cs.Resource, opt.cliparams.Namespace()) if err != nil { return fmt.Errorf("failed to list PipelineResources from namespace %s: %v", opt.cliparams.Namespace(), err)