diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-28 01:36:23 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-28 01:36:23 +0300 |
commit | 7b43295cef5b4f05dc6aa55d9e50e85a7cbdeeac (patch) | |
tree | 3e6e5f891ef675a7ca2034a4f3ec440dc5b4427e /lib | |
parent | 190831bff0c152eac613b89a3188c7901d5a2c01 (diff) |
Add latest changes from gitlab-org/security/gitlab@16-2-stable-ee
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/import_export/project/import_export.yml | 2 | ||||
-rw-r--r-- | lib/gitlab/import_export/project/relation_factory.rb | 35 |
2 files changed, 27 insertions, 10 deletions
diff --git a/lib/gitlab/import_export/project/import_export.yml b/lib/gitlab/import_export/project/import_export.yml index 5986c5de441..d025c47bfa4 100644 --- a/lib/gitlab/import_export/project/import_export.yml +++ b/lib/gitlab/import_export/project/import_export.yml @@ -174,7 +174,6 @@ included_attributes: - :cron_timezone - :description - :next_run_at - - :owner_id - :project_id - :ref - :updated_at @@ -378,7 +377,6 @@ included_attributes: - :updated_by_id - :merge_error - :merge_params - - :merge_when_pipeline_succeeds - :merge_user_id - :merge_commit_sha - :squash_commit_sha diff --git a/lib/gitlab/import_export/project/relation_factory.rb b/lib/gitlab/import_export/project/relation_factory.rb index 7af65235492..895b6394673 100644 --- a/lib/gitlab/import_export/project/relation_factory.rb +++ b/lib/gitlab/import_export/project/relation_factory.rb @@ -99,6 +99,7 @@ module Gitlab when :'ProtectedBranch::PushAccessLevel' then setup_protected_branch_access_level when :ApprovalProjectRulesProtectedBranch then setup_merge_approval_protected_branch when :releases then setup_release + when :merge_requests, :MergeRequest, :merge_request then setup_merge_request end update_project_references @@ -149,22 +150,30 @@ module Gitlab end def setup_pipeline + @relation_hash['status'] = transform_status(@relation_hash['status']) + @relation_hash.fetch('stages', []).each do |stage| + stage.status = transform_status(stage.status) + # old export files have statuses - stage.statuses.each do |status| - status.pipeline = imported_object + stage.statuses.each do |job| + job.status = transform_status(job.status) + job.pipeline = imported_object end - stage.builds.each do |status| - status.pipeline = imported_object + stage.builds.each do |job| + job.status = transform_status(job.status) + job.pipeline = imported_object end - stage.bridges.each do |status| - status.pipeline = imported_object + stage.bridges.each do |job| + job.status = transform_status(job.status) + job.pipeline = imported_object end - stage.generic_commit_statuses.each do |status| - status.pipeline = imported_object + stage.generic_commit_statuses.each do |job| + job.status = transform_status(job.status) + job.pipeline = imported_object end end end @@ -188,6 +197,10 @@ module Gitlab @relation_hash['active'] = false end + def setup_merge_request + @relation_hash['merge_when_pipeline_succeeds'] = false + end + def setup_protected_branch_access_level return if root_group_owner? return if @relation_hash['access_level'] == Gitlab::Access::NO_ACCESS @@ -227,6 +240,12 @@ module Gitlab @relation_name == :'Ci::Trigger' && @relation_hash['owner_id'].nil? end + def transform_status(status) + return 'canceled' if ::Ci::HasStatus::COMPLETED_STATUSES.exclude?(status) + + status + end + def preload_keys(object, references, value) return object unless value |