Update canonical_sha_intersection to accept commit_count parameter
What does this MR do and why?
Updates the canonical_sha_intersection method to accept a commit_count parameter, enabling this is part of the rollback safety enhancement implementation.
Content
Background Context
While working on the MergeRequestsProcessor module for detecting security fixes and incident resolutions in rollbacks, we encountered this error:
Failed to find auto-deploy intersection -- {project: "gitlab-org/gitlab", sha: "fa4bf4af667f87296fb82892e0774ca51d3f4309"}
Whenever the commits were more than 300.
This led to MR !4319 which made the deployment util pagination limit configurable. Now that !4319 (merged) is merged, we need to update the DeploymentsInformation class to utilize the new configurable limit functionality.
What This MR Changes
Core Method Updates:
- Add
commit_countparameter tocanonical_sha_intersectionmethod signature - Update
canonical_deploymentsmethod to accept and pass thecommit_countparameter - Pass
limit: commit_counttoauto_deploy_intersectioncalls for dynamic pagination
Deployment Pagination Improvements:
- Add
per_page: 30parameter todeploymentsmethod (increased from default 20) - Pass
per_pagethroughoptsparameter toGitlabClient.deployments - Resolve pagination issues where deployments beyond the first 20 records were missed
Test Updates:
- Update unit tests to match new method signatures
- Add
commit_countparameter to test method calls
Why This Change is Needed
The canonical_sha_intersection method calls auto_deploy_intersection which now accepts a configurable limit parameter. By passing the actual commit count between deployment SHAs, we can:
-
Prevent intersection failures for large repositories like
gitlab-org/gitlab - Enable accurate rollback analysis by ensuring we search through enough commits
- Resolve deployment lookup failures by searching beyond the default 20 deployment records
- Continue development of the MergeRequestsProcessor module for security/incident detection
Related Issue gitlab-com/gl-infra/delivery#20923 (closed)
Author Check-list
-
Has documentation been updated?