feat: implement GetCommitStatuses on forgejo#2659
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
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>
9c32589 to
a9df871
Compare
There was a problem hiding this comment.
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.
📝 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
🤖 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.
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-bytrailer to your commit message.For example:
Co-authored-by: Claude noreply@anthropic.com
✅ Submitter Checklist
fix:,feat:) matches the "Type of Change" I selected above.make testandmake lintlocally to check for and fix anyissues. For an efficient workflow, I have considered installing
pre-commit and running
pre-commit installtoautomate these checks.