Skip to content

Increment object counter according to event name on GitHub Import

Rodrigo Tomonari requested to merge rodrigo/handle-events-object-counter into master

What does this MR do and why?

After !139410 (merged), GitHub Import started to import notes, pull request reviews, pull request merged by, pull request review requests using events, and because of that, all these resources started to be counted as issue_events in the import stats and no longer as note, pull_request_review, pull_request_merged_by.

This change updates GitHub Import to count these resources as it was before !139410 (merged).

The only stats that will no longer be used is the pull_request_review_request as review requests are imported after evaluating multiple events in the replay importer which is incompatible with fetched and imported report stats.

Related to: #435734 (closed) and #433536 (closed)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

  1. Enable github_import_extended_events feature flag
  2. Use command below to trigger a migration
curl --location 'http://gdk.test:3000/api/v4/import/github' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer GDK_ACCESS_TOKEN' \
--data '{
    "personal_access_token": "GITHUB_ACCESS_TOKEN",
    "repo_id": "238972",
    "target_namespace": "root",
    "new_name": "rspec-core",
    "optional_stages": {
      "attachments_import": false,
      "collaborators_import": false
    }
}'
  1. When the migration finishes, check using the API if the import stats are correct:

http://gdk.test:3000/api/v4/project/:id/import/

Edited by Rodrigo Tomonari

Merge request reports

Loading