Skip to content

feat: implement GetCommitStatuses on forgejo#2659

Merged
chmouel merged 1 commit intotektoncd:mainfrom
chmouel:srvkp-11529-feat-commit-statuses-concurrency
Apr 10, 2026
Merged

feat: implement GetCommitStatuses on forgejo#2659
chmouel merged 1 commit intotektoncd:mainfrom
chmouel:srvkp-11529-feat-commit-statuses-concurrency

Conversation

@chmouel
Copy link
Copy Markdown
Member

@chmouel chmouel commented Apr 8, 2026

📝 Description of the Change

Previously the Gitea/Forgejo provider returned nil for GetCommitStatuses, which meant the annotation matcher couldn't detect pruned-but-successful pipeline runs, causing /retest to re-run every pipeline instead of just the failed ones.

This commit replaces the stub with a real implementation that calls ListStatuses from the Forgejo SDK, maps Context→Name and State→Status, and deduplicates using a seen map. Unit tests cover happy path, deduplication, empty response, nil client, and API errors. An e2e test (TestGiteaRetestAfterPipelineRunPruning) verifies the full flow: run two pipelines, prune the PipelineRun objects, issue /retest, and assert only the failed pipeline is re-run.

🔗 Linked GitHub Issue

Jira: https://redhat.atlassian.net/browse/SRVKP-11529

🧪 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

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 8, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.86%. Comparing base (69c1197) to head (a9df871).
⚠️ Report is 2 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2659      +/-   ##
==========================================
+ Coverage   58.80%   58.86%   +0.05%     
==========================================
  Files         206      206              
  Lines       20304    20327      +23     
==========================================
+ Hits        11940    11965      +25     
+ Misses       7591     7589       -2     
  Partials      773      773              

☔ View full report in Codecov by Sentry.
📢 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.

Previously the Gitea/Forgejo provider returned nil for GetCommitStatuses,
which meant the annotation matcher couldn't detect pruned-but-successful
pipeline runs, causing /retest to re-run every pipeline instead of just
the failed ones.

This commit replaces the stub with a real implementation that calls
ListStatuses from the Forgejo SDK, maps Context→Name and State→Status,
and deduplicates using a seen map. Unit tests cover happy path,
deduplication, empty response, nil client, and API errors. An e2e test
(TestGiteaRetestAfterPipelineRunPruning) verifies the full flow: run two
pipelines, prune the PipelineRun objects, issue /retest, and assert only
the failed pipeline is re-run.

Jira: https://redhat.atlassian.net/browse/SRVKP-11529
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
@chmouel chmouel force-pushed the srvkp-11529-feat-commit-statuses-concurrency branch from 9c32589 to a9df871 Compare April 8, 2026 15:35
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request implements the GetCommitStatuses method for the Gitea provider, enabling the retrieval and deduplication of commit statuses. It includes unit tests for various scenarios and a new E2E test to ensure that the /retest command correctly triggers only failed pipelines after PipelineRun pruning. The review feedback highlights a missing pagination logic in the ListStatuses calls within both the provider implementation and the E2E test, which is necessary to handle commits with a large number of statuses correctly.

@chmouel chmouel merged commit 6a4a5b0 into tektoncd:main Apr 10, 2026
13 checks passed
@chmouel chmouel deleted the srvkp-11529-feat-commit-statuses-concurrency branch April 10, 2026 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants