Skip to content
← Back to activity

Immutable solution version

Resolver-based PipelineRef still causes unbounded pipeline label cardinality (gap left by #9826)

Version 1

Complete solution

## Proposed Solution Extend the same `generateName`-sanitization logic from #9826 (currently only applied in the `PipelineSpec` branch) into the `PipelineRef.Resolver` branch, keeping the existing cluster-resolver `kind=pipeline` override as a higher-priority path since it already yields a correct, stable name when present.

[mathur07]: ## Proposed Solution Extend the same generateName-sanitization logic from #9826 (currently only applied in the PipelineSpec branch) into the PipelineRef.Resolver branch, keeping the existing cluster-resolver kind=pipeline override as a higher-priority path since it already yields a correct, stable name when present. Concretely, in pkg/reconciler/pipelinerun/pipelinerun.go: ``` func propagatePipelineNameLabelToPipelineRun(pr *v1.PipelineRun) error { if pr.ObjectMeta.Labels == nil { pr.ObjectMeta.Labels = make(map[string]string) } if _, ok := pr.ObjectMeta.Labels[pipeline.PipelineLabelKey]; ok { return nil } switch { case pr.Spec.PipelineRef != nil && pr.Spec.PipelineRef.Name != "": pr.ObjectMeta.Labels[pipeline.PipelineLabelKey] = pr.Spec.PipelineRef.Name case pr.Spec.PipelineSpec != nil: pr.ObjectMeta.Labels[pipeline.PipelineLabelKey] = sanitizedPipelineRunName(pr) case pr.Spec.PipelineRef != nil && pr.Spec.PipelineRef.Resolver != "": // Default: sanitized generateName (or full name if generateName is absent), // mirroring the PipelineSpec branch's cardinality-reduction behavior. pr.ObjectMeta.Labels[pipeline.PipelineLabelKey] = sanitizedPipelineRunName(pr) // https://tekton.dev/docs/pipelines/cluster-res

Context: GitHub issue tektoncd/pipeline#10686 (open, 3 comments, reported 2026-09-01): ## Expected Behavior For a PipelineRun that references its Pipeline via a resolver (git, bundle, hub, etc.), the pipeline label on tekton_pipelines_controller_pipelinerun_* / tekton_pipelines_controller_taskrun_* metrics should reflect a stable identifier for the pipeline (e.g. derived from generateName, matching the fix applied in #9826 for inline PipelineSpec), so that all runs of the same pipeline aggregate under the same metric series. ## Actual Behavior For any pipelineRef.resolver other than cluster (i.e. git, bundle, hub), propagatePipelineNameLabelToPipelineRun

Evidence

Source: GitHub issue tektoncd/pipeline#10686 (open, 3 comments, reported 2026-09-01): ## Expected Behavior For a PipelineRun that references its Pipeline via a resolver (git, bundle, hub, etc.), the pipeline label on tekton_pipelines_controller_pipelinerun_* / tekton_pipelines_controller_taskrun_* metrics should reflect a stable identifier for the pipeline (e.g. derived from generateName, matching the fix applied in #9826 for inline PipelineSpec), so that all runs of the same pipeline aggregate under the same metric series. ## Actual Behavior For any pipelineRef.resolver other than cluster (i.e. git, bundle, hub), propagatePipelineNameLabelToPipelineRun

Verified resolution: [mathur07]: ## Proposed Solution Extend the same generateName-sanitization logic from #9826 (currently only applied in the PipelineSpec branch) into the PipelineRef.Resolver branch, keeping the existing cluster-resolver kind=pipeline override as a higher-priority path since it already yields a correct, stable name when present. Concretely, in pkg/reconciler/pipelinerun/pipelinerun.go: ``` func propagatePipelineNameLabelToPipelineRun(pr *v1.PipelineRun) error { if pr.ObjectMeta.Labels == nil { pr.ObjectMeta.Labels = make(map[string]string) } if _, ok := pr.ObjectMeta.Labels[pipeline.PipelineLabelKey]; ok { return nil } switch { case pr.Spec.PipelineRef != nil && pr.Spec.PipelineRef.Name != "": pr.ObjectMeta.Labels[pipeline.PipelineLabelKey] = pr.Spec.PipelineRef.Name case pr.Spec.PipelineSpec != nil: pr.ObjectMeta.Labels[pipeline.PipelineLabelKey] = sanitizedPipelineRunName(pr) case pr.Spec.PipelineRef != nil && pr.Spec.PipelineRef.Resolver != "": // Default: sanitized generateName (or full name if generateName is absent), // mirroring the PipelineSpec branch's cardinality-reduction behavior. pr.ObjectMeta.Labels[pipeline.PipelineLabelKey] = sanitizedPipelineRunName(pr) // https://tekton.dev/docs/pipelines/cluster-res

Source URL: https://github.com/tektoncd/pipeline/issues/10686

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_FOAL5nfSuVU9WgOaC0m-jg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Resolver-based PipelineRef still causes unbounded pipeline label cardinality (gap left by #9826) <span>— Vectle</span></a>

Resolver-based PipelineRef still causes unbounded pipeline label cardinality (gap left by #9826) | Vectle