Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bulk_imports')
-rw-r--r--lib/bulk_imports/common/pipelines/entity_finisher.rb2
-rw-r--r--lib/bulk_imports/groups/stage.rb14
-rw-r--r--lib/bulk_imports/stage.rb9
3 files changed, 21 insertions, 4 deletions
diff --git a/lib/bulk_imports/common/pipelines/entity_finisher.rb b/lib/bulk_imports/common/pipelines/entity_finisher.rb
index aa9221cceee..0f4def3b17a 100644
--- a/lib/bulk_imports/common/pipelines/entity_finisher.rb
+++ b/lib/bulk_imports/common/pipelines/entity_finisher.rb
@@ -30,6 +30,8 @@ module BulkImports
pipeline_class: self.class.name,
message: "Entity #{entity.status_name}"
)
+
+ context.portable.try(:after_import)
end
private
diff --git a/lib/bulk_imports/groups/stage.rb b/lib/bulk_imports/groups/stage.rb
index bc27220391d..97a423b6ea9 100644
--- a/lib/bulk_imports/groups/stage.rb
+++ b/lib/bulk_imports/groups/stage.rb
@@ -47,7 +47,7 @@ module BulkImports
end
def project_entities_pipeline
- if project_pipeline_available? && ::Feature.enabled?(:bulk_import_projects, default_enabled: :yaml)
+ if project_pipeline_available? && feature_flag_enabled?
{
project_entities: {
pipeline: BulkImports::Groups::Pipelines::ProjectEntitiesPipeline,
@@ -62,6 +62,18 @@ module BulkImports
def project_pipeline_available?
@bulk_import.source_version_info >= BulkImport.min_gl_version_for_project_migration
end
+
+ def feature_flag_enabled?
+ destination_namespace = @bulk_import_entity.destination_namespace
+
+ if destination_namespace.present?
+ root_ancestor = Namespace.find_by_full_path(destination_namespace)&.root_ancestor
+
+ ::Feature.enabled?(:bulk_import_projects, root_ancestor, default_enabled: :yaml)
+ else
+ ::Feature.enabled?(:bulk_import_projects, default_enabled: :yaml)
+ end
+ end
end
end
end
diff --git a/lib/bulk_imports/stage.rb b/lib/bulk_imports/stage.rb
index 9c19e9ea60b..6cf394c5df0 100644
--- a/lib/bulk_imports/stage.rb
+++ b/lib/bulk_imports/stage.rb
@@ -2,10 +2,13 @@
module BulkImports
class Stage
- def initialize(bulk_import)
- raise(ArgumentError, 'Expected an argument of type ::BulkImport') unless bulk_import.is_a?(::BulkImport)
+ def initialize(bulk_import_entity)
+ unless bulk_import_entity.is_a?(::BulkImports::Entity)
+ raise(ArgumentError, 'Expected an argument of type ::BulkImports::Entity')
+ end
- @bulk_import = bulk_import
+ @bulk_import_entity = bulk_import_entity
+ @bulk_import = bulk_import_entity.bulk_import
end
def pipelines