Skip to content

Add a new worker to process the pipeline creation for sep

Marcos Rocha requested to merge mc_rocha-add-work-create-pipeline-sep into master

What does this MR do and why?

Add a new worker to process the pipeline creation for scheduled scan_execution_policies.

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.

How to set up and validate locally

  1. Enable the feature flag
echo "Feature.enable(:scan_execution_pipeline_worker)" | rails c
  1. Create a new project
  2. Go to Secure > Policies
  3. Click on New policy
  4. Select Scan Execution policy
  5. Change to .yaml mode
  6. Copy the yaml below:
type: scan_execution_policy
name: schedule
description: ''
enabled: true
rules:
  - type: schedule
    cadence: 0 0 * * *
    branch_type: all
    timezone: Etc/UTC
actions:
  - scan: container_scanning
  - scan: secret_detection
  1. Click on Configure with a merge request
  2. Merge the new MR to add the policy
  3. Create a new branch
  4. Trigger the schedule using the rails console
schedule = Security::OrchestrationPolicyRuleSchedule.last
schedule.update_column(:next_run_at, 1.day.ago)

project = schedule.security_orchestration_policy_configuration.project
security_policy_bot_id = project.security_policy_bot.id

Security::ScanExecutionPolicies::RuleScheduleWorker.perform_async(project.id, security_policy_bot_id, schedule.id)
  1. Go to the Pipelines page and verify the expected pipelines were created:

Screenshot_2024-03-22_at_5.12.00_PM

Edited by Marcos Rocha

Merge request reports