Refactor compliance controls to use latest_pipeline method
What does this MR do and why?
This MR refactors the DAST and SAST compliance control services to use the existing project.latest_pipeline method instead of manually querying project.ci_pipelines.newest_first(ref: project.default_branch).first.
The latest_pipeline method already defaults to the default_branch when no ref is provided, making the code cleaner and more consistent with the rest of the codebase.
This is a follow-up to !212197 (merged) as discussed in !212197 (comment 2933135873)
Changes
- Updated
ComplianceManagement::Standards::Gitlab::DastServiceto useproject.latest_pipeline - Updated
ComplianceManagement::Standards::Gitlab::SastServiceto useproject.latest_pipeline
How to set up and validate locally
- Follow the same setup instructions from !212197 (merged)
- Verify that compliance controls still show the correct status based on the latest pipeline on the default branch
- Confirm that the behavior is identical to the previous implementation
Relates to #579849