Commit 3bb340f2 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch '220342-remove-services-from-import-export' into 'master'

Exclude integrations (services) from Project Import/Export

See merge request gitlab-org/gitlab!35249
parents e646fca7 ac530abe
...@@ -6,7 +6,7 @@ module ExportHelper ...@@ -6,7 +6,7 @@ module ExportHelper
[ [
_('Project and wiki repositories'), _('Project and wiki repositories'),
_('Project uploads'), _('Project uploads'),
_('Project configuration, including services'), _('Project configuration, excluding integrations'),
_('Issues with comments, merge requests with diffs and comments, labels, milestones, snippets, and other project entities'), _('Issues with comments, merge requests with diffs and comments, labels, milestones, snippets, and other project entities'),
_('LFS objects'), _('LFS objects'),
_('Issue Boards'), _('Issue Boards'),
......
---
title: Exclude integrations (services) from Project Import/Export
merge_request: 35249
author:
type: changed
...@@ -97,7 +97,7 @@ The following items will be exported: ...@@ -97,7 +97,7 @@ The following items will be exported:
- Project and wiki repositories - Project and wiki repositories
- Project uploads - Project uploads
- Project configuration, including services - Project configuration, excluding integrations
- Issues with comments, merge requests with diffs and comments, labels, milestones, snippets, time tracking, - Issues with comments, merge requests with diffs and comments, labels, milestones, snippets, time tracking,
and other project entities and other project entities
- Design Management files and data - Design Management files and data
......
...@@ -89,7 +89,6 @@ tree: ...@@ -89,7 +89,6 @@ tree:
- :triggers - :triggers
- :pipeline_schedules - :pipeline_schedules
- :container_expiration_policy - :container_expiration_policy
- :services
- protected_branches: - protected_branches:
- :merge_access_levels - :merge_access_levels
- :push_access_levels - :push_access_levels
...@@ -261,12 +260,6 @@ excluded_attributes: ...@@ -261,12 +260,6 @@ excluded_attributes:
runners: runners:
- :token - :token
- :token_encrypted - :token_encrypted
services:
- :description
- :inherit_from_id
- :instance
- :template
- :title
error_tracking_setting: error_tracking_setting:
- :encrypted_token - :encrypted_token
- :encrypted_token_iv - :encrypted_token_iv
...@@ -355,8 +348,6 @@ methods: ...@@ -355,8 +348,6 @@ methods:
- :type - :type
statuses: statuses:
- :type - :type
services:
- :type
merge_request_diff_files: merge_request_diff_files:
- :utf8_diff - :utf8_diff
merge_requests: merge_requests:
......
...@@ -70,10 +70,8 @@ module Gitlab ...@@ -70,10 +70,8 @@ module Gitlab
private private
def invalid_relation? def invalid_relation?
# Do not create relation if it is: # Do not create relation if it is a legacy trigger
# - An unknown service legacy_trigger?
# - A legacy trigger
unknown_service? || legacy_trigger?
end end
def setup_models def setup_models
...@@ -137,11 +135,6 @@ module Gitlab ...@@ -137,11 +135,6 @@ module Gitlab
end end
end end
def unknown_service?
@relation_name == :services && parsed_relation_hash['type'] &&
!Object.const_defined?(parsed_relation_hash['type'])
end
def legacy_trigger? def legacy_trigger?
@relation_name == :'Ci::Trigger' && @relation_hash['owner_id'].nil? @relation_name == :'Ci::Trigger' && @relation_hash['owner_id'].nil?
end end
......
...@@ -17760,7 +17760,7 @@ msgstr "" ...@@ -17760,7 +17760,7 @@ msgstr ""
msgid "Project clone URL" msgid "Project clone URL"
msgstr "" msgstr ""
msgid "Project configuration, including services" msgid "Project configuration, excluding integrations"
msgstr "" msgstr ""
msgid "Project description (optional)" msgid "Project description (optional)"
......
...@@ -455,9 +455,6 @@ ...@@ -455,9 +455,6 @@
], ],
"pipeline_schedules":[ "pipeline_schedules":[
],
"services":[
], ],
"protected_branches":[ "protected_branches":[
......
...@@ -141,48 +141,6 @@ ...@@ -141,48 +141,6 @@
] ]
} }
], ],
"services": [
{
"id": 100,
"project_id": 5,
"created_at": "2016-06-14T15:01:51.315Z",
"updated_at": "2016-06-14T15:01:51.315Z",
"active": false,
"properties": {},
"template": true,
"instance": false,
"push_events": true,
"issues_events": true,
"merge_requests_events": true,
"tag_push_events": true,
"note_events": true,
"job_events": true,
"type": "TeamcityService",
"category": "ci",
"default": false,
"wiki_page_events": true
},
{
"id": 101,
"project_id": 5,
"created_at": "2016-06-14T15:01:51.315Z",
"updated_at": "2016-06-14T15:01:51.315Z",
"active": false,
"properties": {},
"template": false,
"instance": true,
"push_events": true,
"issues_events": true,
"merge_requests_events": true,
"tag_push_events": true,
"note_events": true,
"job_events": true,
"type": "JiraService",
"category": "ci",
"default": false,
"wiki_page_events": true
}
],
"snippets": [], "snippets": [],
"hooks": [], "hooks": [],
"custom_attributes": [ "custom_attributes": [
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
], ],
"labels": [], "labels": [],
"issues": [], "issues": [],
"services": [],
"snippets": [], "snippets": [],
"hooks": [] "hooks": []
} }
...@@ -175,14 +175,6 @@ RSpec.describe Gitlab::ImportExport::FastHashSerializer do ...@@ -175,14 +175,6 @@ RSpec.describe Gitlab::ImportExport::FastHashSerializer do
expect(subject['merge_requests'].first['resource_label_events']).not_to be_empty expect(subject['merge_requests'].first['resource_label_events']).not_to be_empty
end end
it 'saves the correct service type' do
expect(subject['services'].first['type']).to eq('CustomIssueTrackerService')
end
it 'saves the properties for a service' do
expect(subject['services'].first['properties']).to eq('one' => 'value')
end
it 'has project feature' do it 'has project feature' do
project_feature = subject['project_feature'] project_feature = subject['project_feature']
expect(project_feature).not_to be_empty expect(project_feature).not_to be_empty
......
...@@ -291,10 +291,6 @@ RSpec.describe Gitlab::ImportExport::Project::TreeRestorer do ...@@ -291,10 +291,6 @@ RSpec.describe Gitlab::ImportExport::Project::TreeRestorer do
expect(@project.auto_devops.deploy_strategy).to eq('continuous') expect(@project.auto_devops.deploy_strategy).to eq('continuous')
end end
it 'restores the correct service' do
expect(CustomIssueTrackerService.first).not_to be_nil
end
it 'restores zoom meetings' do it 'restores zoom meetings' do
meetings = @project.issues.first.zoom_meetings meetings = @project.issues.first.zoom_meetings
...@@ -553,8 +549,7 @@ RSpec.describe Gitlab::ImportExport::Project::TreeRestorer do ...@@ -553,8 +549,7 @@ RSpec.describe Gitlab::ImportExport::Project::TreeRestorer do
labels: 2, labels: 2,
label_with_priorities: 'A project label', label_with_priorities: 'A project label',
milestones: 1, milestones: 1,
first_issue_labels: 1, first_issue_labels: 1
services: 1
end end
context 'when there is an existing build with build token' do context 'when there is an existing build with build token' do
...@@ -637,7 +632,6 @@ RSpec.describe Gitlab::ImportExport::Project::TreeRestorer do ...@@ -637,7 +632,6 @@ RSpec.describe Gitlab::ImportExport::Project::TreeRestorer do
label_with_priorities: 'A project label', label_with_priorities: 'A project label',
milestones: 1, milestones: 1,
first_issue_labels: 1, first_issue_labels: 1,
services: 1,
import_failures: 1 import_failures: 1
it 'records the failures in the database' do it 'records the failures in the database' do
...@@ -757,18 +751,6 @@ RSpec.describe Gitlab::ImportExport::Project::TreeRestorer do ...@@ -757,18 +751,6 @@ RSpec.describe Gitlab::ImportExport::Project::TreeRestorer do
setup_reader(reader) setup_reader(reader)
end end
it 'does not import any templated services' do
expect(restored_project_json).to eq(true)
expect(project.services.where(template: true).count).to eq(0)
end
it 'does not import any instance services' do
expect(restored_project_json).to eq(true)
expect(project.services.where(instance: true).count).to eq(0)
end
it 'imports labels' do it 'imports labels' do
create(:group_label, name: 'Another label', group: project.group) create(:group_label, name: 'Another label', group: project.group)
...@@ -972,7 +954,6 @@ RSpec.describe Gitlab::ImportExport::Project::TreeRestorer do ...@@ -972,7 +954,6 @@ RSpec.describe Gitlab::ImportExport::Project::TreeRestorer do
label_with_priorities: nil, label_with_priorities: nil,
milestones: 1, milestones: 1,
first_issue_labels: 0, first_issue_labels: 0,
services: 0,
import_failures: 1 import_failures: 1
it 'records the failures in the database' do it 'records the failures in the database' do
......
...@@ -223,18 +223,6 @@ RSpec.describe Gitlab::ImportExport::Project::TreeSaver do ...@@ -223,18 +223,6 @@ RSpec.describe Gitlab::ImportExport::Project::TreeSaver do
it { is_expected.not_to be_empty } it { is_expected.not_to be_empty }
end end
context 'with services' do
let(:relation_name) { :services }
it 'saves the correct service type' do
expect(subject.first['type']).to eq('CustomIssueTrackerService')
end
it 'saves the properties for a service' do
expect(subject.first['properties']).to eq('one' => 'value')
end
end
context 'with project_feature' do context 'with project_feature' do
let(:relation_name) { :project_feature } let(:relation_name) { :project_feature }
...@@ -453,7 +441,6 @@ RSpec.describe Gitlab::ImportExport::Project::TreeSaver do ...@@ -453,7 +441,6 @@ RSpec.describe Gitlab::ImportExport::Project::TreeSaver do
create(:resource_label_event, label: group_label, merge_request: merge_request) create(:resource_label_event, label: group_label, merge_request: merge_request)
create(:event, :created, target: milestone, project: project, author: user) create(:event, :created, target: milestone, project: project, author: user)
create(:service, project: project, type: 'CustomIssueTrackerService', category: 'issue_tracker', properties: { one: 'value' })
create(:project_custom_attribute, project: project) create(:project_custom_attribute, project: project)
create(:project_custom_attribute, project: project) create(:project_custom_attribute, project: project)
......
...@@ -461,36 +461,6 @@ DeployKey: ...@@ -461,36 +461,6 @@ DeployKey:
- public - public
- can_push - can_push
- last_used_at - last_used_at
Service:
- id
- type
- title
- project_id
- created_at
- updated_at
- active
- properties
- template
- instance
- alert_events
- push_events
- issues_events
- commit_events
- merge_requests_events
- tag_push_events
- note_events
- pipeline_events
- job_events
- comment_on_event_enabled
- comment_detail
- category
- default
- wiki_page_events
- confidential_issues_events
- confidential_note_events
- deployment_events
- description
- inherit_from_id
ProjectHook: ProjectHook:
- id - id
- url - url
......
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