Skip to content

Prepare separate PolicyBranchesServices for Scan Execution Policies and MR Approval Policies

Origins

The following discussion from !184135 (merged) should be addressed:

  • @mcavoj started a discussion: (+2 comments)

    thought: this service is used both for scan execution policies and approval policies, but the two new options are only applicable to the SEPs. Should we perhaps add a new class ScanExecutionPolicyBranchesService < PolicyBranchesService to keep the responsibilities separate?

Background

This issue follows up on Prepare separate PolicyBranchesServices for Scan Execution Policies and MR Approval Policies, where we identified the need to separate responsibilities between Scan Execution Policies and MR Approval Policies in the current PolicyBranchesService.

Currently, the PolicyBranchesService is handling both scan execution policies and approval policies, but the new options are only applicable to Scan Execution Policies (SEPs). As discussed in MR !184135 (merged), we need to create a dedicated service for SEPs to maintain proper separation of concerns.

Objectives

  • Create a new ScanExecutionPolicyBranchesService class that inherits from PolicyBranchesService
  • Move SEP-specific functionality from the parent class to the new service
  • Ensure the parent class maintains only shared functionality
  • Update all relevant service calls to use the appropriate service class
  • Add comprehensive tests for the new service

Implementation Details

  1. Create the new service class in the appropriate directory
  2. Identify and migrate SEP-specific methods and options
  3. Update any controllers or other services that currently use PolicyBranchesService for SEPs
  4. Ensure backward compatibility where necessary
  5. Add unit and integration tests for the new service

Acceptance Criteria

  • New ScanExecutionPolicyBranchesService class is created and inherits from PolicyBranchesService
  • SEP-specific functionality is properly moved to the new class
  • All existing functionality continues to work as expected
  • Test coverage for the new service is comprehensive
  • Documentation is updated to reflect the new service structure

Related Links

Edited by Alan (Maciej) Paruszewski