Skip to content

Conversation

@tekton-robot
Copy link

This is a cherry-pick of #142


Changes

This PR fixes a bug in selector-based pruning where PipelineRuns were not being grouped correctly when using matchLabels or matchAnnotations in namespace-level ConfigMaps.

Problem

Label selectors: When a ConfigMap specified matchLabels: {env: test}, the pruner was using ALL labels from the PipelineRun to list resources, including Tekton-generated labels like tekton.dev/pipeline. This meant each PipelineRun was treated as its own unique group.

Annotation selectors: When a ConfigMap specified only matchAnnotations, the list selector became empty, causing all the resources in the namespace to be listed and the configuration to be applied incorrectly to unrelated PipelineRuns.

Solution

  1. Added GetMatchingSelector() method to retrieve the exact selector from the ConfigMap that matched the resource
  2. Modified doResourceCleanup() to use only the ConfigMap's matchLabels

/kind bug

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • pre-commit Passed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

Selector-based pruning now correctly group PipelineRuns by ConfigMap-defined labels/annotations instead of all resource labels

Signed-off-by: Shubham Bhardwaj <shubbhar@redhat.com>
@tekton-robot tekton-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jan 5, 2026
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 5, 2026
@infernus01
Copy link
Member

/kind misc

@tekton-robot tekton-robot added the kind/misc Categorizes issue or PR as a miscellaneuous one. label Jan 5, 2026
@infernus01
Copy link
Member

/approve
/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 5, 2026
@tekton-robot
Copy link
Author

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: infernus01

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 5, 2026
@infernus01
Copy link
Member

/remove-kind misc

@tekton-robot tekton-robot removed the kind/misc Categorizes issue or PR as a miscellaneuous one. label Jan 5, 2026
@tekton-robot tekton-robot merged commit 7b7814f into release-v0.3.x Jan 5, 2026
16 of 22 checks passed
@tekton-robot tekton-robot deleted the cherry-pick-142-to-release-v0.3.x branch January 5, 2026 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants