Commit 4af697f6 authored by Alan (Maciej) Paruszewski's avatar Alan (Maciej) Paruszewski Committed by Thong Kuah

Use allowlist of allowed attributes for imported models

This change changes the behavior that is reponsible for filtering out
attributes when importing new project. We were cleaning attributes based
on list of excluded patterns and attributes. For Issuee, External
Pull Requests, Pipeline and related models we are changing that
behavior.

Changelog: changed
parent c9336b9c
......@@ -494,6 +494,144 @@ included_attributes:
- :created_at
- :updated_at
- :summary
external_pull_request: &external_pull_request_definition
- :created_at
- :updated_at
- :project_id
- :pull_request_iid
- :status
- :source_branch
- :target_branch
- :source_repository
- :target_repository
- :source_sha
- :target_sha
external_pull_requests: *external_pull_request_definition
statuses:
- :project_id
- :status
- :finished_at
- :created_at
- :updated_at
- :started_at
- :coverage
- :commit_id
- :name
- :options
- :allow_failure
- :stage
- :stage_idx
- :tag
- :ref
- :user_id
- :type
- :target_url
- :description
- :erased_at
- :artifacts_expire_at
- :environment
- :yaml_variables
- :queued_at
- :lock_version
- :coverage_regex
- :retried
- :protected
- :failure_reason
- :scheduled_at
- :scheduling_type
ci_pipelines:
- :ref
- :sha
- :before_sha
- :created_at
- :updated_at
- :tag
- :yaml_errors
- :committed_at
- :project_id
- :status
- :started_at
- :finished_at
- :duration
- :user_id
- :lock_version
- :source
- :protected
- :config_source
- :failure_reason
- :iid
- :source_sha
- :target_sha
stages:
- :name
- :status
- :position
- :lock_version
- :project_id
- :created_at
- :updated_at
actions:
- :event
- :image_v432x230
design: &design_definition
- :iid
- :project_id
- :filename
- :relative_position
designs: *design_definition
design_versions:
- :created_at
- :sha
- :author_id
issue_assignees:
- :user_id
sentry_issue:
- :sentry_issue_identifier
zoom_meetings:
- :project_id
- :issue_status
- :url
- :created_at
- :updated_at
issues:
- :title
- :author_id
- :project_id
- :created_at
- :updated_at
- :description
- :state
- :iid
- :updated_by_id
- :confidential
- :closed_at
- :closed_by_id
- :due_date
- :lock_version
- :weight
- :time_estimate
- :relative_position
- :external_author
- :last_edited_at
- :last_edited_by_id
- :discussion_locked
- :health_status
- :external_key
- :issue_type
group_members:
- :access_level
- :source_type
- :user_id
- :notification_level
- :created_at
- :updated_at
- :created_by_id
- :invite_email
- :invite_accepted_at
- :requested_at
- :expires_at
- :ldap
- :override
# Do not include the following attributes for the models specified.
excluded_attributes:
......
......@@ -126,6 +126,20 @@ RSpec.describe Gitlab::ImportExport::AttributesPermitter do
:project_feature | true
:prometheus_metrics | true
:service_desk_setting | true
:external_pull_request | true
:external_pull_requests | true
:statuses | true
:ci_pipelines | true
:stages | true
:actions | true
:design | true
:designs | true
:design_versions | true
:issue_assignees | true
:sentry_issue | true
:zoom_meetings | true
:issues | true
:group_members | true
end
with_them do
......
......@@ -207,9 +207,9 @@ RSpec.describe Gitlab::ImportExport::FastHashSerializer do
context 'relation ordering' do
it 'orders exported pipelines by primary key' do
expected_order = project.ci_pipelines.reorder(:id).ids
expected_order = project.ci_pipelines.reorder(:id).pluck(:sha)
expect(subject['ci_pipelines'].pluck('id')).to eq(expected_order)
expect(subject['ci_pipelines'].pluck('sha')).to eq(expected_order)
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