Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
c2396ce0
Commit
c2396ce0
authored
Jul 15, 2019
by
Fabio Pitino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not import legacy triggers from project JSON
parent
2397f171
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
3 deletions
+22
-3
lib/gitlab/import_export/relation_factory.rb
lib/gitlab/import_export/relation_factory.rb
+7
-0
spec/lib/gitlab/import_export/project.json
spec/lib/gitlab/import_export/project.json
+7
-0
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
+8
-3
No files found.
lib/gitlab/import_export/relation_factory.rb
View file @
c2396ce0
...
...
@@ -78,6 +78,9 @@ module Gitlab
def
create
return
if
unknown_service?
# Do not import legacy triggers
return
if
!
Feature
.
enabled?
(
:use_legacy_pipeline_triggers
,
@project
)
&&
legacy_trigger?
setup_models
generate_imported_object
...
...
@@ -278,6 +281,10 @@ module Gitlab
!
Object
.
const_defined?
(
parsed_relation_hash
[
'type'
])
end
def
legacy_trigger?
@relation_name
==
'Ci::Trigger'
&&
@relation_hash
[
'owner_id'
].
nil?
end
def
find_or_create_object!
return
relation_class
.
find_or_create_by
(
project_id:
@project
.
id
)
if
@relation_name
==
:project_feature
...
...
spec/lib/gitlab/import_export/project.json
View file @
c2396ce0
...
...
@@ -6633,6 +6633,13 @@
"owner_id"
:
1
,
"created_at"
:
"2017-01-16T15:25:28.637Z"
,
"updated_at"
:
"2017-01-16T15:25:28.637Z"
},
{
"id"
:
456
,
"token"
:
"33a66349b5ad01fc00174af87804e40"
,
"project_id"
:
5
,
"created_at"
:
"2017-01-16T15:25:29.637Z"
,
"updated_at"
:
"2017-01-16T15:25:29.637Z"
}
],
"deploy_keys"
:
[],
...
...
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
View file @
c2396ce0
...
...
@@ -32,6 +32,10 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
end
context
'JSON'
do
before
do
stub_feature_flags
(
use_legacy_pipeline_triggers:
false
)
end
it
'restores models based on JSON'
do
expect
(
@restored_project_json
).
to
be_truthy
end
...
...
@@ -198,8 +202,9 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
end
context
'tokens are regenerated'
do
it
'has a new CI trigger token'
do
expect
(
Ci
::
Trigger
.
where
(
token:
'cdbfasdf44a5958c83654733449e585'
)).
to
be_empty
it
'has new CI trigger tokens'
do
expect
(
Ci
::
Trigger
.
where
(
token:
%w[cdbfasdf44a5958c83654733449e585 33a66349b5ad01fc00174af87804e40]
))
.
to
be_empty
end
it
'has a new CI build token'
do
...
...
@@ -212,7 +217,7 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
expect
(
@project
.
merge_requests
.
size
).
to
eq
(
9
)
end
it
'
has the correct number of
triggers'
do
it
'
only restores valid
triggers'
do
expect
(
@project
.
triggers
.
size
).
to
eq
(
1
)
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment