[backend] Add pipeline execution schedule background worker architecture
Following the introduction of the pipeline execution policy, which allows for enforcing CI jobs/scripts within triggered pipelines, we plan to extend support for scheduled enforcement.
To keep track of scheduled pipeline runs, we will to introduce a new table similar to security_orchestration_policy_rule_schedules, that references security_policies and projects. The model can include Schedulable and CronSchedulable. To actually run the schedules, we need to add two wokers:
- Cron worker to run every 15 minutes and check the new table for schedules that need to be run. For each finding, it triggers another async worker to execute the schedule.
- Schedule execution worker for each individual schedule, scoped to a
Projectand aSecurity::Policy. This worker canCi::CreatePipelineServiceto trigger the pipeline using thecontentoption with the security policy content.
Edited by Dominic Bauer