Skip to content

Conversation

@infernus01
Copy link
Member

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

@tekton-robot tekton-robot added the kind/bug Categorizes issue or PR as related to a bug. label Dec 31, 2025
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 31, 2025
@anithapriyanatarajan
Copy link
Contributor

/approve

@anithapriyanatarajan
Copy link
Contributor

/lgtm

@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: anithapriyanatarajan

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:
  • OWNERS [anithapriyanatarajan]

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
@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 5, 2026
@tekton-robot tekton-robot merged commit aa31556 into tektoncd:main Jan 5, 2026
21 checks passed
@anithapriyanatarajan
Copy link
Contributor

/cherry-pick release-v0.3.x

@tekton-robot
Copy link

Cherry-pick to release-v0.3.x successful!

A new pull request has been created to cherry-pick this change to release-v0.3.x.

PR: #145

Please review and merge the cherry-pick PR.

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