FE: Introduce scan execution strategy for Scan Execution Policies
Overview
This issue implements a new UI component for Scan Execution Policies that simplifies configuration for MR approval policy compatibility, as shown in this design.
Problem
Currently, users must understand complex GitLab pipeline mechanics to configure Scan Execution Policies that work properly with MR approval policies. This leads to confusion and often results in users selecting "all branches" (*), causing unnecessary pipeline executions and increased infrastructure costs.
Proposal
Implement a new "Optimize for MR approval policies" checkbox option that:
- Automatically configures the policy to run scans in both source and target branches for open merge requests
- Enforces the use of
.latesttemplates to ensure MR pipelines are used correctly - Provides clear explanatory text about what this configuration does
Implementation Details
- Update the
ScanExecutionPolicyEditor.vuecomponent to include the new strategy option - Add the necessary state management for this option
- When checked:
- Set branch type to
target_defaultin the backend configuration - Ensure template selection is set to
.latest - Hide conflicting options to prevent confusion
- Set branch type to
- Add appropriate tooltips and help text to explain the benefits
- Implement behind a feature flag for controlled rollout
Technical Considerations
- This feature depends on the backend implementation of
target_defaultbranch type - The UI should gracefully handle cases where the backend feature is not available
- We should ensure the state is properly preserved when editing existing policies
Acceptance Criteria
-
New "Optimize for MR approval policies" checkbox is added to the SEP editor -
When checked, it correctly configures the policy for MR approval compatibility -
Clear explanatory text is shown to users about what this option does -
The UI handles existing policies correctly when editing -
Feature is implemented behind a feature flag -
Documentation is updated to explain the new option
Related Links
- Parent Epic: Flexible Scan Execution Policy Trigger Condition
- Backend implementation: Add new branch types for SEP
Edited by Alan (Maciej) Paruszewski