Skip to content

Store GitHub Import stats in DB

What does this MR do and why?

Currently, after the GitHub import is started, we are showing the statistics of imported/fetched objects in the UI and in the API response (for the GET /projects/{id}/import endpoint).

But this information is temporarily stored in Redis and cleared after 2 days (expiration time) after import is finished.

In this MR we store this stats in our DB after GitHub import is finished so it won't disappear when Redis key is expired.

It implements #388279 (closed).

Screenshots or screen recordings

109939-Store-GitHub-Import-stats-in-DB

How to set up and validate locally

  1. Import a GitHub project to GitLab using UI (Go to New Project -> Import project -> GitHub -> click Import button) or API.

  2. After import is finished, make sure project.import_checksums contains a hash with project import statistics:

project = Project.last
project.import_checksums

The hash must contain the same data as the cached import statistics:

::Gitlab::GithubImport::ObjectCounter.summary(project)
  1. Wait 2 days or clear Redis cache.

  2. Ensure that the import statistics are still displayed in the UI and in the API response for the GET /projects/{id}/import endpoint.

MR acceptance checklist

Edited by Vitali Tatarintev

Merge request reports