fix(gitlab): pin commit statuses to the same pipeline via pipeline_id caching#2671
fix(gitlab): pin commit statuses to the same pipeline via pipeline_id caching#2671ab-ghosh wants to merge 2 commits intotektoncd:mainfrom
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2671 +/- ##
==========================================
+ Coverage 58.86% 58.93% +0.06%
==========================================
Files 206 206
Lines 20329 20355 +26
==========================================
+ Hits 11967 11996 +29
+ Misses 7589 7587 -2
+ Partials 773 772 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request introduces a caching mechanism for GitLab pipeline IDs to ensure that multiple commit statuses for the same project and SHA are grouped within the same pipeline. It includes logic to retrieve, store, and apply these IDs during the status creation process, along with comprehensive unit tests. A critical issue was identified in the setOptPipelineID function where a stale pipeline ID from a source project could persist when falling back to a target project, potentially causing API failures.
When PAC posts multiple commit statuses for the same SHA, GitLab's auto-assignment logic can route them to different pipelines, leaving the MR pipeline permanently stuck with stale intermediate statuses. Cache the pipeline_id returned by the first SetCommitStatus response and pass it on subsequent calls for the same (project, SHA) pair so all statuses land in the same GitLab pipeline. Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Abhishek Ghosh <abghosh@redhat.com>
071640b to
f57af59
Compare
🤖 AI Analysis - pr-complexity-ratingBased on the provided information, this PR appears to be a synchronization/maintenance operation rather than a functional feature or bug fix implementation. 📊 PR Review Complexity
Overall difficulty: Easy SummaryThis PR is a merge commit synchronizing Suggested reviewers focus
Generated by Pipelines-as-Code LLM Analysis |
🤖 AI Analysis - pr-complexity-ratingBased on the provided context, this PR appears to be a maintenance merge (synchronizing the feature branch with 📊 PR Review Complexity
Overall difficulty: Easy SummaryThis PR consists of a merge commit synchronizing a feature branch ( Suggested reviewers focus
Generated by Pipelines-as-Code LLM Analysis |
📝 Description of the Change
When PAC posts commit statuses to GitLab for a merge request, the status updates can get split across two different GitLab pipelines. GitLab's auto-assignment logic can abruptly change routing mid-stream, leaving the original MR pipeline permanently stuck with stale intermediate statuses.
This fix caches the
pipeline_idreturned by the firstSetCommitStatusresponse for a given(project, SHA)pair and passes it on all subsequent calls, ensuring all commit statuses land in the same GitLab pipeline.🔗 Linked GitHub Issue
Fixes #
https://redhat.atlassian.net/browse/SRVKP-11437
🧪 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.