Update pipeline sources for branches targeting

What does this MR do and why?

Update pipeline sources for branches targeting

  • when testing the feature, branch options that target other branches (e.g. targets all default branches and targets all protected branches had some issues with supporting certain pipeline sources
  • we will investigate this issue in Implement all pipeline sources for branches tar... (#554272 - closed), but for now we are going to limit the pipeline source options for these selections
  • update options to limit selection
  • reset pipeline sources every time the branch type changes
  • update tests

Changelog: changed

EE: true

References

Screenshots or screen recordings

Scenario Before After
branch_type: targets ... Screenshot_2025-07-08_at_15.23.20 Screenshot_2025-07-08_at_15.21.55
other selections Screenshot_2025-07-08_at_15.22.01 No changes

How to set up and validate locally

  1. Upload a GitLab Ultimate license
  2. Enable the flexible_scan_execution_policy feature flag in http://gdk.test:3443/rails/features
  3. Navigate to a project/group => Secure => Policies => New policy => Scan execution policy => Select custom template
  4. Verify the conditions show many pipeline sources for all branch selections (e.g. all branches, default branch, all protected branches, and specific protected branches)
  5. Verify the conditions show only Merge request event and Code push for targets all protected branches and targets all default branches

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #549571 (closed)

Edited by Alexander Turinske

Merge request reports

Loading