Skip to content

Content created through project template, or custom template, recorded as imported from file-based import

Problem

Projects created through built in project template and custom template piggy back on Gitlab::ImportExport::Importer.

Currently all content created is recorded with its imported_from as gitlab_project !153462 (merged). gitlab_project is file-based project import/export.

Proposal

After #511960, projects created via built in template will have its own "import source". At this point we should be able to change Gitlab::ImportExport::Importer to set the import_from as:

  • gitlab_project for file-based project import (existing functionality)
  • gitlab_group for file-based group import (existing functionality)
  • gitlab_built_in_project_template for built-in project template (new)
  • gitlab_custom_project_template for custom project template (new)

(Note: at time of writing HasImportSource incorrectly (?) has the enum for custom template as custom_template, but internally the string used is actually gitlab_custom_project_template so the enum value should be changed to that)

What to do about old data?

What should we do about old data from project creation via template that has the incorrect imported_from?

The Project#import_source for projects created via custom template should be gitlab_custom_project_template, so that could be used potentially to update content for those projects, where imported_from=gitlab_project to switch it to gitlab_custom_project_template.

This data migration would be large and time consuming though.

Prior to #511960 the import_source for projects created via built-in template was the same as file-based project import - so we can't do the same style migration there.

One possibility is we live with old data having the wrong imported_from - it depends what the UI/UX consequences of this are. Another could be a data migration that identifies the projects based on the list of built-in templates, but that would need further investigation whether it's feasible to do that.

Edited by Luke Duncalfe
OSZAR »