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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-20 18:09:17 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-20 18:09:17 +0300
commit194b499aa8e26df26ff70a1e1ce0396587bd5243 (patch)
treec873ac9c3096faf4a5da43d6670107461da2a7d7 /lib/gitlab/import_export
parent43b4b3e2d2ddebc0a89b94a8251c162ec5719780 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/import_export')
-rw-r--r--lib/gitlab/import_export/relation_tree_restorer.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/gitlab/import_export/relation_tree_restorer.rb b/lib/gitlab/import_export/relation_tree_restorer.rb
index 88cf346d8ec..1157e18c7f9 100644
--- a/lib/gitlab/import_export/relation_tree_restorer.rb
+++ b/lib/gitlab/import_export/relation_tree_restorer.rb
@@ -71,6 +71,7 @@ module Gitlab
import_failure_service.with_retry(action: 'relation_object.save!', relation_key: relation_key, relation_index: relation_index) do
relation_object.save!
+ log_relation_creation(@importable, relation_key, relation_object)
end
rescue => e
import_failure_service.log_import_failure(
@@ -218,6 +219,25 @@ module Gitlab
relation_reader.sort_ci_pipelines_by_id
end
+
+ # Enable logging of each top-level relation creation when Importing
+ # into a Group if feature flag is enabled
+ def log_relation_creation(importable, relation_key, relation_object)
+ root_ancestor_group = importable.try(:root_ancestor)
+
+ return unless root_ancestor_group
+ return unless root_ancestor_group.instance_of?(::Group)
+ return unless Feature.enabled?(:log_import_export_relation_creation, root_ancestor_group)
+
+ @shared.logger.info(
+ importable_type: importable.class.to_s,
+ importable_id: importable.id,
+ relation_key: relation_key,
+ relation_id: relation_object.id,
+ author_id: relation_object.try(:author_id),
+ message: '[Project/Group Import] Created new object relation'
+ )
+ end
end
end
end