[go: up one dir, main page]

Skip to content

Project import/export does not include activity log entries (events) relating to git

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

The project import/export feature does not include entries from the events table (and so logically also push_event_payloads) relating to git.

I uncovered this with a test project that had only two types of activity: push events and merge requests. There may also be other affected event types.

I was trying to find a way to recover activity history for a customer ticket (internal links). A summary of that investigation is in #119109 (closed)

Steps to reproduce

Identify a project with activity log entries against it.

Export it via Settings | General | Advanced

Import it. Check the activity log.

I additionally did the following (on a self managed instance)

  • Export the project
  • Delete all (25) records from the events table for that project
  • Export it again.
  • Format the two project.json files from the exports using jq and then diff them.

The only difference was two merge request events, which I'd already observed were restored OK.

Example Project

For the purposes of this issue, I exported an old test project (activity log)

Import target activity log

What is the current bug behavior?

Activity log data is missing from the project export.

What is the expected correct behavior?

Project export/import should include the activity log.

Relevant logs and/or screenshots

Original project:

image

Import:

image

Output of checks

This bug happens on GitLab.com

Possible fixes

@cat looked through the code and observed:

irb(main):006:0> shared = []
=> []
irb(main):007:0> reader = Gitlab::ImportExport::Reader.new(shared: shared)
irb(main):017:0> reader.project_tree[:include].map {|i| i.keys.first}
=> [:labels, :milestones, :issues, :snippets, :releases, :project_members, :merge_requests, :external_pull_requests, :ci_pipelines, :auto_devops, :triggers, :pipeline_schedules, :container_expiration_policy, :ser
irb(main):023:0> reader.project_tree[:include].find {|i| i.keys.first == :merge_requests}[:merge_requests][:include].map {|i| i.keys.first}
=> [:metrics, :award_emoji, :notes, :merge_request_diff, :events, :timelogs, :label_links, :milestone, :resource_label_events]
irb(main):028:0> reader.project_tree[:include].find {|i| i.keys.first == :events}
=> nil
Edited by 🤖 GitLab Bot 🤖