Commit 40f32316 authored by George Koltsov's avatar George Koltsov Committed by GitLab Release Tools Bot

Update Import/Export merge/push access levels & exclude ci config path

Merge branch 'security-update-import-export-pr-branches-14-10' into '14-10-stable-ee'

See merge request gitlab-org/security/gitlab!2404

Changelog: security
parent 0a0775a3
...@@ -639,7 +639,6 @@ included_attributes: ...@@ -639,7 +639,6 @@ included_attributes:
- :build_allow_git_fetch - :build_allow_git_fetch
- :build_coverage_regex - :build_coverage_regex
- :build_timeout - :build_timeout
- :ci_config_path
- :delete_error - :delete_error
- :description - :description
- :disable_overriding_approvers_per_merge_request - :disable_overriding_approvers_per_merge_request
......
...@@ -87,6 +87,8 @@ module Gitlab ...@@ -87,6 +87,8 @@ module Gitlab
when *BUILD_MODELS then setup_build when *BUILD_MODELS then setup_build
when :issues then setup_issue when :issues then setup_issue
when :'Ci::PipelineSchedule' then setup_pipeline_schedule when :'Ci::PipelineSchedule' then setup_pipeline_schedule
when :'ProtectedBranch::MergeAccessLevel' then setup_protected_branch_access_level
when :'ProtectedBranch::PushAccessLevel' then setup_protected_branch_access_level
end end
update_project_references update_project_references
...@@ -152,6 +154,10 @@ module Gitlab ...@@ -152,6 +154,10 @@ module Gitlab
@relation_hash['active'] = false @relation_hash['active'] = false
end end
def setup_protected_branch_access_level
@relation_hash['access_level'] = Gitlab::Access::MAINTAINER
end
def compute_relative_position def compute_relative_position
return unless max_relative_position return unless max_relative_position
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
"creator_id": 123, "creator_id": 123,
"visibility_level": 10, "visibility_level": 10,
"archived": false, "archived": false,
"ci_config_path": "config/path",
"labels": [ "labels": [
{ {
"id": 2, "id": 2,
......
...@@ -6,5 +6,6 @@ ...@@ -6,5 +6,6 @@
"archived": false, "archived": false,
"deploy_keys": [], "deploy_keys": [],
"hooks": [], "hooks": [],
"shared_runners_enabled": true "shared_runners_enabled": true,
"ci_config_path": "config/path"
} }
...@@ -417,4 +417,22 @@ RSpec.describe Gitlab::ImportExport::Project::RelationFactory, :use_clean_rails_ ...@@ -417,4 +417,22 @@ RSpec.describe Gitlab::ImportExport::Project::RelationFactory, :use_clean_rails_
expect(created_object.project).to equal(project) expect(created_object.project).to equal(project)
end end
end end
context 'merge request access level object' do
let(:relation_sym) { :'ProtectedBranch::MergeAccessLevel' }
let(:relation_hash) { { 'access_level' => 30, 'created_at' => '2022-03-29T09:53:13.457Z', 'updated_at' => '2022-03-29T09:54:13.457Z' } }
it 'sets access level to maintainer' do
expect(created_object.access_level).to equal(Gitlab::Access::MAINTAINER)
end
end
context 'push access level object' do
let(:relation_sym) { :'ProtectedBranch::PushAccessLevel' }
let(:relation_hash) { { 'access_level' => 30, 'created_at' => '2022-03-29T09:53:13.457Z', 'updated_at' => '2022-03-29T09:54:13.457Z' } }
it 'sets access level to maintainer' do
expect(created_object.access_level).to equal(Gitlab::Access::MAINTAINER)
end
end
end end
...@@ -111,6 +111,10 @@ RSpec.describe Gitlab::ImportExport::Project::TreeRestorer do ...@@ -111,6 +111,10 @@ RSpec.describe Gitlab::ImportExport::Project::TreeRestorer do
end end
end end
it 'does not import ci config path' do
expect(@project.ci_config_path).to be_nil
end
it 'creates a valid pipeline note' do it 'creates a valid pipeline note' do
expect(Ci::Pipeline.find_by_sha('sha-notes').notes).not_to be_empty expect(Ci::Pipeline.find_by_sha('sha-notes').notes).not_to be_empty
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment