Skip to content

fix(github): query check runs for /retest - #2876

Open
theakshaypant wants to merge 1 commit into
tektoncd:mainfrom
theakshaypant:github/retest-skip-successful-pruned
Open

fix(github): query check runs for /retest#2876
theakshaypant wants to merge 1 commit into
tektoncd:mainfrom
theakshaypant:github/retest-skip-successful-pruned

Conversation

@theakshaypant

Copy link
Copy Markdown
Member

📝 Description of the Change

Implement GetCommitStatuses for the GitHub provider so /retest only re-runs failed pipelines when PipelineRuns have been pruned.

The stub returned nil, causing filterSuccessfulTemplates to skip all pipelines through. Now queries the Check Runs API in GitHub App mode and the Commit Statuses API in PAT/webhook mode, with deduplication and retry-with-backoff matching the write path.

🔗 Linked GitHub Issue

Partially fixes #2580

🧪 Testing Strategy

  • Unit tests
  • Integration tests
  • End-to-end tests
  • Manual testing
  • Not Applicable

🤖 AI Assistance

AI assistance can be used for various tasks, such as code generation,
documentation, or testing.

Please indicate whether you have used AI assistance
for this PR and provide details if applicable.

  • I have not used any AI assistance for this PR.
  • I have used AI assistance for this PR.

Important

Slop will be simply rejected, if you are using AI assistance you need to make sure you
understand the code generated and that it meets the project's standards. you
need at least know how to run the code and deploy it (if needed). See
startpaac to make it easy
to deploy and test your code changes.

If the majority of the code in this PR was generated by an AI, please add a Co-authored-by trailer to your commit message.
For example:

Co-authored-by: Claude noreply@anthropic.com

✅ Submitter Checklist

  • 📝 My commit messages are clear, informative, and follow the project's How to write a git commit message guide. The Gitlint linter ensures in CI it's properly validated
  • ✨ I have ensured my commit message prefix (e.g., fix:, feat:) matches the "Type of Change" I selected above.
  • ♽ I have run make test and make lint locally to check for and fix any
    issues. For an efficient workflow, I have considered installing
    pre-commit and running pre-commit install to
    automate these checks.
  • 📖 I have added or updated documentation for any user-facing changes.
  • 🧪 I have added sufficient unit tests for my code changes.
  • 🎁 I have added end-to-end tests where feasible. See README for more details.
  • 🔎 I have addressed any CI test flakiness or provided a clear reason to bypass it.
  • If adding a provider feature, I have filled in the following and updated the provider documentation:
    • GitHub App
    • GitHub Webhook
    • Gitea/Forgejo
    • GitLab
    • Bitbucket Cloud
    • Bitbucket Data Center

@theakshaypant
theakshaypant force-pushed the github/retest-skip-successful-pruned branch from a09e1a4 to d17dddf Compare July 22, 2026 12:04
@pipelines-as-code

Copy link
Copy Markdown

Paco Review 🔍

This PR implements the previously stubbed GetCommitStatuses method for the GitHub provider, fetching either GitHub Check Runs (App mode) or classic commit statuses (PAT/webhook mode), deduplicating entries by name+status, and paginating through results. It also adds a comprehensive table-driven unit test suite for the new method and a large new e2e test verifying that /retest only reruns previously-failed pipelines after PipelineRuns have been pruned from the cluster.

Review difficulty: 3/5 (Moderate) — The core change is a single, moderately complex method with two distinct API code paths plus a sizeable new e2e test, giving it real but bounded blast radius.

1 new inline comment(s) found.

Reviewed commit: a09e1a4

@pipelines-as-code pipelines-as-code Bot added the paco/review-moderate Paco review difficulty label Jul 22, 2026

@pipelines-as-code pipelines-as-code Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Paco inline comments -- see the Paco Review summary comment for the overview.

Comment thread pkg/provider/github/github.go
@theakshaypant
theakshaypant force-pushed the github/retest-skip-successful-pruned branch from d17dddf to 000b4b3 Compare July 22, 2026 13:56
@theakshaypant
theakshaypant marked this pull request as ready for review July 22, 2026 14:01
@theakshaypant
theakshaypant force-pushed the github/retest-skip-successful-pruned branch 2 times, most recently from 6388699 to 626bfd1 Compare July 29, 2026 11:49
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.34%. Comparing base (5106a0e) to head (bfb7ea4).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2876      +/-   ##
==========================================
+ Coverage   68.23%   68.34%   +0.10%     
==========================================
  Files         197      197              
  Lines       16680    16722      +42     
==========================================
+ Hits        11382    11429      +47     
+ Misses       4432     4429       -3     
+ Partials      866      864       -2     
Flag Coverage Δ
unit-tests 68.34% <100.00%> (+0.10%) ⬆️

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.

Comment thread test/github_pullrequest_retest_pruned_test.go Outdated
Comment thread test/github_pullrequest_retest_pruned_test.go
Comment thread test/github_pullrequest_retest_pruned_test.go
status = cr.GetConclusion()
}
key := cr.GetName() + "\x00" + status
if _, ok := seen[key]; ok {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what's the purpose of seen here? every check-run is unique

Comment thread pkg/provider/github/github_test.go Outdated
},
},
{
name: "check runs deduplication",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this will never be the case, right? because we have unique check runs always

Comment thread pkg/provider/github/github_test.go Outdated
@theakshaypant
theakshaypant force-pushed the github/retest-skip-successful-pruned branch from 626bfd1 to d7bac94 Compare July 30, 2026 04:47
Comment thread test/github_pullrequest_retest_pruned_test.go
@theakshaypant
theakshaypant force-pushed the github/retest-skip-successful-pruned branch from d7bac94 to ada6252 Compare July 30, 2026 07:57
@chmouel

chmouel commented Jul 30, 2026

Copy link
Copy Markdown
Member

I don't know what's going on with go-testing job timing out super long these days

Implement GetCommitStatuses for the GitHub provider so /retest
only re-runs failed pipelines when PipelineRuns have been pruned.

The stub returned nil, causing filterSuccessfulTemplates to skip
all pipelines through. Now queries the Check Runs API in GitHub
App mode and the Commit Statuses API in webhook mode, with
deduplication and retry-with-backoff matching the write path.

Signed-off-by: Akshay Pant <akpant@redhat.com>
Assisted-by: Claude Opus 4.6 <noreply@anthropic.com>
@zakisk
zakisk force-pushed the github/retest-skip-successful-pruned branch from ada6252 to bfb7ea4 Compare July 31, 2026 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

paco/review-moderate Paco review difficulty

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/retest falls back to re-running all pipelines when pipelineruns have been pruned

3 participants