Skip to content

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

Screenshot_2024-03-27_at_1.43.18_PM

How to set up and validate locally

  1. Enable the feature flag
echo "Feature.enable(:scan_execution_policy_cadence_validation)" | rails c
  1. Create a new project
  2. Add a new member to the project with developer access
  3. Go to Secure > Policies
  4. Click on New policy
  5. Select Scan execution policy
  6. Change to .yaml mode
  7. Copy the yaml below:
type: scan_execution_policy
name: policy
description: ''
enabled: true
rules:
  - type: schedule
    branches:
      - "*"
    cadence: '* * * * *'
actions:
  - scan: secret_detection
  1. Click on Configure with a merge request
  2. Verify the error message Cadence is invalid was displayed
  3. Update the policy to:
type: scan_execution_policy
name: policy
description: ''
enabled: true
rules:
  - type: schedule
    branches:
      - "*"
    cadence: '0 * * * *'
actions:
  - scan: secret_detection
  1. Click on Configure with a merge request
  2. Verify that no error was displayed
Edited by Marcos Rocha

Merge request reports