Skip to content

fix: preserve PipelineRun-owned TaskRuns during history pruning - #424

Open
yuzichen12123 wants to merge 1 commit into
tektoncd:mainfrom
yuzichen12123:fix/exclude-pipelinerun-owned-taskruns
Open

yuzichen12123 wants to merge 1 commit into
tektoncd:mainfrom
yuzichen12123:fix/exclude-pipelinerun-owned-taskruns

Conversation

@yuzichen12123

Copy link
Copy Markdown

Summary

History-limit cleanup can delete completed TaskRuns that belong to a still-running PipelineRun. The PipelineRun controller then treats those tasks as unscheduled and recreates them, causing completed pipeline work to run again.

This change excludes PipelineRun-owned resources from the history-limiter candidate set. It recognizes both ownership signals used by Tekton:

  • the tekton.dev/pipelineRun label;
  • a PipelineRun ownerReference.

The ownerReference check protects resources that do not carry the label.

Fixes #381

Testing

  • go test ./...

The regression test verifies that history pruning removes eligible standalone resources while preserving PipelineRun children identified by either ownership mechanism.

@tekton-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign anithapriyanatarajan after the PR has been reviewed.
You can assign the PR to them by writing /assign @anithapriyanatarajan in a comment when ready.

The full list of commands accepted by this bot can be found 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 size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 16, 2026
@vdemeester vdemeester self-assigned this Sep 16, 2026
@codecov

codecov Bot commented Sep 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.56%. Comparing base (717a04d) to head (d664de5).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #424      +/-   ##
==========================================
+ Coverage   50.40%   50.56%   +0.16%     
==========================================
  Files          19       19              
  Lines        2113     2120       +7     
==========================================
+ Hits         1065     1072       +7     
  Misses        916      916              
  Partials      132      132              
Flag Coverage Δ
unit-tests 50.56% <ø> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

History-limit pruning deletes TaskRuns owned by a still-running PipelineRun, causing the pipeline task to re-run

3 participants