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
443f0215
Commit
443f0215
authored
Nov 18, 2020
by
Adrien Kohlbecker
Committed by
Yannis Roussos
Nov 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix project transfer corrupting shared runners state
parent
695735e3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
6 deletions
+17
-6
app/services/projects/transfer_service.rb
app/services/projects/transfer_service.rb
+11
-5
changelogs/unreleased/ak-fix-project-transfer.yml
changelogs/unreleased/ak-fix-project-transfer.yml
+5
-0
spec/services/projects/transfer_service_spec.rb
spec/services/projects/transfer_service_spec.rb
+1
-1
No files found.
app/services/projects/transfer_service.rb
View file @
443f0215
...
@@ -71,7 +71,10 @@ module Projects
...
@@ -71,7 +71,10 @@ module Projects
Project
.
transaction
do
Project
.
transaction
do
project
.
expire_caches_before_rename
(
@old_path
)
project
.
expire_caches_before_rename
(
@old_path
)
# Apply changes to the project
update_namespace_and_visibility
(
@new_namespace
)
update_namespace_and_visibility
(
@new_namespace
)
update_shared_runners_settings
project
.
save!
# Notifications
# Notifications
project
.
send_move_instructions
(
@old_path
)
project
.
send_move_instructions
(
@old_path
)
...
@@ -84,10 +87,6 @@ module Projects
...
@@ -84,10 +87,6 @@ module Projects
# Move uploads
# Move uploads
move_project_uploads
(
project
)
move_project_uploads
(
project
)
# If a project is being transferred to another group it means it can already
# have shared runners enabled but we need to check whether the new group allows that.
project
.
shared_runners_enabled
=
false
if
project
.
group
&&
project
.
group
.
shared_runners_setting
==
'disabled_and_unoverridable'
project
.
old_path_with_namespace
=
@old_path
project
.
old_path_with_namespace
=
@old_path
update_repository_configuration
(
@new_path
)
update_repository_configuration
(
@new_path
)
...
@@ -120,7 +119,6 @@ module Projects
...
@@ -120,7 +119,6 @@ module Projects
# Apply new namespace id and visibility level
# Apply new namespace id and visibility level
project
.
namespace
=
to_namespace
project
.
namespace
=
to_namespace
project
.
visibility_level
=
to_namespace
.
visibility_level
unless
project
.
visibility_level_allowed_by_group?
project
.
visibility_level
=
to_namespace
.
visibility_level
unless
project
.
visibility_level_allowed_by_group?
project
.
save!
end
end
def
update_repository_configuration
(
full_path
)
def
update_repository_configuration
(
full_path
)
...
@@ -208,6 +206,14 @@ module Projects
...
@@ -208,6 +206,14 @@ module Projects
def
new_design_repo_path
def
new_design_repo_path
"
#{
new_path
}#{
::
Gitlab
::
GlRepository
::
DESIGN
.
path_suffix
}
"
"
#{
new_path
}#{
::
Gitlab
::
GlRepository
::
DESIGN
.
path_suffix
}
"
end
end
def
update_shared_runners_settings
# If a project is being transferred to another group it means it can already
# have shared runners enabled but we need to check whether the new group allows that.
if
project
.
group
&&
project
.
group
.
shared_runners_setting
==
'disabled_and_unoverridable'
project
.
shared_runners_enabled
=
false
end
end
end
end
end
end
...
...
changelogs/unreleased/ak-fix-project-transfer.yml
0 → 100644
View file @
443f0215
---
title
:
Fix project transfer corrupting shared runners state
merge_request
:
48032
author
:
type
:
fixed
spec/services/projects/transfer_service_spec.rb
View file @
443f0215
...
@@ -9,7 +9,7 @@ RSpec.describe Projects::TransferService do
...
@@ -9,7 +9,7 @@ RSpec.describe Projects::TransferService do
let_it_be
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
:legacy_storage
,
namespace:
user
.
namespace
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
:legacy_storage
,
namespace:
user
.
namespace
)
}
subject
(
:execute_transfer
)
{
described_class
.
new
(
project
,
user
).
execute
(
group
)
}
subject
(
:execute_transfer
)
{
described_class
.
new
(
project
,
user
).
execute
(
group
)
.
tap
{
project
.
reload
}
}
context
'with npm packages'
do
context
'with npm packages'
do
before
do
before
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