Problem Statement
When using Tekton Results to archive PipelineRun and TaskRun resources, there is currently no mechanism to filter which resources the watcher should archive. Every resource observed by the watcher is unconditionally sent to resultsClient.Put(), regardless of any label or annotation on the resource.
In practice, CI/CD setups include utility or housekeeping pipelines that run frequently but carry no archival value — for example, cleanup pipelines, or notification pipelines that only post comments and complete in seconds. Being unable to exclude these resources results in unnecessary storage consumption, increased database load, and polluted result queries.
Current Behavior
The watcher already exposes a -label_selector flag. However, its scope is limited to the deleteUponCompletion() function, which governs deletion of resources after archiving (garbage collection). It has no effect on the archiving step itself.
This means:
- Resources are always archived, regardless of their labels.
- The
-label_selector flag only determines whether a resource is eligible for deletion after it has already been stored.
Proposed Feature
Extend the label selector support to the archiving step of the watcher reconciler, so that only resources matching a configurable label selector are eligible for archiving.
This would be consistent with the existing -label_selector pattern: the selector's content determines whether the behavior is inclusive (archive only matching resources) or exclusive (archive all resources except matching ones), using standard Kubernetes label selector syntax.
For example:
!results-skip — archive all resources that do not carry this label (exclusive)
tier=production — archive only resources carrying this label (inclusive)
The selector could be exposed as a new dedicated flag (e.g. -archive_label_selector).
Expected Behavior
- If no archive label selector is configured, all completed resources are archived (current default behavior, no regression).
- If a label selector is configured, only resources matching it are passed to
resultsClient.Put().
- The feature applies consistently to both
PipelineRun and TaskRun reconcilers.
Problem Statement
When using Tekton Results to archive
PipelineRunandTaskRunresources, there is currently no mechanism to filter which resources the watcher should archive. Every resource observed by the watcher is unconditionally sent toresultsClient.Put(), regardless of any label or annotation on the resource.In practice, CI/CD setups include utility or housekeeping pipelines that run frequently but carry no archival value — for example, cleanup pipelines, or notification pipelines that only post comments and complete in seconds. Being unable to exclude these resources results in unnecessary storage consumption, increased database load, and polluted result queries.
Current Behavior
The watcher already exposes a
-label_selectorflag. However, its scope is limited to thedeleteUponCompletion()function, which governs deletion of resources after archiving (garbage collection). It has no effect on the archiving step itself.This means:
-label_selectorflag only determines whether a resource is eligible for deletion after it has already been stored.Proposed Feature
Extend the label selector support to the archiving step of the watcher reconciler, so that only resources matching a configurable label selector are eligible for archiving.
This would be consistent with the existing
-label_selectorpattern: the selector's content determines whether the behavior is inclusive (archive only matching resources) or exclusive (archive all resources except matching ones), using standard Kubernetes label selector syntax.For example:
!results-skip— archive all resources that do not carry this label (exclusive)tier=production— archive only resources carrying this label (inclusive)The selector could be exposed as a new dedicated flag (e.g.
-archive_label_selector).Expected Behavior
resultsClient.Put().PipelineRunandTaskRunreconcilers.