Add cadence validation for sep creation
What does this MR do and why?
This MR adds a cadence validation for the scan execution policy creation according to the supported cadences in our documentation.
Related to: #454855 (closed)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
How to set up and validate locally
- Enable the feature flag
echo "Feature.enable(:scan_execution_policy_cadence_validation)" | rails c
- Create a new project
- Add a new member to the project with developer access
- Go to Secure > Policies
- Click on New policy
- Select Scan execution policy
- Change to .yaml mode
- Copy the yaml below:
type: scan_execution_policy
name: policy
description: ''
enabled: true
rules:
- type: schedule
branches:
- "*"
cadence: '* * * * *'
actions:
- scan: secret_detection
- Click on Configure with a merge request
- Verify the error message
Cadence is invalid
was displayed - Update the policy to:
type: scan_execution_policy
name: policy
description: ''
enabled: true
rules:
- type: schedule
branches:
- "*"
cadence: '0 * * * *'
actions:
- scan: secret_detection
- Click on Configure with a merge request
- Verify that no error was displayed
Edited by Marcos Rocha