Skip to content

Conversation

@khrm
Copy link
Contributor

@khrm khrm commented Aug 3, 2025

This allows defining multiple retention policies based on selectors like namespace, labels, and status, providing more granular control over result retention.

Changes

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you review them:

  • Has Docs included if any changes are user facing
  • Has Tests included if any functionality added or changed
  • Tested your changes locally (if this is a code change)
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add 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)
  • Release notes contain the string "action required" if the change requires additional action from users switching to the new release

Release Notes

Tekton Results now supports fine-grained retention policies, allowing you to set different retention periods for `PipelineRun` and top-level `TaskRun` results based on their **namespace, labels, annotations, and status**.

This provides granular control to balance storage costs with compliance and debugging needs. The first policy that a result matches is applied. If no policy matches, the result falls back to the default `maxRetention` period.

The feature is configured by adding a `policies` key to the `tekton-results-config-results-retention-policy` `ConfigMap`.

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 3, 2025
@tekton-robot tekton-robot added release-note-none Denotes a PR that doesnt merit a release note. and removed release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Aug 3, 2025
@khrm
Copy link
Contributor Author

khrm commented Aug 3, 2025

/kind feature

@tekton-robot tekton-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 3, 2025
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-results-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/retention.go 10.5% 65.6% 55.1
pkg/retention/job.go 38.9% 58.3% 19.4

@khrm khrm force-pushed the f/ret-pol branch 2 times, most recently from 94685a2 to 5b85f7b Compare August 4, 2025 00:03
@khrm
Copy link
Contributor Author

khrm commented Aug 4, 2025

/test pull-tekton-results-build-tests

@khrm
Copy link
Contributor Author

khrm commented Aug 4, 2025

/assign @enarha

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesnt merit a release note. labels Aug 4, 2025
@tekton-robot
Copy link

@khrm: GitHub didn't allow me to assign the following users: andrewpthorp.

Note that only tektoncd members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

Details

In response to this:

/assign @andrewpthorp

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-results-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/retention.go 10.5% 65.6% 55.1
pkg/retention/job.go 38.9% 56.0% 17.1

@khrm khrm changed the title feat(retention): Add support for fine-grained retention policies Add support for fine-grained retention policies Aug 4, 2025
@khrm
Copy link
Contributor Author

khrm commented Aug 4, 2025

/assign @aThorp96

@tekton-robot
Copy link

@khrm: GitHub didn't allow me to assign the following users: aThorp96.

Note that only tektoncd members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

Details

In response to this:

/assign @aThorp96

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@khrm khrm unassigned enarha Aug 4, 2025
@khrm
Copy link
Contributor Author

khrm commented Aug 4, 2025

/test pull-tekton-results-build-tests

Copy link
Member

@aThorp96 aThorp96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't looked through the code yet, but had some requests regarding the design of the feature's configuration

@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-results-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/retention.go 10.5% 65.6% 55.1
pkg/retention/job.go 38.9% 56.0% 17.1

@khrm
Copy link
Contributor Author

khrm commented Aug 10, 2025

I have updated the documentation to clarify that omitting a selector type means it matches all results for that criterion.

This allows defining multiple retention policies based on selectors
like namespace, labels, and status, providing more granular control
over result retention.

Assisted By: Gemini
@khrm
Copy link
Contributor Author

khrm commented Aug 10, 2025

/test pull-tekton-results-build-tests

@khrm
Copy link
Contributor Author

khrm commented Aug 10, 2025

@enarha Can you re-review this?

@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-results-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/retention.go 10.5% 65.6% 55.1
pkg/retention/job.go 38.9% 56.0% 17.1

@enarha
Copy link
Contributor

enarha commented Aug 10, 2025

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 10, 2025
@khrm
Copy link
Contributor Author

khrm commented Aug 11, 2025

@aThorp96 @enarha Let's merge this. We want to do a release of results today.

@khrm
Copy link
Contributor Author

khrm commented Aug 11, 2025

@aThorp96 Can you please take a look?

@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Aug 11, 2025
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-results-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/retention.go 10.5% 39.7% 29.2
pkg/retention/job.go 38.9% 56.0% 17.1

Copy link
Member

@aThorp96 aThorp96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Thanks @khrm

@tekton-robot
Copy link

@aThorp96: changing LGTM is restricted to collaborators

Details

In response to this:

/lgtm

Thanks @khrm

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

 Deprecates the `maxRetention` field in the retention policy
 configuration and replaces it with `defaultRetention`.

 For backward compatibility, if `defaultRetention` is
 not specified, the value of `maxRetention` will be used.

 Also updated the `DeepCopy` function for `RetentionPolicy` to
 correctly perform a deep copy of the `Policies` slice and its nested fields.
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-results-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/retention.go 10.5% 40.6% 30.1
pkg/retention/job.go 38.9% 56.0% 17.1

Copy link
Member

@aThorp96 aThorp96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@tekton-robot
Copy link

@aThorp96: changing LGTM is restricted to collaborators

Details

In response to this:

/lgtm

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@enarha
Copy link
Contributor

enarha commented Aug 12, 2025

/approve

@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aThorp96, enarha

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 Aug 12, 2025
@khrm
Copy link
Contributor Author

khrm commented Aug 12, 2025

@enarha Can you give lgtm also? It was removed after last changes.

@khrm
Copy link
Contributor Author

khrm commented Aug 12, 2025

@enarha Can you give lgtm here? Andrew is restricted from it.

@enarha
Copy link
Contributor

enarha commented Aug 12, 2025

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 12, 2025
@tekton-robot tekton-robot merged commit b358b2d into tektoncd:main Aug 12, 2025
9 checks passed
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/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants