Update SyncProjectApprovalPolicyRulesService to support upsert rules

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Why are we doing this work

Security::SyncProjectPolicyWorker handles multiple events to sync the security policies like Repositories::ProtectedBranchCreatedEvent, Repositories::ProtectedBranchDestroyedEvent, Repositories::DefaultBranchChangedEvent. They call Security::SecurityOrchestrationPolicies::SyncProjectApprovalPolicyRulesService#update_rules to update the approval rules linked to the policy. But, if the approval rules were not created prior to that, the events would not propagate the changes to approval rules.

As a part of this issue, we want to support upsert_rules in Security::SecurityOrchestrationPolicies::SyncProjectApprovalPolicyRulesService

Non-functional requirements

  • Documentation:
  • Feature flag:
  • Performance:
  • Testing:

Implementation plan

Verification steps

Edited by 🤖 GitLab Bot 🤖