Step 3: Version Control for Snippets: Import/Export (MVP)
Important: All the new functionality must be implemented behind the feature flag
:version_snippets. Besides, it has to be scoped for projects. Therefore, instead of checking if the feature flag is enabled or not (
Feature.enabled?(:version_snippets)), we will check if the feature flag is enabled for specific projects (
Feature.enabled?(:version_snippets, project)). This way, for testing purposes, we can enable the feature flag on the project
gitlab-org/gitlab for example, instead of enabling it globally.
In order to export the snippets, we will have to add a new
Gitlab::ImportExport::SnippetRepoSaver to the list of importers in
Projects::ImportExport::ExportService#L38. Through this service, we can iterate over each snippet repository and call
bundle_to_disk on it.
In a similar way we will have to update the
Gitlab::ImportExport::Importer. We will have to add a new
SnippetRepoRestorer class and also add it to the list of restorers.
Availability and Testing
Potentially requires new E2E