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::DastService to use project.latest_pipeline
  • Updated ComplianceManagement::Standards::Gitlab::SastService to use project.latest_pipeline

How to set up and validate locally

  1. Follow the same setup instructions from !212197 (merged)
  2. Verify that compliance controls still show the correct status based on the latest pipeline on the default branch
  3. Confirm that the behavior is identical to the previous implementation

Relates to #579849

Merge request reports

Loading