Skip to content

Import approvals from Bitbucket server

What does this MR do and why?

Imports approvals from Bitbucket Server.

Bitbucket returns approval events in the activities API along with merge events so I've opted to add it in the same place as merge events.

In order to create the approval, we need to create 3 records:

  1. An approval
  2. An event
  3. A reviewer if it doesn't exist

For all of these we want to keep the original timestamp because it's important to know when an approval happened.

This follows the same logic as how the GitHub importer imports approvals: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/github_import/importer/pull_requests/review_importer.rb#L24-L26.

Screenshots or screen recordings

Screenshot_2023-10-26_at_16.33.18

Timestamps are the same:

Screenshot_2023-10-26_at_16.33.28

Screenshot_2023-10-26_at_16.33.52

How to set up and validate locally

  1. Setup bitbucket server and create a pull request.
  2. Review the PR and approve.
  3. Import the project into gitlab and note that the approval info is correctly imported.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #23586 (closed)

Edited by Madelein van Niekerk

Merge request reports