Skip to content

Migrate Epic Events when using Group Migration

George Koltsov requested to merge georgekoltsov/group-mig-epic-events into master

What does this MR do?

Currently targets and depends on !54368 (merged)

This MR adds events migration to Group Epics when using Bulk Imports https://docs.gitlab.com/ee/user/group/import/

When you close/reopen an epic 2 records are created: Event & ResourceStateEvent. Having Event record alone does not show the event in the UI, so when we import Events from source instance of Gitlab we also need to create ResourceStateEvent in order for the UI to show historical close/reopen events.

This imports only reopened/closed events for 2 reasons:

  1. There is no need to import created event since epic has created event upon creation and importing it in would mean creating a duplicate.
  2. Specifically for epics, I double checked production and there are only created/reopened/closed events associated that I've seen. Any other potential event that is fetched from source is ignored.

To test

  1. Create group, epic and add events to the created epic (e.g. closed/reopen it multiple times).
  2. Enable bulk_import feature. Feature.enabled(:bulk_import)
  3. Open rails console
user = User.first
credentials = { url: 'http://gdk.test:3000', access_token: ENV['GITLAB_LOCAL_TOKEN'] }
params = [{ source_type: 'group_entity', source_name: '<name of group you just created>', source_full_path: '<full path of group you just created>', destination_name: "destination", destination_namespace: 'root' }]

BulkImportService.new(user, params, credentials).execute
  1. Alternatively a group can be imported via UI at /groups/new page and selecting 'Import group' tab.
  2. Verify newly imported group, it's epic and the events associated with it. Verify events are identical between source and destination epics.

Screenshots (strongly suggested)

image

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by George Koltsov

Merge request reports

Loading