2019-05-30 06:50:40 -04:00
|
|
|
FRONTEND_MAINTAINERS = %w[filipa iamphill].freeze
|
|
|
|
BACKEND_MAINTAINERS = %w[rspeicher rymai yorickpeterse godfat].freeze
|
|
|
|
NO_REVIEWER = 'No reviewer available'.freeze
|
2019-05-29 11:15:09 -04:00
|
|
|
|
2019-02-27 08:39:31 -05:00
|
|
|
def mention_single_codebase_approvers
|
2019-05-29 11:15:09 -04:00
|
|
|
canonical_branch_name =
|
|
|
|
roulette.canonical_branch_name(gitlab.mr_json['source_branch'])
|
|
|
|
|
|
|
|
random = roulette.new_random(canonical_branch_name)
|
|
|
|
|
2019-05-30 06:50:40 -04:00
|
|
|
frontend_maintainers = helper.new_teammates(FRONTEND_MAINTAINERS)
|
|
|
|
backend_maintainers = helper.new_teammates(BACKEND_MAINTAINERS)
|
2019-02-27 08:39:31 -05:00
|
|
|
|
|
|
|
rows = []
|
|
|
|
|
|
|
|
if gitlab.mr_labels.include?('frontend')
|
2019-05-29 11:15:09 -04:00
|
|
|
frontend_maintainer =
|
|
|
|
roulette.spin_for_person(frontend_maintainers, random: random)
|
2019-02-27 08:39:31 -05:00
|
|
|
|
2019-05-30 06:50:40 -04:00
|
|
|
rows << "| ~frontend | #{frontend_maintainer&.markdown_name || NO_REVIEWER}"
|
2019-02-27 08:39:31 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
if gitlab.mr_labels.include?('backend')
|
2019-05-29 11:15:09 -04:00
|
|
|
backend_maintainer =
|
|
|
|
roulette.spin_for_person(backend_maintainers, random: random)
|
2019-02-27 08:39:31 -05:00
|
|
|
|
2019-05-30 06:50:40 -04:00
|
|
|
rows << "| ~backend | #{backend_maintainer&.markdown_name || NO_REVIEWER}"
|
2019-02-27 08:39:31 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
if rows.empty?
|
|
|
|
backup_maintainer = backend_maintainers.sample
|
|
|
|
|
2019-05-29 11:15:09 -04:00
|
|
|
rows << "| ~frontend / ~backend | #{backup_maintainer.markdown_name}"
|
2019-02-27 08:39:31 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
markdown(<<~MARKDOWN.strip)
|
|
|
|
## Single codebase changes
|
|
|
|
|
|
|
|
This merge request contains changes related to the work of moving towards a
|
|
|
|
[single codebase](https://gitlab.com/groups/gitlab-org/-/epics/802) for
|
|
|
|
Community Edition and Enterprise Edition. These changes will need to be
|
|
|
|
reviewed and approved by the following engineers:
|
|
|
|
|
|
|
|
| Category | Reviewer
|
|
|
|
|----------|---------
|
|
|
|
#{rows.join("\n")}
|
|
|
|
|
|
|
|
To make sure this happens, please follow these steps:
|
|
|
|
|
|
|
|
1. Add all of the mentioned users to the list of merge request approvals.
|
|
|
|
2. Assign the merge request to the first person in the above list.
|
|
|
|
|
|
|
|
If you are a reviewer, please follow these steps:
|
|
|
|
|
|
|
|
1. Review the merge request. If it is good to go, approve it.
|
|
|
|
2. Once approved, assign to the next person in the above list. If you are
|
|
|
|
the last person in the list, merge the merge request.
|
|
|
|
MARKDOWN
|
|
|
|
end
|
|
|
|
|
|
|
|
if gitlab.mr_labels.include?('single codebase')
|
|
|
|
mention_single_codebase_approvers
|
|
|
|
end
|