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
29527d21
Commit
29527d21
authored
Dec 18, 2018
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update storage location after a project has been transfered
parent
3962c725
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
3 deletions
+24
-3
app/services/projects/transfer_service.rb
app/services/projects/transfer_service.rb
+4
-3
spec/services/projects/transfer_service_spec.rb
spec/services/projects/transfer_service_spec.rb
+20
-0
No files found.
app/services/projects/transfer_service.rb
View file @
29527d21
...
@@ -81,7 +81,7 @@ module Projects
...
@@ -81,7 +81,7 @@ module Projects
project
.
old_path_with_namespace
=
@old_path
project
.
old_path_with_namespace
=
@old_path
write_repository_config
(
@new_path
)
update_repository_configuration
(
@new_path
)
execute_system_hooks
execute_system_hooks
end
end
...
@@ -106,8 +106,9 @@ module Projects
...
@@ -106,8 +106,9 @@ module Projects
project
.
save!
project
.
save!
end
end
def
write_repository_config
(
full_path
)
def
update_repository_configuration
(
full_path
)
project
.
write_repository_config
(
gl_full_path:
full_path
)
project
.
write_repository_config
(
gl_full_path:
full_path
)
project
.
track_project_repository
end
end
def
refresh_permissions
def
refresh_permissions
...
@@ -123,7 +124,7 @@ module Projects
...
@@ -123,7 +124,7 @@ module Projects
rollback_folder_move
rollback_folder_move
project
.
reload
project
.
reload
update_namespace_and_visibility
(
@old_namespace
)
update_namespace_and_visibility
(
@old_namespace
)
write_repository_config
(
@old_path
)
update_repository_configuration
(
@old_path
)
end
end
def
rollback_folder_move
def
rollback_folder_move
...
...
spec/services/projects/transfer_service_spec.rb
View file @
29527d21
...
@@ -63,6 +63,15 @@ describe Projects::TransferService do
...
@@ -63,6 +63,15 @@ describe Projects::TransferService do
expect
(
rugged_config
[
'gitlab.fullpath'
]).
to
eq
"
#{
group
.
full_path
}
/
#{
project
.
path
}
"
expect
(
rugged_config
[
'gitlab.fullpath'
]).
to
eq
"
#{
group
.
full_path
}
/
#{
project
.
path
}
"
end
end
it
'updates storage location'
do
transfer_project
(
project
,
user
,
group
)
expect
(
project
.
project_repository
).
to
have_attributes
(
disk_path:
"
#{
group
.
full_path
}
/
#{
project
.
path
}
"
,
shard_name:
project
.
repository_storage
)
end
context
'new group has a kubernetes cluster'
do
context
'new group has a kubernetes cluster'
do
let
(
:group_cluster
)
{
create
(
:cluster
,
:group
,
:provided_by_gcp
)
}
let
(
:group_cluster
)
{
create
(
:cluster
,
:group
,
:provided_by_gcp
)
}
let
(
:group
)
{
group_cluster
.
group
}
let
(
:group
)
{
group_cluster
.
group
}
...
@@ -139,6 +148,17 @@ describe Projects::TransferService do
...
@@ -139,6 +148,17 @@ describe Projects::TransferService do
expect
(
service
).
not_to
receive
(
:execute_system_hooks
)
expect
(
service
).
not_to
receive
(
:execute_system_hooks
)
end
end
end
end
it
'does not update storage location'
do
create
(
:project_repository
,
project:
project
)
attempt_project_transfer
expect
(
project
.
project_repository
).
to
have_attributes
(
disk_path:
project
.
disk_path
,
shard_name:
project
.
repository_storage
)
end
end
end
context
'namespace -> no namespace'
do
context
'namespace -> no namespace'
do
...
...
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