Migrate Epic Events when using Group Migration
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 Event
s 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:
- There is no need to import
created
event since epic hascreated
event upon creation and importing it in would mean creating a duplicate. - 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
- Create group, epic and add events to the created epic (e.g. closed/reopen it multiple times).
- Enable
bulk_import
feature.Feature.enabled(:bulk_import)
- 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
- Alternatively a group can be imported via UI at
/groups/new
page and selecting 'Import group' tab. - 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)
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
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