Reschedule deduplicated SyncScanPoliciesWorker
What does this MR do and why?
Reschedules SyncScanPoliciesWorker on deduplication since the strategy is :until_executed and a policy edit may get deduplicated while we're still processing a previous edit.
References
n/a
Screenshots or screen recordings
n/a
How to set up and validate locally
- Create a new project
- Navigate to
Secure > Policiesand create the following Scan execution policy:
scan_execution_policy:
- name: Alpha
enabled: true
rules:
- type: pipeline
branch_type: all
actions:
- scan: secret_detection
- Merge the MR on the policy project
- Patch
ee/app/workers/concerns/update_orchestration_policy_configuration.rbto simulate latency:
diff --git a/ee/app/workers/concerns/update_orchestration_policy_configuration.rb b/ee/app/workers/concerns/update_orchestration_policy_configuration.rb
index 752a5b8bc840..824733abf123 100644
--- a/ee/app/workers/concerns/update_orchestration_policy_configuration.rb
+++ b/ee/app/workers/concerns/update_orchestration_policy_configuration.rb
@@ -21,6 +21,8 @@ def update_policy_configuration(configuration)
Security::PersistSecurityPoliciesWorker.perform_async(configuration.id)
+ sleep 60
+
configuration.delete_all_schedules
configuration.active_scan_execution_policies.each_with_index do |policy, policy_index|
Security::SecurityOrchestrationPolicies::ProcessRuleService
- Open two MRs that change the name of the policy to
BetaandGammarespectively - Merge the first MR, then merge the second
- Once the worker completes, verify the policy's mirrored name is
Gamma:
pry(main)> Security::OrchestrationPolicyConfiguration.last.security_policies.pluck("name")
=> ["Gamma"]
- Repeat on
masterand verify the policy's mirrored name isBeta
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 Dominic Bauer