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>2022-09-20 02:18:09 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-09-20 02:18:09 +0300
commit6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch)
treedc4d20fe6064752c0bd323187252c77e0a89144b /lib/gitlab/import_export/group
parent9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff)
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'lib/gitlab/import_export/group')
-rw-r--r--lib/gitlab/import_export/group/import_export.yml40
-rw-r--r--lib/gitlab/import_export/group/legacy_import_export.yml38
-rw-r--r--lib/gitlab/import_export/group/legacy_tree_restorer.rb22
-rw-r--r--lib/gitlab/import_export/group/relation_factory.rb16
-rw-r--r--lib/gitlab/import_export/group/relation_tree_restorer.rb4
-rw-r--r--lib/gitlab/import_export/group/tree_saver.rb3
6 files changed, 105 insertions, 18 deletions
diff --git a/lib/gitlab/import_export/group/import_export.yml b/lib/gitlab/import_export/group/import_export.yml
index 8df5d52bf77..a08efdf400b 100644
--- a/lib/gitlab/import_export/group/import_export.yml
+++ b/lib/gitlab/import_export/group/import_export.yml
@@ -27,6 +27,26 @@ included_attributes:
- :name
namespace_settings:
- :prevent_sharing_groups_outside_hierarchy
+ iterations_cadence: &iterations_cadence_definition
+ - :group_id
+ - :created_at
+ - :updated_at
+ - :start_date
+ - :active
+ - :roll_over
+ - :title
+ - :description
+ - :sequence
+ iterations_cadences: *iterations_cadence_definition
+ iteration: &iteration_definition
+ - :iid
+ - :created_at
+ - :updated_at
+ - :start_date
+ - :due_date
+ - :group_id
+ - :description
+ iterations: *iteration_definition
excluded_attributes:
group:
@@ -44,6 +64,23 @@ excluded_attributes:
- :max_pages_size
epics:
- :state_id
+ iterations_cadence: &iterations_cadence_definition
+ - :id
+ - :next_run_date
+ - :duration_in_weeks
+ - :iterations_in_advance
+ - :automatic
+ iterations_cadences: *iterations_cadence_definition
+ iteration: &iteration_excluded_definition
+ - :id
+ - :title
+ - :title_html
+ - :project_id
+ - :description_html
+ - :cached_markdown_version
+ - :iterations_cadence_id
+ - :sequence
+ iterations: *iteration_excluded_definition
methods:
labels:
@@ -83,6 +120,7 @@ ee:
- events:
- :push_event_payload
- :system_note_metadata
+ - :resource_state_events
- boards:
- :board_assignee
- :milestone
@@ -92,3 +130,5 @@ ee:
- milestone:
- events:
- :push_event_payload
+ - iterations_cadences:
+ - :iterations
diff --git a/lib/gitlab/import_export/group/legacy_import_export.yml b/lib/gitlab/import_export/group/legacy_import_export.yml
index 082d2346f3d..6507def7d01 100644
--- a/lib/gitlab/import_export/group/legacy_import_export.yml
+++ b/lib/gitlab/import_export/group/legacy_import_export.yml
@@ -24,6 +24,29 @@ included_attributes:
- :username
author:
- :name
+ iterations_cadence: &iterations_cadence_definition
+ - :group_id
+ - :created_at
+ - :updated_at
+ - :start_date
+ - :next_run_date
+ - :duration_in_weeks
+ - :iterations_in_advance
+ - :active
+ - :automatic
+ - :roll_over
+ - :title
+ - :description
+ iterations_cadences: *iterations_cadence_definition
+ iteration: &iteration_definition
+ - :iid
+ - :created_at
+ - :updated_at
+ - :start_date
+ - :due_date
+ - :group_id
+ - :description
+ iterations: *iteration_definition
excluded_attributes:
group:
@@ -41,6 +64,18 @@ excluded_attributes:
- :extra_shared_runners_minutes_limit
epics:
- :state_id
+ iterations_cadence: &iterations_cadence_definition
+ - :id
+ iterations_cadences: *iterations_cadence_definition
+ iteration: &iteration_excluded_definition
+ - :id
+ - :title
+ - :title_html
+ - :project_id
+ - :description_html
+ - :cached_markdown_version
+ - :iterations_cadence_id
+ iterations: *iteration_excluded_definition
methods:
labels:
@@ -79,6 +114,7 @@ ee:
- :award_emoji
- events:
- :push_event_payload
+ - :resource_state_events
- boards:
- :board_assignee
- :milestone
@@ -88,3 +124,5 @@ ee:
- milestone:
- events:
- :push_event_payload
+ - iterations_cadences:
+ - :iterations
diff --git a/lib/gitlab/import_export/group/legacy_tree_restorer.rb b/lib/gitlab/import_export/group/legacy_tree_restorer.rb
index 8b39362b6bb..fa9e765b33a 100644
--- a/lib/gitlab/import_export/group/legacy_tree_restorer.rb
+++ b/lib/gitlab/import_export/group/legacy_tree_restorer.rb
@@ -68,23 +68,23 @@ module Gitlab
def restorer
@relation_tree_restorer ||= RelationTreeRestorer.new(
- user: @user,
- shared: @shared,
- relation_reader: relation_reader,
- members_mapper: members_mapper,
- object_builder: object_builder,
- relation_factory: relation_factory,
- reader: reader,
- importable: @group,
+ user: @user,
+ shared: @shared,
+ relation_reader: relation_reader,
+ members_mapper: members_mapper,
+ object_builder: object_builder,
+ relation_factory: relation_factory,
+ reader: reader,
+ importable: @group,
importable_attributes: @group_attributes,
- importable_path: nil
+ importable_path: nil
)
end
def create_group(group_hash:, parent_group:)
group_params = {
- name: group_hash['name'],
- path: group_hash['path'],
+ name: group_hash['name'],
+ path: group_hash['path'],
parent_id: parent_group&.id,
visibility_level: sub_group_visibility_level(group_hash, parent_group)
}
diff --git a/lib/gitlab/import_export/group/relation_factory.rb b/lib/gitlab/import_export/group/relation_factory.rb
index 258078d595b..1b8436c4ed9 100644
--- a/lib/gitlab/import_export/group/relation_factory.rb
+++ b/lib/gitlab/import_export/group/relation_factory.rb
@@ -5,10 +5,11 @@ module Gitlab
module Group
class RelationFactory < Base::RelationFactory
OVERRIDES = {
- labels: :group_labels,
+ labels: :group_labels,
priorities: :label_priorities,
- label: :group_label,
- parent: :epic
+ label: :group_label,
+ parent: :epic,
+ iterations_cadences: 'Iterations::Cadence'
}.freeze
EXISTING_OBJECT_RELATIONS = %i[
@@ -25,7 +26,10 @@ module Gitlab
private
def setup_models
- setup_note if @relation_name == :notes
+ case @relation_name
+ when :notes then setup_note
+ when :'Iterations::Cadence' then setup_iterations_cadence
+ end
update_group_references
end
@@ -44,6 +48,10 @@ module Gitlab
def use_attributes_permitter?
false
end
+
+ def setup_iterations_cadence
+ @relation_hash['automatic'] = false
+ end
end
end
end
diff --git a/lib/gitlab/import_export/group/relation_tree_restorer.rb b/lib/gitlab/import_export/group/relation_tree_restorer.rb
index fab677bd772..5a78f2fb531 100644
--- a/lib/gitlab/import_export/group/relation_tree_restorer.rb
+++ b/lib/gitlab/import_export/group/relation_tree_restorer.rb
@@ -136,9 +136,9 @@ module Gitlab
attributes_permitter.permit(importable_class_sym, params)
else
Gitlab::ImportExport::AttributeCleaner.clean(
- relation_hash: params,
+ relation_hash: params,
relation_class: importable_class,
- excluded_keys: excluded_keys_for_relation(importable_class_sym))
+ excluded_keys: excluded_keys_for_relation(importable_class_sym))
end
end
diff --git a/lib/gitlab/import_export/group/tree_saver.rb b/lib/gitlab/import_export/group/tree_saver.rb
index 796b9258e57..b4c86c3fc7f 100644
--- a/lib/gitlab/import_export/group/tree_saver.rb
+++ b/lib/gitlab/import_export/group/tree_saver.rb
@@ -46,7 +46,8 @@ module Gitlab
group,
group_tree,
json_writer,
- exportable_path: "groups/#{group.id}"
+ exportable_path: "groups/#{group.id}",
+ current_user: @current_user
).execute
end