[go: up one dir, main page]

Skip to content

Update code owner rules asynchronously for open merge requests after creating a protected branch

Background

When a new protected branch is created we perform a database query to find merge requests that are matching that protected branch: https://gitlab.com/gitlab-org/gitlab/-/blob/fadfc2095ab750efb5327cd64a2b53ac1aa7992f/ee/app/services/ee/protected_branches/create_service.rb#L36-38

  • A query is performed to find merge requests that match the pattern of the protected branch.
  • Translating the wildcard pattern to a pattern that is usable in a database query is relatively straightforward
  • Translating a re2 regex to something usable in postgresql is going to be hard to do accurately

Proposal

  • To avoid the above difficulty we would instead enqueue jobs for each open merge request similar to how it is done for scan result policies after a protected branch is created.
  • Each job would then be able to compare the target_branch of the merge request with the re2 regex in ruby.
Edited by 🤖 GitLab Bot 🤖