Fix invalid pipelines for scan execution policies
What does this MR do and why?
This MR prevents the creation of merge requests pipelines for scan execution policy scans when the policy does not apply to the branch.
References
Related to #526355 (closed)
Screenshots or screen recordings
| Before | After |
|---|---|
![]() |
![]() |
How to set up and validate locally
- Create a new project without a
.gitlab-ci.ymlfile - Ensure the Auto DevOps is disabled(Settings > Ci/CD > Auto DevOps)
- Go to Secure > Policies
- Click on New policy
- Select Scan Execution Policy
- Create a policy to run a secret_detection scan with the default template for the default branch:
scan_execution_policy:
- name: sep
description: ''
enabled: true
rules:
- type: pipeline
branch_type: default
actions:
- scan: secret_detection
skip_ci:
allowed: true
allowlist:
users: []
- Click on Configure with a merge request
- Merge the new MR to add the policy
- Create a MR editing the
README.mdfile - Verify that no pipeline is created
- Merge the MR
- Verify the MR is created for the default branch
Optional: Repeat the steps of !179614 (merged) to ensure it also work with the latest template and MR pipelines.
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.
Edited by Marcos Rocha

